Skip to content
Tcl Source Code History Of Ticket 2949302
Login

History Of Ticket 2949302

Artifacts Associated With Ticket 2949302

  1. Ticket change [92110ee759] (rid 120720) by tombert on 2010-02-10 20:31:18:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. 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
      
    4. foundin initialized to: "obsolete: 8.4.19"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "tombert"
    10. subsystem initialized to: "42. Memory Preservation"
    11. title initialized to: "Memory leakage"
    12. type initialized to: "Bug"
  2. Ticket change [53e5a23798] (rid 93838) by dgp on 2010-02-11 11:16:44:

    1. closedate changed to: "2010-02-11T04:16:44"
    2. closer changed to: "dgp"
    3. 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?
      
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Pending"
    8. username: "dgp"
  3. Ticket change [c52ee72d83] (rid 111955) by dkf on 2010-02-11 16:23:38:

    1. 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'...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  4. Ticket change [3ee66c1232] (rid 121351) by tombert on 2010-02-11 16:33:39:

    1. 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?
      
      
      
    2. login: "tombert"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "tombert"
  5. Ticket change [e3d746587f] (rid 87866) by tombert on 2010-02-11 16:44:22:

    1. 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!
      
      
    2. login: "tombert"
    3. mimetype: "text/plain"
    4. username: "tombert"
  6. Ticket change [95ccfd7c4f] (rid 106217) by hobbs on 2010-02-12 01:01:55:

    1. assignee changed to: "andreas_kupries"
    2. closedate changed to: "2010-02-11T18:01:55"
    3. closer changed to: "hobbs"
    4. icomment:
      
      
      allow_comments - 1
      
      It appears this has to do with the TIP#280 backport to 8.4 used by ActiveTcl.
      
      
    5. login: "hobbs"
    6. mimetype: "text/plain"
    7. status changed to: "Closed"
    8. username: "hobbs"
  7. Ticket change [c8e06da22b] (rid 122182) by andreas_kupries on 2010-02-12 01:37:32:

    1. 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.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  8. Ticket change [699c5092f0] (rid 103280) by andreas_kupries on 2010-02-12 01:37:33:

    1. icomment:
      
      
      allow_comments - 0
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. resolution changed to: "None"
    5. status changed to: "Open"
    6. username: "andreas_kupries"
  9. Ticket change [95bbedb208] (rid 106205) by andreas_kupries on 2010-02-12 02:52:33:

    1. closedate changed to: "2010-02-11T19:52:33"
    2. closer changed to: "andreas_kupries"
    3. icomment:
      
      
      allow_comments - 1
      
      Fixes committed to cvs 8.4 branch head.
      
      
      
    4. login: "andreas_kupries"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "andreas_kupries"