Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-03-01
16:56 • Closed ticket [80304238ac]: foreach memleak plus 7 other changes artifact: dbe4b49b04 user: dgp
16:45
[80304238ac] Prevent RC cycle in the localVarName objtype. check-in: 7070d2aa22 user: dgp tags: trunk
2016-02-26
15:44 • Ticket [80304238ac] foreach memleak status still Open with 3 other changes artifact: e5ae66fe9d user: dgp
15:42
[80304238ac] Candidate fix for memleak due to RC cycle. check-in: 29d44ec30c user: dgp tags: bug-80304238ac
04:10 • Ticket [80304238ac] foreach memleak status still Open with 3 other changes artifact: b0d5786ded user: dgp
2016-02-25
20:18 • New ticket [80304238ac]. artifact: 931b6b9106 user: dgp

foreach memleak

Closed / Fixed80304238ac5310b259c79c546d36d790c2a1d39eCreated 11 years agoUpdated 11 years ago
Descriptionplain2016-02-25 20:18:21
This script leaks 48 bytes:

proc doit script {
    eval $script
    set index xx
}
doit {foreach index foo {}}

This leak is what prevents me getting
a clean valgrind of our release candidates
because my system has an install of "nsf 2.0.0"
and it has code like this in its
pkgIndex.tcl file.  This solves the mystery of
why others see clean valgrind runs and I do not.
Referenced by2
dgpplain2016-02-26 04:10:37
It appears that this code is a nasty way to create
a circular reference, where each of 2 Tcl_Obj values
holds a reference to the other as part of its intrep.
This defeats the refCounting system, and the
objects leak.

The cross referencing comes between a "list"
value with a single element which is a "localVarName"
value with a cached localName (twoPtrValue.ptr1)
which is the original list value.
dgpplain2016-02-26 15:44:22
See bug-80304238ac branch for candidate fix.
dgpplain2016-03-01 16:56:18
Fix merged to trunk.

Same demo script does not leak in 8.5.19.

Either no leak there, or no reliabale way to
demo it (yet). Either way, doing nothing on
8.5 branch.
Log in (anonymous is fine) to add a comment.