Tcl Source Code

Artifact [b2fa274250]
Login

Artifact b2fa274250f1acdf6d99e00b8f5428ac6be0433c:

Ticket change [b2fa274250] - Ticket [21000b5d40] Problem with Tcl_DeleteInterp() in 8.4.9.1_Activetcl status still Open with 4 other changes by dkf 2014-02-23 18:16:08.
D 2014-02-23T18:16:08.218
J icomment I've\slooked\sthrough\sthe\slog\sand\sI\sdon't\ssee\sanything\sparticularly\sproblematic;\sthere's\ssimply\sa\s<i>lot</i>\sof\sthings\sbeing\sfreed.\sSince\san\sinterpreter\sis\sthe\smajor\scontext\sobject\sin\sTcl,\sit's\snot\ssurprising\sthat\sdeleting\sit\swill\scause\sa\sgreat\smany\sthings\sto\scease\sto\sbe.\sMany\sof\sthese\sthings\sare\sallocated\sduring\sthe\srunning\sof\sscripts\s(e.g.,\scached\sobjects,\scached\sstrings,\scached\scompilations)\sso\swe\swould\snot\sin\sgeneral\sexpect\sthat\sthe\samount\sof\swork\sdone\sin\sthe\stwo\scases\swould\sbe\sthe\ssame.\sIt\slooks\slike\sthere's\sonly\s<i>actually</i>\s6540\scalls\sto\sfree\sin\sthere;\splenty,\sbut\snot\sreally\svery\sexcessive.\r\n<p>\r\nLooking\sthrough\sthe\strace,\ssome\sof\sthe\soperations\sappear\sto\sbe\staking\sa\slong\stime,\sbut\sthat's\sprobably\sjust\sthe\sOS\spreempting\sto\sallow\ssome\sother\sthread\sor\sprocess\sto\sexecute.\s(I'm\sguessing\sthat\smutex\slock\sacquisition\sis\sdone\sin\sa\smacro\sinside\slibc,\sbut\sthat's\snothing\sto\sdo\swith\sTcl.)\sI\sdon't\ssee\sany\sdouble-frees;\swell,\snot\swithout\sa\smalloc\sin-between\s(I\scan't\stell\swhy\swe're\sallocating\sduring\sthe\srelease\sof\sthe\sinterpreter,\sbut\sit\sdoes\sseem\sto\sbe\sa\svery\ssmall\snumber).\sI'm\salso\spuzzled\sas\sto\swhy\sso\smany\sof\sTcl's\sinternal\scalls\sare\snot\sshowing\sup\sin\sthe\strace;\sI'm\sguessing\sinadequacy\sin\sthe\stooling.\r\n<p>\r\nMaybe\sthe\sOS\sis\spulling\spages\sback\sin\sfrom\sa\sstressed\sdisk\s(“swapping”)?\sThat\scan\shave\smysterious\ssymptoms\sif\syou're\snot\sexpecting\sit.\sIf\sthat's\sthe\scase\s(I\sdon't\sknow\show\sto\sdiagnose\sfor\ssure;\sback\swhen\sI\sused\sSolaris,\sI\sjust\sput\smy\sear\sto\sthe\smachine\sand\slistened\sto\sthe\sdisk\shead\sworking\svery\shard!\sLow\stech,\sI\sknow!)\sthere's\sabsolutely\snothing\swe\scan\sdo\sabout\sit\sfrom\sa\sTcl\sperspective,\sas\sall\sthat\ssoftware\scan\sever\sdo\sis\sassume\sthat\sit\sis\sadequately\sprovisioned.\sTuning\show\smuch\sphysical\smemory\sto\sallow\sa\ssystem\sto\suse\sfor\sa\sparticular\sset\sof\stasks\sis\sa\sbit\sof\sa\sblack\sart,\sbut\sover-allocating\sis\stypically\scheaper\sthan\sthe\sdeveloper\seffort\sto\screate\sa\sbetter\sestimate.\sThe\samount\sof\sspace\srequired\sappears\sto\sbe\s<i>at\sleast</i>\s4MB\s(on\sthe\sbasis\sof\sthe\saddresses\sin\sthe\slog)\sand\sis\sprobably\smuch\smore\sthan\sthat.\r\n<blockquote\sstyle='background:#f0f0f0'>\r\n<h2>General\sTips</h2>\r\nIn\sgeneral,\swe\sdon't\sadvise\sbuilding\sTcl\swith\s<tt>TCL_MEM_DEBUG</tt>\senabled\sas\sthat's\smuch\sslower.\sTcl\shas\sits\sown\sbuilt-in\slayer\son\stop\sof\sthe\ssystem\smemory\sallocator\sthat\savoids\smost\sof\sthe\slocking\s(making\sthings\s<i>much</i>\sfaster)\sbut\sit\sis\sdisabled\swhen\sdoing\smem-debugging\sas\sit\sconfuses\sthe\sheck\sout\sof\ssome\sthird-party\stools.\sWe\salso\s<i>do\snot\sadvise\sdeallocating\son\sexit</i>\s(known\sby\sus\sas\s“finalization”)\sas\sthe\scheapest\sway\sof\scleaning\sup\sthe\smemory\sheld\sby\sthe\sprocess\sis\sto\sjust\slet\sthe\sOS\sdo\sit\sfor\sus\sby\sthrowing\sthe\sprocess\saway\sdirectly.\sThis\sis\svery\sdifferent\sto\show\smost\sC++\scode\sworks,\sbut\swe've\smeasured\sthis\sand\sknow\sit\sis\sdefinitely\strue.\sWe\shave\sseparate\shooks\sto\shandle\sdeletion\sof\sthings\sthat\sneed\sspecial\streatment\son\sexit\s(e.g.,\sDB\sconnection\shandles)\sbut\sthey're\sreally\srather\srare.\r\n<p>\r\nIn\sshort,\sI\sadvise\strying\sto\savoid\sdeleting\sthe\sinterpreter\sunless\syou\swant\sto\sthrow\saway\sthe\scontext\sand\syet\skeep\sthe\sprocess\sgoing.\r\n</blockquote>\r\nIn\sshort,\sthere's\snothing\sobviously\swrong\s<i>in\sTcl</i>\sas\sfar\sas\sI\scan\ssee.\sThere\sprobably\sis\ssomething\shorribly\swrong\selsewhere.\sMy\scurrent\sguess\sis\sthat\sthere's\stoo\smuch\sinstrumentation\s(yes,\sit\shas\sa\smajor\simpact!),\sinsufficient\shardware\sresources,\sor\sthat\sthe\shardware\sis\sis\sundergoing\ssome\skind\sof\snasty\sslow\sfailure.\sI\sreally\shope\sfor\syour\ssake\sthat\sit\sisn't\sthe\slast\sof\sthose\soptions,\sbut\sI've\shad\sthem\shappen\sto\sme\sin\sthe\spast.
J login dkf
J mimetype text/html
J username dkf
K 21000b5d407f330efaf8e6207fe8d025b0633ebb
U dkf
Z fbc8b864b229d031ea5dc3679d3a2ef1