Obj Memory Leak
Closed / Invalid1049909fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-10-19 09:50:25
sorry my poor english.
but i think that follow funtion in tclobj.c need to add
some code to avoid memory leak.
void
TclFinalizeCompExecEnv()
{
register Tcl_Obj *objPtr;
Tcl_MutexLock(&tableMutex);
if (typeTableInitialized) {
Tcl_DeleteHashTable(&typeTable);
typeTableInitialized = 0;
}
Tcl_MutexUnlock(&tableMutex);
Tcl_MutexLock(&tclObjMutex);
//{ lisong 2004-10-19
// add to fix memory leak of objptr
while (tclFreeObjList != NULL)
{
objPtr = tclFreeObjList;
tclFreeObjList = objPtr-
>internalRep.otherValuePtr;
}
free(objPtr);
//}lisong
Tcl_MutexUnlock(&tclObjMutex);
TclFinalizeCompilation();
TclFinalizeExecution();
}
msoferplain2004-10-19 17:06:24
Logged In: YES user_id=148712 No. The Tcl_Obj are allocated in a pool, you cannot free them independently (except if tcl was compiled with -DPURIFY, in which case there is not tclFreeObjList, and the core handles the freeing already). The free objects are not properly freed by tcl. They are kept around for reuse, and tcl relies on the OS to release the memory at exit. See the comments in the function TclAllocateFreeObjects(), in generic/tclObj.c
Log in (anonymous is fine) to add a comment.