Skip to content
Tcl Source Code View Ticket
Login

View Ticket

leak with the new thread allocator

Closed / Fixed587488ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-07-27 18:58:35
Reported on clt by Sven Sass on clt:
http://groups.google.com/groups?dq=&start=25&hl=en&lr=&ie=UTF-8&group=comp.lang.tcl&selm=88d0b923.0207260455.4e4f3da9%40posting.google.com
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&group=comp.lang.tcl&selm=ahrscj%24290%2402%241%40news.t-online.com

The problem is: when compiling with  both 
   -DTCL_THREADS -DUSE_THREAD_ALLOC
the following script (typed at the tclsh prompt) leaks
massively

  for { set i 0 } { $i < 100000 } {incr i} {
      lappend a ""
      unset a
  }

Replacing [lappend] with [append] or [unset a] with
[set a {}] stops the leak; compiling with the previous
allocator stops it too.

I confirmed the problem on linux, with the HEAD as of
2002-04-24 - i.e., just after the commit of the new
allocator and before releasing tcl8.4b1.
msoferplain2002-08-07 21:27:01
Logged In: YES 
user_id=148712

Fixed in HEAD - generic/tclObj.c (Tcl_NewObj) was missing
the special code for USE_THREAD_ALLOC, and was thus
allocating the object in a list that would never be freed.
msoferplain2002-08-09 01:47:30
Logged In: YES 
user_id=148712

Note: no test added, the leak was already exercised by the
testsuite (creating object with lappend), so that purify
should pick it up.
Log in (anonymous is fine) to add a comment.