Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-04-04
16:33 • Ticket [1449383fff] Memory leak in Thread status still Closed with 4 other c... artifact: 93ff8c94ff user: nobody
2006-03-15
04:00 • Ticket [1449383fff]: 2 changes artifact: 9884e6a310 user: vasiljevic
04:00 • Closed ticket [1449383fff]. artifact: 5fc3d08f2d user: vasiljevic
2006-03-14
21:48 • Ticket [1449383fff]: 1 change artifact: b31e231dfe user: dgp
15:58 • Ticket [1449383fff]: 1 change artifact: 23c6b72121 user: dkf
13:57 • Ticket [1449383fff]: 4 changes artifact: 084dc873f5 user: dharan
13:57 • Add attachment SampleTestuite2.itcl to ticket [1449383fffffffff|1449383... artifact: f4ccf53093 user: dharan
06:57 • New ticket [1449383fff] Memory leak in Thread. artifact: cfc404d5d3 user: dharan

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: