Memory leak in core with Free object table
Closed / Fixed218027ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:52:20
OriginalBugID: 1248 Bug
Version: 8.0.3
SubmitDate: '1999-02-22'
LastModified: '1999-08-14'
Severity: SER
Status: Closed
Submitter: welch
ChangedBy: hobbs
OS: IRIX
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '1999-08-14'
Name:
Forest Rouse
Extensions:
blt2.4, expect 5.25, scotty 2.1.8, Tix 8.0.1, tkX 8.0.3
CustomShell:
Have not applied patches, no redefinitions, extended the core but the
ReproducibleScript:
None applicable -- Pretty much any tk script will see this problem
ObservedBehavior:
Didn't keep purify output
Patch:
*** tclObj.c~ Wed Apr 1 14:39:49 1998
--- tclObj.c Sun Feb 7 20:32:08 1999
***************
*** 27,32 ****
--- 27,38 ----
*/
Tcl_Obj *tclFreeObjList = NULL;
+ typedef struct Tcl_ObjectChunks_ {
+ char *chunk;
+ struct Tcl_ObjectChunks_ *next;
+ } Tcl_ObjectChunks;
+
+ static Tcl_ObjectChunks *tclFreeObjAlloc = NULL;
/*
* Pointer to a heap-allocated string of length zero that the Tcl core uses
***************
*** 189,195 ****
--- 195,225 ----
static void
FinalizeFreeObjList()
{
+ /* First, run down all of the chunks. It cannot be a
+ Tcl_Obj (though I would have liked that) because
+ we are getting rid of the data storage for all objects
+ at this time. They could be objects, but would
+ have to be allocated in a mechanism seperate from
+ Tcl_NewObj */
+
+ Tcl_ObjectChunks *p = tclFreeObjAlloc;
+ while (p) {
+ char *chunk = p->chunk;
+ Tcl_ObjectChunks *next = p->next;
+
+ /* Free chunk, get rid of chunk descriptor and go to next
+ descriptor. */
+
+ ckfree(chunk);
+ ckfree((char *) p);
+ p = next;
+ }
+
+ /* Now note that both the free object list and the chunk
+ allocation lists are empty */
+
tclFreeObjList = NULL;
+ tclFreeObjAlloc = NULL;
}
/*
***************
*** 561,566 ****
--- 591,597 ----
size_t bytesToAlloc = (OBJS_TO_ALLOC_EACH_TIME * objSizePlusPadding);
char *basePtr;
register Tcl_Obj *prevPtr, *objPtr;
+ register Tcl_ObjectChunks *chunkPtr;
register int i;
basePtr = (char *) ckalloc(bytesToAlloc);
***************
*** 574,579 ****
--- 605,617 ----
objPtr = (Tcl_Obj *) (((char *)objPtr) + objSizePlusPadding);
}
tclFreeObjList = prevPtr;
+
+ /* Now store the actual chunk that was allocated */
+
+ chunkPtr = (Tcl_ObjectChunks *) ckalloc(sizeof(Tcl_ObjectChunks));
+ chunkPtr->chunk = basePtr;
+ chunkPtr->next = tclFreeObjAlloc;
+ tclFreeObjAlloc = chunkPtr;
}
#undef OBJS_TO_ALLOC_EACH_TIME
PatchFiles:
tclObj.c
This patch is no longer applicable to the code base (significant
divergence). The mem leak may have been fixed along the way.
-- 08/14/1999 hobbs
welch Closed ticket [218027ffff].
[History diff]2000-10-26 08:13:42
dgp Ticket [218027ffff]: 3 changes
[History diff]2001-04-16 22:59:31
Log in (anonymous is fine) to add a comment.