diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | generic/tclObj.c | 3 | ||||
-rwxr-xr-x | generic/tclStrToD.c | 4 |
3 files changed, 21 insertions, 4 deletions
@@ -1,3 +1,21 @@ +2005-09-23 Don Porter <dgp@users.sourceforge.net> + + [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. + 2005-09-20 Don Porter <dgp@users.sourceforge.net> [kennykb-numerics-branch] diff --git a/generic/tclObj.c b/generic/tclObj.c index 722483a..e0ba40b 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.72.2.36 2005/09/20 14:11:52 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.72.2.37 2005/09/23 04:03:43 dgp Exp $ */ #include "tclInt.h" @@ -2914,6 +2914,7 @@ Tcl_SetBignumObj( TclInvalidateStringRep(objPtr); TclFreeIntRep(objPtr); TclSetBignumIntRep(objPtr, bignumValue); + mp_clear(bignumValue); } void diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index c3b37ef..32b4b7b 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.37 2005/09/16 19:29:02 dgp Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.38 2005/09/23 04:03:43 dgp Exp $ * *---------------------------------------------------------------------- */ @@ -1021,7 +1021,6 @@ TclParseNumber( Tcl_Interp* interp, mp_neg(&octalSignificandBig, &octalSignificandBig); } TclSetBignumIntRep(objPtr, &octalSignificandBig); - octalSignificandOverflow = 0; } break; @@ -1075,7 +1074,6 @@ TclParseNumber( Tcl_Interp* interp, mp_neg(&significandBig, &significandBig); } TclSetBignumIntRep(objPtr, &significandBig); - significandOverflow = 0; } break; |