Overview
Artifact ID: | aa94e38ef8aa017895aa1a2fc2be3c19ee3f194f |
---|---|
Ticket: | 3493120fffffffffffffffffffffffffffffffff
Thread extension, memory leak after thread exit |
User & Date: | sebres 2014-04-22 17:44:30 |
Changes
- comment changed to:
Version: 8.5.11 (original and current core-8-5-branch) Platform: Windows (linux not yet tested) After exiting of threads, they leave a memory leak. Consequence of that: we cannot use techniques such as 'idletime' (to release some system resources, for example large tcl codes are no more used, etc, etc.). After run of following script I have lost 100MB of memory. In fact, nothing will be done here, except threads are created and exited. Test script: puts [thread::names] time { thread::create {::thread::release} } 500 puts [thread::names]
- icomment:
I can't test CentOS right now, but it work on all my linux systems, for ex.: debian / kernel 3.13.0-23-generic. I think, possible in tclUnixThrd.c TclpFreeAllocCache may miss a something like "pthread_setspecific(key, NULL);" after call of "TclFreeAllocCache(ptr);" (in comparison to tclWinThrd.c). But [c251d61424] alone, without this, works fine on my linux mashines. <pre> void TclpFreeAllocCache( void *ptr) { if (ptr != NULL) { /* * Called by the pthread lib when a thread exits */ TclFreeAllocCache(ptr); <b style="color:red">pthread_setspecific(key, NULL);</b> } else if (initialized) { /* * Called by us in TclFinalizeThreadAlloc() during the library * finalization initiated from Tcl_Finalize() */ pthread_key_delete(key); initialized = 0; } } </pre> @Don: could you tell me please where exactly you have segfaulting on centos (some tcl-tests? or something else?), because I can't reproduce it on my linux systems.
- login: "sebres"
- mimetype: "text/html"
- username: "sebres"