Skip to content
Tcl Source Code View Ticket
Login

View Ticket

memleaks in safe-13.2, safe-13.4

Closed / Fixed6a2d339e503018d8965f99dcc894a3a71f29943dCreated 12 years agoUpdated 12 years ago
Descriptionplain2014-07-15 15:59:53
==31159== 213 (48 direct, 165 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 8
==31159==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==31159==    by 0x5D1532: TclpAlloc (tclAlloc.c:699)
==31159==    by 0x43D1AE: Tcl_Alloc (tclCkalloc.c:1059)
==31159==    by 0x548586: TclCreateLiteral (tclLiteral.c:236)
==31159==    by 0x54898F: TclRegisterLiteral (tclLiteral.c:434)
==31159==    by 0x4DA4FA: TclCompileInvocation (tclCompile.c:1838)
==31159==    by 0x4DB701: CompileCommandTokens (tclCompile.c:2083)
==31159==    by 0x4DBB03: TclCompileScript (tclCompile.c:2202)
Referenced by1
dgpplain2014-07-16 15:08:45
After spinning my wheel for far too long
trying to locate the leak, I decided to
bisect, looking for the origins.

The leak in test safe-13.2 begins happening
with checkin

http://core.tcl.tk/tcl/info/4492d3b64521aaeedca4b92712248dc19a5b3c40

Was not expecting that.
dgpplain2014-07-16 15:36:21
Shifting the search onto the dkf-bytecode-8.6
branch, I track down the leak origin to checkin

http://core.tcl.tk/tcl/info/abb9522f549a8304020c2e149fd7f934bfa54478

"Improved general case of [string replace] implementation."

Now to look where the light is good....
dgpplain2014-07-16 15:47:10
Lines 5220-5273 of tclExecute.c in that checkin
lack any decr ref count on the value3Ptr to
account for its removal from the stack.

Checking to see if any other test covers
that code...
dgpplain2014-07-16 15:54:47
Yes, stringObj-6.9.

And as expected valgrind see the leak there too.
dgpplain2014-07-16 15:59:34
fixed on trunk.
Log in (anonymous is fine) to add a comment.