Artifacts Associated With Ticket 1603234
Ticket change [1cd76cc2d6] (rid 90681) by nobody on 2006-11-26 15:21:00:
- assignee initialized to: "vasiljevic"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I am developing project using Tcl + Thread (BitTorrent tracker). At first I tried to use model where main thread after accepting new connection (using socket -server) transfers connection socket to free thread using thread::transfer. But testing of this model reveals slow memory leak (about 1Mb/5min with requests rate about 100 req/sec). Using Tcl memory debugging (Tcl and Thread built with --enable-symbols=mem) and memory command I found that memory leaks after each thread::transfer call. This observes on latest Tcl/Threads versions as well (tcl8.4.14 and thread2.6.5) compiled on Solaris 9/i386 using GCC 3.3.2. Is this a known issue ? Is thread::transfer requires some extra dealing with transferred filedescriptors before or after transfer ? This is a small test: #!/usr/local/bin/tclsh package require Thread proc transfer {channel} { global tid puts [memory info] thread::transfer $tid $channel thread::send -async $tid "close $channel" } proc accept {channel client_addr client_port} { after idle [list transfer $channel] } set tid [thread::create -joinable thread::wait] socket -server accept 9999 thread::wait Field "current bytes allocated" increased by 32 bytes after each incoming connection. - foundin initialized to: "obsolete: 8.4.14"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "80. Thread Package"
- title initialized to: "Memory leak with thread::transfer"
- type initialized to: "Bug"
Ticket change [7a7fb1cfb4] (rid 90332) by nobody on 2006-11-26 22:22:16:
- icomment:
Logged In: NO Sorry, I forgot to include a e-mail. My e-mail is [email protected].
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [65273c5d62] (rid 92906) by hobbs on 2006-12-01 05:01:48:
- icomment:
Logged In: YES user_id=72656 Originator: NO I am not able to repro this bug using valgrind 3.2.1 on Linux x64. Perhaps it is because it is being properly freed at exit, just not in the interim use?
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [399d62856f] (rid 112424) by nobody on 2006-12-01 06:33:51:
- icomment:
Logged In: NO So "current bytes allocated" output by [memory info] doesn't increase after each new connection in your tests ?
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [413ee49b1e] (rid 116153) by vasiljevic on 2007-01-20 01:42:02:
- icomment:
Logged In: YES user_id=95086 Originator: NO What you experience might be a problem in Tcl core that badly handles std channels. I'm loking at that at this moment. It appears to leak std channels on every thread creation and exit. I haven't examined your code but will do that later on when I find out what the damn is happening with those channels and why do they leak. This is considered to be a very problematic point in Tcl design (handling of std channels when building thread-enabled Tcl library).
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [b38e6e769e] (rid 124879) by oleg_derevenetz on 2007-06-05 04:02:49:
- icomment:
Logged In: YES user_id=1654299 Originator: NO vasiljevic, if this issue will be resolved some day - it will be good. Are there any solutions or recommendations for this case now ?
- login: "oleg_derevenetz"
- mimetype: "text/plain"
- username: "oleg_derevenetz"
- icomment:
Ticket change [24df9eb491] (rid 131185) by dgp on 2012-04-24 23:01:37:
- assignee changed to: "dgp"
- icomment:
Problem is that ThreadTransfer() doesn't free the resultPtr that it allocs.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "dgp"
Ticket change [ea2c58e71f] (rid 103324) by dgp on 2012-04-24 23:41:00:
- closedate changed to: "2012-04-24T16:41:00"
- closer changed to: "dgp"
- icomment:
allow_comments - 1 Fixed for Thread 2.6.8+.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"