Skip to content
Tcl Source Code Artifact [249adc9572]
Login

Artifact [249adc9572]

Artifact 249adc957292d0dbf0a96b7bd75eab875a0b691d:

Ticket change [249adc9572] - Ticket [2960042fffffffff|2960042fff] <i>high water mark memory not shared for file I/O needs</i> status still Open with 4 other changes by ferrieux on 2010-03-04 04:27:01.
D 2010-03-04T04:27:01
J icomment Still\snot\sreproduced,\sbut\sI\sthink\sI\sknow\swhat's\shappening.\s\n\nNotice\s\sthat\sthere\sare\stwo\sfundamentally\sdifferent\skinds\sof\sallocations\sin\sthe\sTcl\score:\sTcl_Obj's\sand\svanilla\smallocs.\sTcl_Objs\sare\sallocated\sby\sblocks\s(with\slarge\smallocs),\sbut\sthe\sblock\sthemselves\sare\snever\sfree()ed;\sinstead,\sfreed\sTcl_Objs\sare\slinked\sin\sa\sfree\slist\sinside\stheir\shosting\sblocks.\sVanilla\smallocs\sare\sused\sfor\severything\selse,\slike\sstrings\sor\slist\sstorage.\s\n\nNow\sthis\s"high\swater\smark"\shandling\sof\sobjects\sdoesn't\sgenerate\sactual\sleaks\s_within_\sthe\suniverse\sof\sTcl_Objs,\sbut\sit\scompetes\sfor\savailable\smemory\swith\sthe\srest\sof\svanilla\smallocs.\sHence,\sif\sA\sis\sa\svanilla\smalloc\sand\sB\sa\sblock\sof\sTcl_Objs\sand\sA+B\sexceed\stotal\savailable\sheap\sspace,\sthen:\n\s\s(1)\sA\sand\sB\scannot\sbe\ssimultaneously\sallocated\s(obvious)\n\s\s(2)\salloc(A);free(A);alloc(B);free(B)\sworks\n\s\s(3)\salloc(B);free(B);alloc(A);free(A)\sdoesn't,\ssimply\sbecause\sfree(B)\sis\sa\sno-op\sas\sfar\sas\sthe\sheap\sis\sconcerned\n\nSo\shere\sA\sis\slarge_file,\sB\sis\shi_water_mark,\sand\sI'd\spredict\sthat\swith\sproper\ssizes\syou\scan\seven\sobserve\sthe\sfailure\sskipping\sthe\sfirst\scall\sto\slarge_file.\n\nHence,\syour\snew\stitle\sis\saccurate\sin\sdescribing\sthe\ssituation,\sthough\swe\scan\sgeneralize\s"I/O\sneeds"\sto\s"vanilla\smallocs".\s\sHowever,\sit\sis\snot\sreally\sa\sbug;\srather\sit\slays\sin\sthe\sgray\szone\sof\simplementation\strade-offs.\n\nIndeed,\swhile\sit\scould\sbe\simagined\sto\sfree\swhole\sblocks\sof\sfree\sTcl_Objs\sin\scertain\sconditions\s(like\safter\sa\sfailure\sto\smalloc\sor\srealloc),\sin\sthe\sgeneral\scase\sthere\sis\sno\sguarantee\sthat\sa\scompletely\sfree\sblock\sexists\s(a\ssingle\snon-free\sobj\sper\sblock\sspoils\sthe\smethod).\sA\stypical\sscenario\sgenerating\sthis\spattern\sis\swhen\slong-lived\sobjects\sare\screated\sat\sany\stime,\snot\sjust\sat\sthe\sbeginning.\n\nTo\ssummarize,\sI'd\ssay\sthat\sa\sswitch\sfrom\s"high-water-mark"\sto\s"non-monotonous"\smethod\sfor\sTcl_Obj\sblock\sallocation\scould\simprove\s*some*\scases\slike\sthe\sone\syou've\sshown,\sbut\swould\sleave\san\soverwhelming\snumber\sof\ssimilar\scases\sout\sof\sreach.\s\n\nHence\sI'm\stempted\sto\sfreeze\sthis\sas\sWon't\sFix.\nI'd\swelcome\scounter\sarguments,\sor\sdifferent\sevaluations\sof\sthe\sstatistics.\n\n\na\sbig\svanilla\smalloc\s(like\sthe\sbig\sstring\sgrown\sby\sthe\s\sfirst\scall\sto\s[large_file])\scan\sfit\sonce\sin\smemory,\sthen\s(after\sfreeing\sit)\sleave\sspace\sto\san\sirreversible\sclaim\sby\sa\sbig\sblock\sof\sTcl_Objs\n
J login ferrieux
J mimetype text/plain
J username ferrieux
K 2960042fffffffffffffffffffffffffffffffff
U ferrieux
Z 0f4f21b65eedd5d513966e5157173f9f