Overview
| Artifact ID: | c8e06da22b42584bde62260148c4aab61ac0eb15 |
|---|---|
| Ticket: | 2949302fffffffffffffffffffffffffffffffff
Memory leakage |
| User & Date: | andreas_kupries on 2010-02-12 01:37:32 |
Changes
- icomment:
Yes. From the investigation ... Confirmed leak for CVS head of Tcl as well, on linux. Ran the attached trial script against a plain tclsh, and a tclsh with -DTCL_TIP280 (*). Only the latter is leaking, see the results below (*) Both compiled with --enable-symbols=all to activate the integrated [memory] command and debugging. Run results, plain shell first, the #280-enabled shell. /home/andreask/workbench/MemoryLeakExpr/install/tcl84p/bin/tclsh8.4 8.4.19 0: current bytes allocated 76836 1: current bytes allocated 76912 2: current bytes allocated 76912 3: current bytes allocated 76912 4: current bytes allocated 76912 5: current bytes allocated 76912 6: current bytes allocated 76912 7: current bytes allocated 76912 8: current bytes allocated 76912 9: current bytes allocated 76912 /home/andreask/workbench/MemoryLeakExpr/install/tcl84/bin/tclsh8.4 8.4.19 0: current bytes allocated 80966 1: current bytes allocated 313042 2: current bytes allocated 545042 3: current bytes allocated 777042 4: current bytes allocated 1009042 5: current bytes allocated 1241042 6: current bytes allocated 1473042 7: current bytes allocated 1705042 8: current bytes allocated 1937042 9: current bytes allocated 2169042 Now focusing on the #280 code ... ... Later ... I seem to have identified the leak. extCmdMapPtr in the CompileEnv structure and the adjunct structures it points to. * Allocated in TclInitCompileEnv (tclCompile.c:827). * Handed over to the interp->lineBCPtr HashTable in TclInitByteCodeObj (tclCompile.c:772), called by TclSetByteCodeFromAny (tclCompile.c:447). Because of this change of ownership it is not freed as part of TclFreeCompileEnv(), but when the bytecode structure is released, i.e. TclCleanupByteCode (tclCompile.c:711-743). * This hand-over is however conditional on the compilation result being TCL_OK, and that is not the case here. The structure is therefore never handed over to a bytecode structure, and not released at that point either. LEAK. Tcl 8.5+ do not have this leak because for them bytecode compilation cannot fail. I.e. is always ok, and thus the handover is always done. This is because in 8.5+ any type of compilation problem, i.e. like bad syntax in an expression is converted into a __runtime__ error (invokation of [error] command), instead of failing the compilation itself.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"