|
2014-04-24
| ||
| 04:34 | [3493120] Plug memory leak in thread exit. check-in: 6b5f70a82f user: dgp tags: trunk | |
|
2014-04-23
| ||
| 18:26 | • Closed ticket [3493120fff]: Thread extension, memory leak after thread exit ... artifact: e300ce18e7 user: dgp | |
| 18:25 | [3493120] Plug memory leak in thread exit. check-in: 18257b2f89 user: dgp tags: core-8-5-branch | |
| 09:19 | • Ticket [3493120fff] Thread extension, memory leak after thread exit status s... artifact: c97297853a user: sebres | |
|
2014-04-22
| ||
| 20:02 | • Ticket [3493120fff]: 3 changes artifact: f7ba79b9a2 user: dgp | |
| 20:02 | • Ticket [3493120fff]: 3 changes artifact: 6c81c020e9 user: dgp | |
| 17:44 | • Ticket [3493120fff]: 5 changes artifact: aa94e38ef8 user: sebres | |
| 13:38 | • Pending ticket [3493120fff]. artifact: 2e9ced0a19 user: sebres | |
| 13:28 | • Ticket [3493120fff]: 8 changes artifact: 35cdd7bbb8 user: sebres | |
| 13:25 | Memory leak after thread exit, fixed (alloc cache released by exit), belong to ticket [3493120] M... check-in: c251d61424 user: sebres tags: bug-3493120 | |
|
2012-02-28
| ||
| 17:52 | • Ticket [3493120fff] Thread extension, memory leak after thread exit status s... artifact: 8df95cc96f user: sebres | |
| 17:29 | • Ticket [3493120fff]: 4 changes artifact: 2cfa83ae24 user: sebres | |
|
2012-02-26
| ||
| 02:00 | • Ticket [3493120fff]: 1 change artifact: 66c442d1db user: kennykb | |
|
2012-02-24
| ||
| 20:40 | • Ticket [3493120fff]: 4 changes artifact: cdebcae748 user: sebres | |
| 20:33 | • Ticket [3493120fff]: 1 change artifact: 0e3963c365 user: sebres | |
| 13:33 | • New ticket [3493120fff]. artifact: 056ea50222 user: sebres | |
Thread extension, memory leak after thread exit
Closed / Fixed3493120fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 13 years ago
Descriptionplain2012-02-24 13:33:32
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]
sebres Ticket [3493120fff]: 1 change
[History diff]2012-02-24 20:33:55
sebresplain2012-02-24 20:40:05
tested with thread2.6.5, thread2.6.7 and current thread-2-7-branch
kennykb Ticket [3493120fff]: 1 change
[History diff]2012-02-26 02:00:42
sebresplain2012-02-28 17:29:55
It seems to be a problem with tcl core (threaded memory subsystem etc.) - I made a test without thread.dll, where I create threads with WinAPI, call inits and hereafter finalize - leak remains.
Following singlethreaded script runs without leak also:
time {
try {
set ntp [interp create]
$ntp eval "load thread27"
} finally {
interp delete $ntp
}
} 500
sebresplain2012-02-28 17:52:37
much short variant of leak test :
puts [thread::names]
time {
thread::create {::thread::release}
} 500
puts [thread::names]
sebresplain2014-04-22 13:28:58
Leak found and fixed within [c251d61424] TclpFreeAllocCache (if called with ptr != NULL) has a comment: "Called by us in TclpFinalizeThreadData when a thread exits ..." But until now it was really never called. After fixing, no byte is lost during test.
sebresplain2014-04-22 13:38:00
Reviews and tests are welcome
sebreshtml2014-04-22 17:44:30
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.
void
TclpFreeAllocCache(
void *ptr)
{
if (ptr != NULL) {
/*
* Called by the pthread lib when a thread exits
*/
TclFreeAllocCache(ptr);
pthread_setspecific(key, NULL);
} else if (initialized) {
/*
* Called by us in TclFinalizeThreadAlloc() during the library
* finalization initiated from Tcl_Finalize()
*/
pthread_key_delete(key);
initialized = 0;
}
}
@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.
dgpplain2014-04-22 20:02:23
Same troubles on Mavericks OSX. Just try to run the test suite on a ./configure --disable-shared --enable-threads --enable-symbols build.
dgpplain2014-04-22 20:02:29
Same troubles on Mavericks OSX. Just try to run the test suite on a ./configure --disable-shared --enable-threads --enable-symbols build.
sebresplain2014-04-23 09:19:41
*nix segfault cleared: we should reset a thread key after freeing of alloc cache (in tclUnixThrd.c); Fixed within [1dc6ea5ab2]; @Don: could you please test it on CentOS and OSX.
dgpplain2014-04-23 18:26:14
That solved it. Thanks! Merging now...
Log in (anonymous is fine) to add a comment.