Artifacts Associated With Ticket 733221ffffffffffffffffffffffffffffffffff
Ticket change [18011f1542] (rid 122593) by mistachkin on 2003-05-06 12:07:49:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
-------- generic/tclDate.c 1. Shouldn't this file be using ckalloc/ckrealloc? 2. The following variables are allocated and are never freed: int *TclDates; YYSTYPE *TclDatev; -------- win/tclAppInit.c, line 269: argSpace = (char *) Tcl_Alloc( (unsigned) (size * sizeof(char *) + strlen (cmdLine) + 1)); 1. Shouldn't this also be ckalloc? 2. This is a local variable in the function. 3. This memory is never freed. -------- tools/encoding/txt2enc.c 1. Memory allocated via malloc on line #181 and #204 is never freed. 2. Since this is a stand-alone utility, it should be fairly trivial to fix these leaks with the following code before "return 0" on line #243: for (hi = 0; hi < 256; hi++) { if (toUnicode[hi] != NULL) { free(toUnicode[hi]); toUnicode[hi] = NULL; } } -------- generic/tclThreadAlloc.c 1. We have the static file variables: static Tcl_Mutex *listLockPtr; static Tcl_Mutex *objLockPtr; 2. They are allocated via TclpNewAllocMutex, which BOTH allocates memory via malloc AND calls InitializeCriticalSection on the contained critical section. 3. Neither the block of memory nor the critical section are ever freed. 4. There needs to be a new function in tclThreadAlloc.c, called "TclFinalizeThreadAllocSubsystem", that frees these mutexes (probably by calling an appropriate platform specific func, yet to be created, perhaps called "TclpNewFreeMutex") and then calls the "TclpFinalizeThreadAllocSubsystem" function for the platform specific cleanup (i've created the Win32 version of this function in my new patch #731356). 5. Another leak (see SF bug #731754, fixed in my patch #731356) involves this code, near line #279: #ifdef WIN32 TlsFree((DWORD) cachePtr); #else free(cachePtr); #endif The above code is entirely incorrect for Win32. I believe it should always be "free(cachePtr);" as cachePtr is NOT a TLS index, it is a block of memory. 6. Yet another leak (also fixed in my patch #731356) involves freeing the actual TLS index used by the threaded memory allocator (what the above incorrect code was TRYING and failing to do). -------- - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "mistachkin"
- subsystem initialized to: "41. Memory Allocation"
- title initialized to: "various memory leaks..."
- type initialized to: "Bug"
Ticket change [074b65535f] (rid 89369) by mistachkin on 2003-05-06 19:08:03:
- priority changed to: "9 Immediate"
Ticket change [d822cd212b] (rid 107385) by mistachkin on 2003-05-10 15:34:55:
- icomment:
Logged In: YES user_id=113501 I have fixed the tclAppInit.c leaks, the txt2enc.c leak, and tclThreadAlloc.c cachePtr leak. I need some help (from JeffH ?) understanding the "style" of the threaded memory allocator to fix the remaining leaks in it. The tclDate.c leaks totally confuse me as I have zero experience with yacc. I'm of the opinion that these leaks should be plugged by creating a new finalization routine specific to the tclDate.c file called "TclFinalizeDate" or something like that. Also, this file should definately be calling ckalloc/ckrealloc and NOT mallco/realloc. However, I haven't the foggiest idea how to make yacc "do the right thing".
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [ccdf24e66e] (rid 95779) by hobbs on 2003-05-11 06:24:28:
- closedate changed to: "2003-05-10T23:24:28"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 Please open the remaining bugs as individual reports. It makes it easier to track which pieces are closed (and you have now corrected the greater part of this multi-part report). For tclDate.c ... it's all auto-generated and I've never looked too deeply into the yacc. In any case, it does not appear to be a leak since YYMAXDEPTH is defined right above it (it isn't defined anywhere else), so that info is static. The threaded malloc was written by Jim Davidson et al at AOL, but Zoran might also know a bit about it.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "hobbs"
Ticket change [426e2fc34d] (rid 116380) by dkf on 2003-05-12 15:58:09:
- icomment:
Logged In: YES user_id=79902 Fixing yacc output so it doesn't leak is really rather difficult because yacc was never designed to be used that way; you have to install your own memory allocators in the file that track all the intermediate memory allocated and release all the bits when you're done with them. I don't think you can do this without generating loads of warnings. IMHO not using yacc is probably a better solution. I'm sure KBK will agree. ;^)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [ddb78dc3fd] (rid 114721) by dkf on 2003-05-12 15:58:17:
- closedate changed to: "2003-05-12T08:58:17"
- closer changed to: "dkf"