<i>The necessary use of the 'unset' in a recursive call is not </i>.
by
.
D 2000-10-26T00:52:48
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s1557\sRFE\nVersion:\s8.0.4\nSubmitDate:\s'1999-03-19'\nLastModified:\s'2000-04-03'\nSeverity:\sLOW\nStatus:\sClosed\nSubmitter:\spat\nChangedBy:\shobbs\nOS:\sOther\nOSVersion:\sNT4.0,\sIRIX\s6.2,\sIRIX\s6.5,\sMac\sOS8.1\s&\sOS8.5\nMachine:\sNA\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-04-03'\n\n\nName:\nWilliam\sChen\n\nDesiredBehavior:\n\s\s\s\sIt\sappears\sthat\sthe\sgarbage\scollection\sproperties\sof\sTcl+Tk\sdoes\snot\n\s\s\s\sextend\sto\sthe\s"infinitely\sRecursive"\scalls.\s\sPlacing\sthe\srecursive\n\s\s\s\sfunction\scall\sin\san\safter\sscript\sscript\sis\sstill\srecursion.\s\sMemory\shas\n\s\s\s\sto\sbe\sreleased\sby\sunsetting\sunused\slocal\svariables.\s\sUnless\sthis\slocal\n\s\s\s\smemory\sis\sreleased,\sit\swill\snever\sbe\sreleased\swhile\sthe\sWish\sShell\sis\n\s\s\s\srunning.\n\s\s\s\s\n\s\s\s\sI'm\sproviding\ssamples\sof\stwo\smethods\sused\sto\screate\sevent\shandlers.\s\sThe\n\s\s\s\safter\scommand\sallows\sthe\sseparate\spolling\sevent\shandlers\sto\sexecute\sin\n\s\s\s\sdifferent\sthreads.\s\sIt\sis\salso\smore\selegant\sthan\sputting\sthem\sall\sinto\n\s\s\s\sone\sbig\swhile\sloop\ssince\smultiple\sevents\scan\sbe\spolled\sat\sdifferent\n\s\s\s\sintervals.\n\s\s\s\s\n\s\s\s\sUnset\sis\sonly\sbriefly\smentioned\son\syour\sweb\spage.\s\sOusterhout's\n\s\s\s\s_Tcl_and_the_Tk_ToolKit_\sand\sWelch's\n\s\s\s\s_Practical_Programming_in_Tcl_and_Tk_\sbooks\sdedicate\s1\ssmall\sparagraph\n\s\s\s\seach\sto\sunset.\n\s\s\s\s\n\s\s\s\s______________________________\n\s\s\s\sFunction1\s{}\s{\n\s\s\s\s\sglobal\sFunction1ID\n\s\s\s\s\sFucntion2\n\s\s\s\s\sset\sFunction1ID\s[after\s_time_\sFunction1]\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sFunction2\s{}\s{\n\s\s\s\s\s\sglobal\ssaveString\n\s\s\s\s\s\slocal\svar1\svar2\sstring1\n\s\s\s\s\s\sset\svar1\sSomevalue\n\s\s\s\s\s\sset\svar2\sSomevalue\n\s\s\s\s\s\sset\sstring1\sSomeLargevalueReturnedFromFunctionCall\n\s\s\s\s\n\s\s\s\s\s\sset\ssaveString\s$string1\s\s;#\scopy\slocal\svalue\sto\sglobal\n\s\s\s\s\n\s\s\s\s#Local\svariables\smust\sbe\sunset\sto\srelease\smemory\sfor\srecursive\scall\n\s\s\s\s#Normally\sGarbage\sCollection\swill\stake\scare\sof\sthis.\n\s\s\s\s#We\swere\snot\sdoing\sthis\sbefore\sand\sit\swas\scausing\smemory\sleaks\n\s\s\s\s\s\sunset\svar1\n\s\s\s\s\s\sunset\svar2\n\s\s\s\s\s\sunset\sstring1\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sKillFunciton1\s{}\s{\n\s\s\s\s\s\s\safter\scancel\s$Function1ID\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s_________________________________\n\s\s\s\s\n\s\s\s\sTestFunction\s{}\s{\n\s\s\s\s\s\sglobal\sTestFuntionID\n\s\s\s\s\s\sglobal\ssaveString\n\s\s\s\s\s\slocal\svar1\svar2\ssting1\n\s\s\s\s\s\sset\svar1\sSomeValue\n\s\s\s\s\s\sset\svar2\sSomeValue\n\s\s\s\s\s\sset\sstring1\sSomeLargeValueRetunedFromFunctionCall\n\s\s\s\s\n\s\s\s\s\s\sset\ssaveString\s$string1\s;#\scopy\slocal\svalue\sto\sglobal\n\s\s\s\s\n\s\s\s\s#Local\svariables\smust\sbe\sunset\sto\srelease\smemory\sfor\srecursive\scall\n\s\s\s\s\s\sunset\svar1\n\s\s\s\s\s\sunset\svar2\n\s\s\s\s\s\sunset\sstring1\n\s\s\s\s\n\s\s\s\s#Make\sa\srecursive\scall\sto\sthe\sfunction\safter\sa\sset\stime.\n\s\s\s\s\s\sset\sTestFunctionID\s\safter\s_time_\sTestFunction\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sKillTestFunction\s{}\s{\n\s\s\s\s\s\safter\scancel\s$TestFunctionID\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sAfter\scalling\sKillTestFunction\sor\sKillFunction1,\sTestFuntion\sand\n\s\s\s\sFuntion1\sdoes\snot\sknow\sthat\sthe\srecursive\scall\shas\sbeen\sinterrupted.\n\s\s\s\sThe\smemory\screated\swithing\sthese\sfunctions\sdoes\snot\sget\sreleased\swithout\n\s\s\s\san\sexplicit\scall\sto\sunset\sthem.\n\s\s\s\s\n\n\n\n\n"local"\sisn't\sa\sTcl\score\scommand,\sand\sit\smay\snot\sbe\scoded\scorrectly\nto\srelease\sthe\sobjects.\s\sOtherwise,\sthis\sdoesn't\sseem\slike\sit\sshould\nbe\sa\sproblem\sin\sthe\score\s(Tcl\stests\sPure).\s\n--\s04/03/2000\shobbs
J foundin obsolete:\s8.0.4
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title The\snecessary\suse\sof\sthe\s'unset'\sin\sa\srecursive\scall\sis\snot\s
J type Bug
K 218066ffffffffffffffffffffffffffffffffff
U nobody
Z 9569b6cf55994e4e47cfcd96d9d03aee