Tcl Source Code

View Ticket
Login
Ticket UUID: 3357771
Title: --enable-symbols=all mem leaks
Type: Bug Created on: 2011-07-07 16:03:30
Submitter: dgp Assigned to: dgp
Subsystem: 47. Bytecode Compiler Severity: Minor
Priority: 9 Immediate Last modified: 2013-08-20 10:49:50
Status: Closed Closed by: dkf
Resolution: Fixed Closed on: 2013-08-20 10:49:50
Version: obsolete: 8.6b1.1
Description:
With a --enable-symbols=all build of the Tcl trunk...

==== compile-12.1 testing literal leak on interp delete FAILED
==== Contents of test case:

    set end [getbytes]
    for {set i 0} {$i < 5} {incr i} {
        interp create foo
        foo eval {
            namespace eval bar {}
        }
        interp delete foo
        set tmp $end
        set end [getbytes]
    }
    set leakedBytes [expr {$end - $tmp}]

---- Result was:
344
---- Result should have been (exact matching):
0
==== compile-12.1 FAILED
User Comments:
dgp added on 2011-07-07 23:09:31:
Also:

==== oo-call-1.18 object call introspection - memory leaks FAILED
==== Contents of test case:

    leaktest {
        info object call oo::object destroy
    }

---- Result was:
414
---- Result should have been (exact matching):
0
==== oo-call-1.18 FAILED

==== oo-call-2.13 class call introspection - memory leaks FAILED
==== Contents of test case:

    leaktest {
        info class call oo::class destroy
    }

---- Result was:
414
---- Result should have been (exact matching):
0
==== oo-call-2.13 FAILED



==== oo-call-3.2 current call introspection FAILED
==== Contents of test case:

    oo::class create A {
        superclass root
        method x {} {self call}
    }
    oo::class create B {
        superclass A
        method x {} {self call;next}
    }
    B create y
    oo::objdefine y method x {} {self call;next}
    leaktest {
        y x
    }

---- Result was:
3225
---- Result should have been (exact matching):
0
==== oo-call-3.2 FAILED

dgp added on 2011-07-07 23:38:17:
bisect points blame on fbb4a85f92e91308a079
which was the removal of TclCleanupLiteralTable.

This was ok in 8.5, and got merged to trunk without
testing.

It really ought to be ok on trunk too.  I suspect when
TCLT is in place it's working around/papering over
some other memleak.

msofer added on 2011-07-08 17:45:22:
TclCleanupLiteralTable had the following comment: 

-       /*
- * It is tempting simply to walk each hash bucket once and delete the
- * internal representations of each literal in turn. It's also wrong.
- * The problem is that freeing a literal's internal representation can
- * delete other literals to which it refers, making nextPtr invalid.
- * So each time we free an internal rep, we start its bucket over
- * again.
- */

TclDeleteLiteralTable does not seem to be minding this special scenario. Could this be the bug's cause?

dgp added on 2011-07-13 03:35:58:
The oo leaks are older.

dgp added on 2011-07-13 03:47:56:
Ticket 3365156 opened to track that
separately.

dgp added on 2011-07-15 21:55:26:
This is a reappearance of 467523.

Committing fix to trunk.  If we're happy with it,
we can consider backporting.