|
| I am seeing a memory leak when using scotty. I would appreciate any
information which will enable me to fix the problem.
I have tried enabling the memory debug(TCL_MEM_DEBUG) and after I run
my script I take the dump of the active memory by issuing the commnd
"memory active filename".
The output is show below. Line 957, I have a string object allocated
in TnmMibFormatValue which does not seems to be released.
2b2e6c0 - 2b2e6ca 11 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b34cf0 - 2b34d07 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b34cb0 - 2b34cba 11 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b23370 - 2b23387 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2af1968 - 2af196c 5 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 288
2af1918 - 2af192f 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 451
2afc348 - 2afc34c 5 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 288
2afc2f8 - 2afc30f 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 451
2b34b78 - 2b34b7e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b2d3d0 - 2b2d3e7 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b34b38 - 2b34b3e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2af86d0 - 2af86e7 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b28290 - 2b28296 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b3ade0 - 2b3adf7 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b23438 - 2b2343e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b27ff0 - 2b28007 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2ac5230 - 2ac5236 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b27b78 - 2b27b8f 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b14f38 - 2b14f3e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b1e208 - 2b1e21f 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b23938 - 2b2393e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b23528 - 2b2353f 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2af87a0 - 2af87a6 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b12de8 - 2b12dff 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b18088 - 2b1808e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b18038 - 2b1804f 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b16608 - 2b1660e 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b18320 - 2b18337 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b167e0 - 2b167e6 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b0fe10 - 2b0fe27 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
2b23af0 - 2b23af6 7 @
build/sunos5/build/tcl8.0.5/generic/tclStringObj.c 160
2b14ed0 - 2b14ee7 24 @
build/sunos5/build/scotty-3-new/tnm/snmp/tnmMibUtil.c 957
The code is :
Tcl_Obj*
TnmMibFormatValue(typePtr, syntax, value)
TnmMibType *typePtr;
int syntax;
Tcl_Obj *value;
{
Tcl_Obj *objPtr = NULL;
if (typePtr) {
/*
* Check if we have an enumeration for this value. Otherwise,
* try to apply a display hint, if we have one.
*/
if (typePtr->restKind == TNM_MIB_REST_ENUMS) {
TnmMibRest *rPtr;
long ival;
if (syntax == ASN1_OCTET_STRING ) {
char *s,*r;
s = Tcl_GetStringFromObj(value, NULL);
ival = strtol(s,&r,16);
} else {
if (Tcl_GetLongFromObj(NULL, value, &ival) != TCL_OK) {
printf("\nSCOTTY: illegal value for integer enumeration %d",ival);
}
}
for (rPtr = typePtr->restList; rPtr; rPtr = rPtr->nextPtr) {
if (rPtr->rest.intEnum.enumValue == ival) {
objPtr = Tcl_NewStringObj(rPtr->rest.intEnum.enumLabel,-1); <==
line 957
}
}
}
if (typePtr->displayHint) {
switch (syntax) {
case ASN1_OCTET_STRING:
objPtr = FormatOctetTC(value, typePtr->displayHint);
break;
case ASN1_INTEGER:
objPtr = FormatIntTC(value, typePtr->displayHint);
break;
}
}
}
/*
* Finally, apply some special conversions for some well-known
* SNMP base types.
*/
if (syntax == ASN1_OBJECT_IDENTIFIER) {
if (Tcl_ConvertToType(NULL, value, &tnmOidType) != TCL_OK) {
panic("illegal value for object identifier");
}
objPtr = Tcl_DuplicateObj(value);
TnmOidObjSetRep(objPtr, TNM_OID_AS_NAME);
Tcl_InvalidateStringRep(objPtr);
}
return objPtr;
}
|
|