<i>Dumping to File is Leaking Memory?</i> status still Closed with 4 other changes
by
.
D 2008-03-14T03:00:09
J icomment Logged\sIn:\sYES\s\nuser_id=75003\nOriginator:\sNO\n\nMy\sunderstanding\sof\syour\scode\sis\sthis:\n\ncreate_globals\s-\screates\s0-1499\svariables,\seach\scontains\sa\slist\sbetween\s0-2499\selements,\seach\selement\sa\sstring\sof\s0-14\scharacters.\nmodify_globals\s-\syou\scopy\sall\svariables\saround\swithout\schanging\sthem.\susing\sthe\sloop\syou\sconsume\sone\sadditional\slist\sobject\sand\sarray\sof\spointers\sto\selements\sinstead\sof\sjust\ssharing\sthe\slist.\sthis\sblows\sthe\smemory\sup\ssome,\sbut\sis\sstable\sas\sthe\sold\slist\sobject\sand\spointer\sarray\sshould\sbe\sreturned\sto\sthe\sallocator\sin\seach\scycle.\n\ndbsave\s-\shere\syou\screate\sthe\sstring-rep\sof\syour\slists\sand\ssave\sthem\sto\sa\sfile.\smemory\susage\sgrows\sagain,\sallocating\sthe\sspace\sneeded\sfor\sthe\sstring-reps.\sthe\smemory\sused\sby\sthe\sstring\sreps\sis\sreleased\sback\sto\sthe\sallocator\sin\sthe\snext\sround\swhen\sthe\sold\slist\srep\sis\sdestroyed\sby\smodify_globals.\sthe\schannel\ssystem\smay\suse\ssome\smemory\sfor\sthe\sbuffering\sbefore\swriting\sto\sthe\sOS.\sthese\sare\snever\sreleased,\sbut\sare\sre-used,\sso\smemory\susage\swill\snot\sgrow\sunbounded\sthere\seither.\n\nthe\sramp\sup\sof\smemory\susage\shappens\sbecause\syou\sstart\swith\spure\slists\s(i.e.\swithout\sstring\srep),\sthen\syou\sadd\smemory\sfor\sthe\ssecond\slist,\sthen\sthe\smemory\sfor\sthe\sstring\srep\sof\sthat\slist,\sand\sthen\sthe\scycle\sbegins\swhere\sa\ssecond\sstring\srep\sis\smade\sand\smemory\sfor\sold\slists\sand\sstring\sreps\sreleased,\scausing\sthe\spulsation\sbetween\sthe\stwo\slevels.\sin\s8.4\syou\swould\ssee\sno\spulsation\sas\sthe\smemory\sis\sreleased\sto\sTcl,\sbut\snot\sthe\ssystem\sallocator.\sthere\sthe\smax\smemory\susage\sis\ssimply\sa\sflat\sline.\n\nin\syour\sactual\sserver,do\syou\shave\sit\sgrowing\swith\severy\sdbsave\s?\sif\syes\sI\swould\sassume\sthat\syour\sare\ssomewhere\sholding\son\sto\sthe\sold\slists\sand\sthus\stheir\smemory\sis\snot\sreleased,\si.e.\sI\sassume\sthat\stheir\sref\scount\snever\sgoes\sto\szero.\n\nthis\swould\shave\snothing\sto\sdo\swith\sthe\sfile\ssystem,\sor\ssockets,\sor\schannels\sin\sgeneral.\n\nthe\stest\sscript\sbehaves\sthroughly\snormal.\n\n
J login andreas_kupries
J mimetype text/plain
J username andreas_kupries
K 1913398fffffffffffffffffffffffffffffffff
U andreas_kupries
Z bd02d603be3b5a2e4e7ab65d35b4bd0b