D 2006-11-26T15:21:00 J assignee vasiljevic J cmimetype text/plain J comment I\sam\sdeveloping\sproject\susing\sTcl\s+\sThread\s(BitTorrent\stracker).\sAt\sfirst\sI\stried\sto\suse\smodel\swhere\smain\sthread\safter\saccepting\snew\sconnection\s(using\s\nsocket\s-server)\stransfers\sconnection\ssocket\sto\sfree\sthread\susing\sthread::transfer.\sBut\stesting\sof\sthis\smodel\sreveals\sslow\smemory\sleak\s(about\s1Mb/5min\swith\srequests\srate\sabout\s100\sreq/sec).\sUsing\sTcl\smemory\sdebugging\s(Tcl\sand\sThread\sbuilt\swith\s--enable-symbols=mem)\sand\smemory\scommand\sI\sfound\sthat\smemory\sleaks\safter\seach\sthread::transfer\scall.\sThis\sobserves\son\slatest\sTcl/Threads\sversions\sas\swell\s(tcl8.4.14\sand\sthread2.6.5)\scompiled\son\sSolaris\s9/i386\susing\sGCC\s3.3.2.\n\nIs\sthis\sa\sknown\sissue\s?\sIs\sthread::transfer\srequires\ssome\sextra\sdealing\swith\stransferred\sfiledescriptors\sbefore\sor\safter\stransfer\s?\n\nThis\sis\sa\ssmall\stest:\n\n#!/usr/local/bin/tclsh\n\npackage\srequire\sThread\n\nproc\stransfer\s{channel}\s{\n\s\s\s\sglobal\stid\n\n\s\s\s\sputs\s[memory\sinfo]\n\s\s\s\sthread::transfer\s$tid\s$channel\n\s\s\s\sthread::send\s-async\s$tid\s"close\s$channel"\n}\n\nproc\saccept\s{channel\sclient_addr\sclient_port}\s{\n\s\s\s\safter\sidle\s[list\stransfer\s$channel]\n}\n\nset\stid\s[thread::create\s-joinable\sthread::wait]\n\nsocket\s-server\saccept\s9999\n\nthread::wait\n\nField\s"current\sbytes\sallocated"\sincreased\sby\s32\sbytes\safter\seach\sincoming\sconnection.\n J foundin obsolete:\s8.4.14 J is_private 0 J priority 5\sMedium J resolution None J status Open J submitter nobody J subsystem 80.\sThread\sPackage J title Memory\sleak\swith\sthread::transfer J type Bug K 1603234fffffffffffffffffffffffffffffffff U nobody Z 5a68410f39793321183625b6a12c28b0