Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Resolver leaks

Closed / Fixed3105999fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-11-09 15:02:50
TclOO uses a variable resolver, but this leads to leaks in some cases. Notably check out memory leak tests oo-0.8, oo-20.16 and oo-27.12 (requires a memdebug build); the first two fail, the last passes. (This was first reported to me by Jos Decoster, who was hunting it with difficulty in Wub...)

--- TEST TRACE FOLLOWS ---

bash$ make test-tcl TESTFLAGS="-file oo.test"
Warning: tclStubInit.c may be out of date.
Developers may want to run "make genstubs" to regenerate.
This warning can be safely ignored, do not report as a bug!
Warning: tclOOStubInit.c may be out of date.
Developers may want to run "make genstubs" to regenerate.
This warning can be safely ignored, do not report as a bug!
DYLD_LIBRARY_PATH=`pwd`: TCLLIBPATH="/Users/dkf/Documents/software/tcl8.6-commits/unix/pkgs" TCL_LIBRARY="/Users/dkf/Documents/software/tcl8.6-commits/library" ./tcltest /Users/dkf/Documents/software/tcl8.6-commits/tests/all.tcl -file oo.test
Tests running in interp:  /Users/dkf/Documents/software/tcl8.6-commits/unix/tcltest
Tests located in:  /Users/dkf/Documents/software/tcl8.6-commits/tests
Tests running in:  /Users/dkf/Documents/software/tcl8.6-commits/unix
Temporary files stored in /Users/dkf/Documents/software/tcl8.6-commits/unix
Test files run in separate interpreters
Running tests that match:  *
Skipping test files that match:  l.*.test
Only running test files that match:  oo.test
Tests began at Tue Nov 09 15:01:15 GMT 2010
oo.test


==== oo-0.8 leak in variable management FAILED
==== Contents of test case:

    oo::define foo {
constructor {} {
    variable v 0
}
    }
    leaktest {[foo new] destroy}

---- Result was:
74
---- Result should have been (exact matching):
0
==== oo-0.8 FAILED



==== oo-20.16 variable method: leak per instance FAILED
==== Contents of test case:

    oo::define foo {
constructor {} {
    set [my variable v] 0
}
    }
    leaktest {[foo new] destroy}

---- Result was:
146
---- Result should have been (exact matching):
0
==== oo-20.16 FAILED


Tests ended at Tue Nov 09 15:01:16 GMT 2010
all.tcl:Total179Passed177Skipped0Failed2
Sourced 1 Test Files.
Files with failing tests: oo.test
dkfplain2010-11-09 22:04:06
Note also above that the [variable] in oo-0.8 is the standard [::variable]; the leak is deeper than that but I don't know where! Help!
dkfplain2010-11-09 23:27:39
Damn. Damn, damn, damn, damn, damn.

I was forgetting to deallocate the structure in ProcedureMethodVarResolver. Fixed in HEAD. Needs backport.
dkf Ticket [3105999fff]: 2 changes [History diff]2010-11-09 23:27:40
dkfplain2010-11-09 23:31:06
Correction; not broken in package. Breakage was caused by Miguel trying to combine resolver code and forgetting to manage the structure lifetime. Not my fault!
dkfplain2010-11-09 23:31:26
allow_comments - 1
dkfplain2010-11-09 23:35:13
Backported tests.
Log in (anonymous is fine) to add a comment.