Artifacts Associated With Ticket 2949302fffffffff
Ticket change [92110ee759] (rid 120720) by tombert on 2010-02-10 20:31:18:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Run the code and observe memory: for {set index 0} {$index < 2000} {incr index} {catch {expr a}} Tested on XP and openSuse. thx for cross-reference: http://bugs.activestate.com/show_bug.cgi?id=86122 - foundin initialized to: "obsolete: 8.4.19"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "tombert"
- subsystem initialized to: "42. Memory Preservation"
- title initialized to: "Memory leakage"
- type initialized to: "Bug"
Ticket change [53e5a23798] (rid 93838) by dgp on 2010-02-11 11:16:44:
- closedate changed to: "2010-02-11T04:16:44"
- closer changed to: "dgp"
- icomment:
Using this script, I see no leak on the tip of the core-8-4-branch: proc getbytes {} { set lines [split [memory info] "\n"] lindex $lines 3 3 } set end [getbytes] for {set i 0} {$i < 5} {incr i} { catch {expr a} set tmp $end set end [getbytes] } puts "Leaked [expr {$end - $tmp}] bytes!" Since this does not show any leak, what does? - login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- username: "dgp"
Ticket change [c52ee72d83] (rid 111955) by dkf on 2010-02-11 16:23:38:
- icomment:
I reran the same script interactively (except for 2 million iterations) while watching the process in another window. Even a leak of a single byte would have shown, but the memory assigned to the process stuck fast to well below 1MB. When I do something that *does* allocate memory (e.g. building a list) it is quite clear in 'top'...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [3ee66c1232] (rid 121351) by tombert on 2010-02-11 16:33:39:
- icomment:
I do not have the memory command installed, I'am watching with windows task manager: every time I call this script the memory goes: 10236k, 10556k, 10860k, 1168k, ... I'am using the ActiveState distribution 8.4.19.2 and running the script in the tkcon. Then I've tried the same thing with the tclsh (again from ActiveState), the memory goes: 4496k, 4800k, 5108k, .... Did you use task manager as well or only this built-in memory tool?
- login: "tombert"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "tombert"
- icomment:
Ticket change [e3d746587f] (rid 87866) by tombert on 2010-02-11 16:44:22:
- icomment:
Figured it out: I tested it on 8.4.15 on an openSuse distribution (no ActiveState) and the leakage does not happen. When I'am using the ActiveState distribution (on the same machine) it leaks. So ... probably I post again in the ActiveState bugs from where I initially come from ... http://bugs.activestate.com/show_bug.cgi?id=86122 thx for help!
- login: "tombert"
- mimetype: "text/plain"
- username: "tombert"
- icomment:
Ticket change [95ccfd7c4f] (rid 106217) by hobbs on 2010-02-12 01:01:55:
- assignee changed to: "andreas_kupries"
- closedate changed to: "2010-02-11T18:01:55"
- closer changed to: "hobbs"
- icomment:
allow_comments - 1 It appears this has to do with the TIP#280 backport to 8.4 used by ActiveTcl.
- login: "hobbs"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "hobbs"
Ticket change [c8e06da22b] (rid 122182) by andreas_kupries on 2010-02-12 01:37:32:
- 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"
- icomment:
Ticket change [699c5092f0] (rid 103280) by andreas_kupries on 2010-02-12 01:37:33:
- icomment:
allow_comments - 0
- login: "andreas_kupries"
- mimetype: "text/plain"
- resolution changed to: "None"
- status changed to: "Open"
- username: "andreas_kupries"
- icomment:
Ticket change [95bbedb208] (rid 106205) by andreas_kupries on 2010-02-12 02:52:33:
- closedate changed to: "2010-02-11T19:52:33"
- closer changed to: "andreas_kupries"
- icomment:
allow_comments - 1 Fixes committed to cvs 8.4 branch head.
- login: "andreas_kupries"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "andreas_kupries"