Hi!
I have found (yet still not fixed) a leak in the
current code.
It is not trivial to expose it, but it is there.
How to reproduce?
Build a Tcl lib with threads exabled, but before
compilation, edirt the Makefile and replace
-DUSE_THREAD_ALLOC with -DPURIFY=1
Now before running the server do:
LD_PRELOAD=your_modified_tcl_lib.so
When the server starts, log into control port and do:
time {ns_thread join [ns_thread create "set a 1"]} 10000
and watch "top" utility how the process virtual and resident
sizes grow and grow and grow...
Now, stop the server, edit bin/init.tcl file and instead of
foreach f [file channels] {
if {![string match std* $f]} {
close $f
}
}
write
if {0} {
foreach f [file channels] {
if {![string match std* $f]} {
close $f
}
}
}
Start the server again and repeat the
time {ns_thread join [ns_thread create "set a 1"]} 10000
The virtual and resident process sizes remain constant!
It is important to recompile Tcl lib with -DPURIFY as this will
disable the zippy allocator and fall-back to plain system
malloc/free. This way the effect of the leak can be tracked by
looking at the top output.
I still do not understand why is this so. If somebody needs a
nice puzzle-solving over the christmas, he's welcome!
Cheers
Zoran