Artifacts Associated With Ticket 736426ffffffffffffffffffffffffffffffffff
Ticket change [96993f2046] (rid 106349) by mistachkin on 2003-05-12 11:28:51:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
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. This applies to the above static variables and to any other mutexes allocated via TclpNewAllocMutex. 5. 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). 6. Yet another leak involves freeing the actual TLS index used by the threaded memory allocator.
- foundin initialized to: "None"
- priority initialized to: "9 Immediate"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "mistachkin"
- subsystem initialized to: "41. Memory Allocation"
- title initialized to: "memory leaks in tclThreadAlloc.c"
- type initialized to: "Bug"
Ticket change [777383b69b] (rid 89778) by mistachkin on 2003-07-15 17:18:39:
- icomment:
Logged In: YES user_id=113501 I can now easily reproduce a crash in the latest Tcl/Tk regarding this issue (limited number of TLS indexes per process). The cause is that Tcl/Tk doesn't think that anybody else in the process is going to be using TLS indexes, which is definitely NOT the case. Tcl (especially with Tk) very very rapidly runs out of TLS indexes for even trivial Tk scripts. I can write a simple C app that uses Tcl/Tk and allocates about half of the available TLS indexes on NT4 to demonstrate.
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [49f051be1d] (rid 126457) by hobbs on 2003-10-13 06:41:30:
- icomment:
Logged In: YES user_id=72656 NT4 is no longer a supported OS. Please create one that can be reproduced on 98, 2000 or XP.
- login: "hobbs"
- mimetype: "text/plain"
- priority changed to: "8"
- username: "hobbs"
- icomment:
Ticket change [dfb19950c3] (rid 115053) by mistachkin on 2003-11-11 15:08:15:
- icomment:
Logged In: YES user_id=113501 The issue is NOT with NT4. This bug (and a couple other related ones) demonstrate design flaws in the threaded memory allocator. I am more than willing to help fix these problems, however, I am lacking information about the original intent of some aspects of the design, as I have mentioned previously.
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [7007be54b4] (rid 100407) by dgp on 2003-11-13 08:54:59:
- foundin changed to: "obsolete: 8.4.5"
Ticket change [1583cd0cbd] (rid 124576) by mistachkin on 2004-06-24 15:20:48:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=113501 This bug appears to still be in HEAD. Assigning to dkf because he touched it last.
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
Ticket change [ca4fc940b1] (rid 95319) by dkf on 2004-06-24 16:01:49:
- assignee changed to: "hobbs"
- icomment:
Logged In: YES user_id=79902 I was just style-fixing. I know nothing about how to fix these problems.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [816b0f6611] (rid 117028) by mistachkin on 2004-07-14 10:28:52:
- foundin changed to: "obsolete: 8.4.6"
- icomment:
Logged In: YES user_id=113501 from CVS HEAD (the leak is in TclpGetAllocCache): 200 bytes in 1 blocks are definitely lost in loss record 12 of 41 at 0x3C0250D5: malloc (in /usr/local/lib/valgrind/vgpreload_memche$ by 0x3C0FC720: (within /usr/local/lib/valgrind/libc_r.so.4) by 0x3C0FEFE9: (within /usr/local/lib/valgrind/libc_r.so.4) by 0x3C0FF179: pthread_key_create (in /usr/local/lib/valgrind/libc$ by 0x3C0BFF9B: (within ./libtcl8.5.so) by 0x3C0FF800: pthread_once (in /usr/local/lib/valgrind/libc_r.so.$ by 0x3C0BFFDD: TclpGetAllocCache (in ./libtcl8.5.so) by 0x3C0AC485: TclpAlloc (in ./libtcl8.5.so) by 0x3C04F550: Tcl_Alloc (in ./libtcl8.5.so) by 0x3C0BFAB1: Tcl_MutexLock (in ./libtcl8.5.so) by 0x3C09A712: TclInitObjSubsystem (in ./libtcl8.5.so) by 0x3C070CB9: TclInitSubsystems (in ./libtcl8.5.so) by 0x3C06DE97: Tcl_FindExecutable (in ./libtcl8.5.so) by 0x3C093E78: Tcl_Main (in ./libtcl8.5.so) by 0x8048632: main (in ./tclsh) also from CVS HEAD (mutexes allocated by TclpNewAllocMutex are never freed, there are a lot of these): 132 bytes in 11 blocks are still reachable in loss record 11 of 41 at 0x3C0250D5: malloc (in /usr/local/lib/valgrind/vgpreload_memche$ by 0x3C0FC720: (within /usr/local/lib/valgrind/libc_r.so.4) by 0x3C0FDCAE: pthread_mutex_init (in /usr/local/lib/valgrind/libc$ by 0x3C0BFF68: TclpNewAllocMutex (in ./libtcl8.5.so) by 0x3C0AC2F8: (within ./libtcl8.5.so) by 0x3C0AC490: TclpAlloc (in ./libtcl8.5.so) by 0x3C04F550: Tcl_Alloc (in ./libtcl8.5.so) by 0x3C0BFAB1: Tcl_MutexLock (in ./libtcl8.5.so) by 0x3C09A712: TclInitObjSubsystem (in ./libtcl8.5.so) by 0x3C070CB9: TclInitSubsystems (in ./libtcl8.5.so) by 0x3C06DE97: Tcl_FindExecutable (in ./libtcl8.5.so) by 0x3C093E78: Tcl_Main (in ./libtcl8.5.so) by 0x8048632: main (in ./tclsh) - login: "mistachkin"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "mistachkin"
Ticket change [3e0c6ce6ec] (rid 121194) by mistachkin on 2004-07-16 01:02:01:
- icomment:
File Added - 94054: bug736426.diff Logged In: YES user_id=113501 This patch should fix all the remaining leaks in the threaded memory allocator. Please review.
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [97da5599b8] (rid 110506) by kennykb on 2004-07-16 03:43:01:
- icomment:
Logged In: YES user_id=99768 Revised patch attached; corrects several compilation problems on Win2k/VC++6.
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [c19cf0dd3e] (rid 111346) by kennykb on 2004-07-16 03:43:02:
- icomment:
File Added - 94071: 736426.patch
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [e6ca18af0e] (rid 104352) by mistachkin on 2004-07-16 10:12:33:
- icomment:
File Deleted - 94054:
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [8fa7e858c8] (rid 120313) by mistachkin on 2004-07-16 10:16:19:
- icomment:
Logged In: YES user_id=113501 Ok, this time with feeling. Here is an updated patch (based on kbk's) that includes cleanup of the Unix pthread key as well. This should fix all known memory/resource leaks in the threaded memory allocator and make it possible for it to be re-initialized properly if Tcl is unloaded and reloaded into a process (such as a browser).
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Add attachment "bug736426.diff" [93e5075697] (rid 105880) by mistachkin on 2004-07-16 10:16:21.
Ticket change [42741e0ea0] (rid 116383) by mistachkin on 2004-07-16 10:16:21:
- icomment:
File Added - 94096: bug736426.diff
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [3a092cdbf1] (rid 112494) by kennykb on 2004-07-21 06:52:41:
- icomment:
File Deleted - 94071: File Added - 94624: 736426-8.4.patch Logged In: YES user_id=99768 Backported for 8.4 - patch attached
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [fd692f36e9] (rid 108410) by hobbs on 2004-07-21 07:38:37:
- icomment:
Logged In: YES user_id=72656 The use of PTHREAD_ONCE_INIT in FreeKey is invalid on HP and Solaris, where it is a struct. This conflict needs to be resolved because it's central to reinitialization.
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Add attachment "736426-8.4.patch" [819ab464e8] (rid 117067) by hobbs on 2004-07-21 08:32:04.
Ticket change [6da102807f] (rid 128738) by hobbs on 2004-07-21 08:32:04:
- icomment:
File Added - 94635: 736426-8.4.patch Logged In: YES user_id=72656 Attached is the patch applied for 8.4.
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [aa362a58d3] (rid 99287) by hobbs on 2004-07-21 08:32:05:
- icomment:
File Deleted - 94624:
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [9a068999ce] (rid 110888) by hobbs on 2004-07-21 08:47:11:
- closedate changed to: "2004-07-21T01:47:11"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 Attached is the patch applied for 8.5-head.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "hobbs"
Ticket change [a81841205c] (rid 98915) by hobbs on 2004-07-21 08:47:12:
- icomment:
File Added - 94637: 736426-8.5.patch
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Add attachment "736426-8.5.patch" [d5906087d9] (rid 123645) by hobbs on 2004-07-21 08:47:12.