.
D 2001-01-24T21:36:26
J assignee nobody
J cmimetype text/plain
J comment I\sam\screating\sa\sinterpreter\sin\sa\sC++\sprogram\susing\sthe\scall\nTcl_CreateInterp\s\safter\sthat\sI\suse\sTcl_SetVar\sto\sdefine\svariable\svalues\sand\sthen\scall\sTcl_EvalFile\sto\sevaluate\sa\sscript\s.\sThe\scode\sthat\sis\srunning\sthe\sinterpreter\sis\srunning\sin\sits\sown\sthread\sand\sI\suse\sTcl_GetVar\sand\sTcl_SetVar\sto\scommunicate\swith\sthe\sinterpreter\sfrom\sanother\sthread.\s\sAll\sworks\sgreat\sbut\swhen\sI\sdelete\sthe\sinterpeter\swith\sTcl_DeleteInterp\sI\sfind\sa\smemory\sleak\sof\sabout\s10\sk\sdue\sto\sTcl_Alloc\s(using\sSolaris\sWorkshop\sLeak\sCheck).\s\sAccording\sto\sMy\slatest\sTCL/TK\sbook\s(Welch)\scalling\sTcl_DeleteInterp\sonly\smarks\sthe\sinterpreter\sas\sdeleteable\sand\sonly\sdeletes\sif\sTcl_Release\sis\scalled\sas\sMany\sTimes\sas\sTcl_Preserve.\s\sI\smodified\sthe\sTcl\sCode\sto\semit\sa\smessage\sto\sstdout\swhen\sTcl_Preserve\sis\scalled.\sAt\sno\stime\sis\sthe\smessage\sseen\sunless\sI\sspecifically\scall\sit\sin\smy\sC++\sprogram.\sI\shave\scalled\sTcl_UnsetVar\son\sall\smy\sglobal\svariable\sprior\sto\sdeletion\sand\sit\shas\sno\seffect.\s\sAll\smy\svariables\sare\sset\swith\sthe\soption\sTCL_GLOBAL_ONLY\sflag.\s\n1\s)\sif\sthe\scall\sTcl_DeleteInterp\smarks\sthe\sinterpreter\sas\sdeletable\sand\sthen\sreturns\show\sis\sthe\sdeletion\scode\sever\sgoing\sto\srun\s?\n2)\sIf\sTcl_DeleteInterp\sdoes\sindeed\stry\sto\sremove\sall\smemory\nbefore\sreturning\sthen\syou\shave\sa\smemory\sleak\sproblem.\n3)\sIf\syou\sdon't\sthink\syou\shave\sa\smemory\sleak\sproblem\sthen\sgiven\sthe\sinformation\sabove\show\sdo\sI\sfree\sthe\svariables\sI\sSet\sand\sGet.\s\sWhat\sconcerns\sme\sis\sthat\sTcl\sreassigns\sthe\smemory\sthat\sa\svariable\spossesses\severy\stime\sit\sis\sset.\sDo\sI\shave\sto\sfree\sthat\smemory\sfirst\sbefore\ssetting\s(i.e\s\nchar\s*\sdata\s=\sTcl_GetVar(interp,"data",TCL_GLOBAL_ONLY);\nTcl_Free(data);\n?
J foundin obsolete:\s8.3
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 95.\scontrib\sports
J title Memory\sLeak\sTCL\s8.3.0\sin\sTclAlloc
J type Bug
K 229969ffffffffffffffffffffffffffffffffff
U nobody
Z e6363ce144234c29aceebe6a1f1e1341