Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2011-08-07
04:18 • Ticket [3386975fff] leak in double conversion status still Closed with 4 oth... artifact: 2873fe71f2 user: msofer
03:55 • Ticket [3386975fff]: 4 changes artifact: 1abcfab032 user: kennykb
2011-08-06
10:22 • Closed ticket [3386975fff]. artifact: 67a99db6e3 user: kennykb
03:14 • Ticket [3386975fff]: 4 changes artifact: cdfc171e00 user: msofer
2011-08-05
19:42 • New ticket [3386975fff]. artifact: 5d5b2a2902 user: msofer

leak in double conversion

Closed / Fixed3386975fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-08-05 19:42:31
Running the following script in tcltest

  # from "test util-13.32 {just over exact - 17 digits}"
  testdoubledigits -2.6153245263757307e+65 17 e

we get two very similar leaks:
  0:  malloc (vg_replace_malloc.c:236)
  1:  TclpAlloc (tclAlloc.c:705)
  2:  Tcl_Alloc (tclCkalloc.c:1046)
  3:  TclBN_mp_init_size (bn_mp_init_size.c:27)
  4:  TclBN_mp_div (bn_mp_div.c:126)
  5:  StrictBignumConversion (tclStrToD.c:3950)
  6:  TclDoubleDigits (tclStrToD.c:4319)
  7:  TestdoubledigitsObjCmd (tclTest.c:1686)
  8:  TclNREvalObjv (tclBasic.c:4268)
  9:  TEBCresume (tclExecute.c:2789)
-- util.test: ==5444== 48 bytes in 1 blocks are definitely lost in loss record 56 of 72

  0:  malloc (vg_replace_malloc.c:236)
  1:  TclpAlloc (tclAlloc.c:705)
  2:  Tcl_Alloc (tclCkalloc.c:1046)
  3:  TclBN_mp_init_size (bn_mp_init_size.c:27)
  4:  TclBN_mp_div_d (bn_mp_div_d.c:78)
  5:  StrictBignumConversion (tclStrToD.c:3927)
  6:  TclDoubleDigits (tclStrToD.c:4319)
  7:  TestdoubledigitsObjCmd (tclTest.c:1686)
  8:  TclNREvalObjv (tclBasic.c:4268)
  9:  TEBCresume (tclExecute.c:2789)
-- util.test: ==5444== 48 bytes in 1 blocks are definitely lost in loss record 55 of 72
msoferplain2011-08-06 03:14:56
Remark that util.test produces more leaks, extremely similar to these two. The hope is that they are different symptoms of the same bug.
kennykbplain2011-08-06 10:22:19
allow_comments - 1

Egg on my face. Code was leaking two mp_ints for every call to [format %f] or [format %e] with a number in a range that requires bignums for conversion.
kennykbplain2011-08-07 03:55:26
Also added missing finalization for pow5_13.  But I don't know in 8.6 how to make Tcl_Finalize happen.
msoferplain2011-08-07 04:18:59
maybe with patch http://sourceforge.net/support/tracker.php?aid=2919042?
Log in (anonymous is fine) to add a comment.