Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Memory leak in Thread

Closed / Wont Fix1449383fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2006-03-14 06:57:47
Hi,
       I have found a memory leak problem while using 
the TCL thread package. The Tcl version is 8.4.13 and 
Thread version is 2.6.2. I have also attached a sample 
script to support my findings. The sample script 
creates & releases 5 threads for 14 times . For each 
time , the memory of the tclsh process increases by 
700 kb(avg). I have traced the memory through Windows 
Task Manager. 

please forgive me if I had done anything wrong.

OS version : windows 2000

Thanks in Advance.

Gangadharan.
dharanplain2006-03-14 13:57:47
File Added - 170830: SampleTestuite2.itcl
dkf Ticket [1449383fff]: 1 change [History diff]2006-03-14 15:58:53
dgp Ticket [1449383fff]: 1 change [History diff]2006-03-14 21:48:01
vasiljevicplain2006-03-15 04:00:34
Logged In: YES 
user_id=95086

This is no leak. It is the fact that you are posting async scripts to a thread
which has already exited. Such are kept in the Tcl event queue and remain
stucked there forever. For such cases I have made the "reserve/release" 
wrappers. So you basically reserve the thread when you need it and then 
release it when not (the last releaser garbage-collects the thread). This way
you are sure the thread will not be destroyed by somebody else until you
are using it.
vasiljevic Ticket [1449383fff]: 2 changes [History diff]2006-03-15 04:00:35
nobodyplain2006-04-04 16:33:59
Logged In: NO 

In the sample script which had been attached, I had used 
the API ::thread::release to release the Tthraed. 

please let me know if the Sample Script requires any other 
steps to free the Thread.
Log in (anonymous is fine) to add a comment.

Attachments: