Manifest of check-in
[961337390c]
- [kennykb-numerics-branch]
* generic/tclStrToD.c: Memory leak. Comment in TclSetBignumIntRep
* generic/tclObj.c: indicates that mp_init() is called on the
bignumValue argument to clear it, while keeping the digits array
transferred to the interp of the Tcl_Obj. The implication is that
callers of TclSetBignumIntRep() (and their callers) need not call
mp_clear(), but can imagine they've transferred ownership of an
mp_int value to Tcl. However, mp_init() doesn't merely re-initialize
the fields of an mp_int to hold the value zero. It also allocates
a fresh dp array of minimum size governed by MP_PREC. Without a
corresponding mp_clear() call somewhere, these dp arrays are leaked.
Added some mp_clear() calls to fix the leak, but better fix strategies
should still be pursued. Perhaps the best approach is to just
invade the mp_int struct and do the necessary surgery ourselves.
by
dgp on
2005-09-23 04:03:43.
B 6e1addf33ec523f44d06a1322464f93b908081f5
C \s\s\s\s\s\s\s\s[kennykb-numerics-branch]\n\n\s\s\s\s\s\s\s\s*\sgeneric/tclStrToD.c:\s\sMemory\sleak.\s\sComment\sin\sTclSetBignumIntRep\n\s\s\s\s\s\s\s\s*\sgeneric/tclObj.c:\s\s\s\s\sindicates\sthat\smp_init()\sis\scalled\son\sthe\n\s\s\s\s\s\s\s\sbignumValue\sargument\sto\sclear\sit,\swhile\skeeping\sthe\sdigits\sarray\n\s\s\s\s\s\s\s\stransferred\sto\sthe\sinterp\sof\sthe\sTcl_Obj.\s\sThe\simplication\sis\sthat\n\s\s\s\s\s\s\s\scallers\sof\sTclSetBignumIntRep()\s(and\stheir\scallers)\sneed\snot\scall\n\s\s\s\s\s\s\s\smp_clear(),\sbut\scan\simagine\sthey've\stransferred\sownership\sof\san\n\s\s\s\s\s\s\s\smp_int\svalue\sto\sTcl.\s\sHowever,\smp_init()\sdoesn't\smerely\sre-initialize\n\s\s\s\s\s\s\s\sthe\sfields\sof\san\smp_int\sto\shold\sthe\svalue\szero.\s\sIt\salso\sallocates\n\s\s\s\s\s\s\s\sa\sfresh\sdp\sarray\sof\sminimum\ssize\sgoverned\sby\sMP_PREC.\s\sWithout\sa\n\s\s\s\s\s\s\s\scorresponding\smp_clear()\scall\ssomewhere,\sthese\sdp\sarrays\sare\sleaked.\n\s\s\s\s\s\s\s\sAdded\ssome\smp_clear()\scalls\sto\sfix\sthe\sleak,\sbut\sbetter\sfix\sstrategies\n\s\s\s\s\s\s\s\sshould\sstill\sbe\spursued.\s\sPerhaps\sthe\sbest\sapproach\sis\sto\sjust\n\s\s\s\s\s\s\s\sinvade\sthe\smp_int\sstruct\sand\sdo\sthe\snecessary\ssurgery\sourselves.\n
D 2005-09-23T04:03:43
F ChangeLog b637c11e61571ff8e8b10976397d15b8e64b3762
F generic/tcl.decls d712c82212d5094e549227c30efa335f61d8f1aa
F generic/tclDecls.h 5d0a55850f3083cdbec5c95c500b915669bb62c9
F generic/tclExecute.c f44e5765d6fc114aeb883b35500df6c5cbe664e6
F generic/tclObj.c e1525f486e110409dfcc97c81616f2703c67bb07
F generic/tclStrToD.c adfa1cdf95000a7b407b733ffd128ae08348349b x
F generic/tclStubInit.c bf5fba807b92e5fc251f122152eb95fbc944edc6
P dd93281cd4676aa92e6c0c590631841bad708835
U dgp
Z 3dd45fc729328a228a75540f96b18f4e