Skip to content
Tcl Source Code History Of Ticket 983660ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 983660ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 983660ffffffffffffffffffffffffffffffffff

  1. Ticket change [5a2cd8306e] (rid 118096) by pspjuth on 2004-07-01 20:31:40:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      If I repeat this:
        interp create testinterp
        catch {testinterp eval {lisx}}
        interp delete testinterp
      
      memory increases with each iteration.
      According to [memory info] 25 packets,
      709 bytes, is lost each iteration.
      
      If I replace "lisx" with "list" so no
      error occurs, nothing leaks.
      
      testinterp eval {catch lisx}
      
      leaks as well
      
      This is run with current CVS HEAD
      on a WinXP machine.
      
      
    4. foundin initialized to: "obsolete: 8.5a2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "pspjuth"
    9. subsystem initialized to: "None"
    10. title initialized to: "Mem leak when getting error"
    11. type initialized to: "Bug"
  2. Ticket change [7b78f80c6e] (rid 90519) by hobbs on 2004-07-02 04:25:37:

    1. assignee changed to: "msofer"
  3. Ticket change [a852cbe4ae] (rid 98960) by msofer on 2004-07-02 05:06:18:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Oh my, leak confirmed in current HEAD under linux, no
      MEM_DEBUG (*). It is not present in 8.4.5.
      
      (*) method: infinite loop 
       while 1 {
           interp create testinterp
           catch {testinterp eval {lisx}}
           interp delete testinterp
           after 100
       }
      watched in top.
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. priority changed to: "9 Immediate"
    5. username: "msofer"
  4. Ticket change [5eef97156d] (rid 115723) by dgp on 2004-07-02 20:56:30:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      Change "lisx" to "error foo" and
      the leak goes away.  Thus, I suspect
      the [unknown]/auto-loader instead
      of [return]/$::errorInfo.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [cb68d6c9a0] (rid 95510) by dgp on 2004-07-02 20:58:57:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      Change back to "lisx"
      and define [proc unknown args {}]
      in testinterp and the leak also
      goes away.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [f67f0ff2de] (rid 130312) by dgp on 2004-07-02 21:13:37:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      Define
      [proc unknown args {return -code error foo}]
      and the leak returns.
      
      suspect something in the code that
      calls [unknown] is not cleaning up
      everything when [unknown] raises an error (?)
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [c531284b86] (rid 111956) by dgp on 2004-07-03 02:05:12:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      Somehow the INST_RETURN
      command is involved.  Still
      investiagting...
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [242f414aca] (rid 131070) by dgp on 2004-07-03 02:12:16:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      The [unknown] appears to be
      a sideshow.  This script should
      verify this is simply a leak in
      INST_RETURN execution:
      
      while 1 {
        interp create i
        i eval {proc foo {} {return -code break}
        catch {i eval foo}
        interp delete i
      }
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. subsystem changed to: "47. Bytecode Compiler"
    5. username: "dgp"
  9. Ticket change [3f90f1dc13] (rid 121480) by msofer on 2004-07-04 05:15:56:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      That script (missing a '}') leaks too
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  10. Ticket change [9e55e03eb4] (rid 96456) by msofer on 2004-07-04 06:15:03:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      The leak, according to valgrind:
      
      48 bytes in 2 blocks are definitely lost in loss record 1 of 2
         at 0x3C01F40D: malloc (vg_replace_malloc.c:105)
         by 0x80FF82C: TclpAlloc (tclAlloc.c:677)
         by 0x809B274: Tcl_Alloc (tclCkalloc.c:1001)
         by 0x80715BF: Tcl_DuplicateObj (tclObj.c:862)
         by 0x80A7357: TclMergeReturnOptions (tclCmdMZ.c:968)
         by 0x80B3CD3: TclCompileReturnCmd (tclCompCmds.c:2520)
         by 0x80BB16E: TclCompileScript (tclCompile.c:1072)
         by 0x80BA540: TclSetByteCodeFromAny (tclCompile.c:401)
         by 0x80BA748: SetByteCodeFromAny (tclCompile.c:499)
         by 0x807B46C: TclProcCompileProc (tclProc.c:1216)
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  11. Ticket change [7cb360a7ce] (rid 97126) by msofer on 2004-07-04 07:19:17:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Comments that are probably relevant:
      
      (1) in tclLiteral.c (l 448, TclAddLiteralObj): the literalis
      *not* added to the literal tables, only to the literal array
      
      (2) in tclCompile.c (l 661, TclCleanupByteCode): if the
      interp is marked as deleted, it will already have cleaned up
      all literals so we refrain from doing it again
      
      (3) in tclBasic.c (l 1112, DeleteInterpProc): interp
      deletion cleans up all literals in the literal table
      
      So it looks like the returnOptions added to the literal
      array (but not to the table) at line 2593 in tclCompCmds.c
      (TclCompileReturnCmd) is bypassed by the cleanup process.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  12. Ticket change [52a884df16] (rid 126354) by msofer on 2004-07-04 07:34:11:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Indeed - inserting
        i eval {rename foo {}}
      before deleting i removes the leak.
      Note that this is a more general bug, the returnOpts is just
      a trigger. Every non-shared literal in a proc body will be
      leaked if the proc is not explicitly deleted before the interp. 
      Amazing that this hasn't been detected in usage of
      precompiled proc bodies (proComp)!
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  13. Ticket change [a4a5f794bf] (rid 110239) by msofer on 2004-07-04 09:30:48:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Mmhh .. diagnose not 100% accurate yet
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  14. Ticket change [859da53e57] (rid 131344) by msofer on 2004-07-04 21:41:47:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      The bug is apparently in the freeing of non-shared literal
      objects; note that TclCompileReturnCmd is the only caller of
      TclAddLiteralObj in the core, and that TclHideLiteral is not
      used at all in the core.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  15. Ticket change [c31779944c] (rid 111596) by msofer on 2004-07-05 17:25:20:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Rewinding, back to square 1: the bug does seem to be in the
      handling of the return options, as storing them as a shared
      literal does not plug the leak. This was tested by replacing
      TclAddLiteralObj with TclRegisterNewLiteral.
      
      Somehow, the proc body is not being cleaned up properly on
      interp deletion. This is determined by noticing that either of
        i eval {rename  foo {}}
        i eval {proc foo {} {}}
      before deleting the interp plugs the leak. The leak does not
      appear with other literals.
      
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  16. Ticket change [5d78c4cbef] (rid 115469) by msofer on 2004-07-06 05:48:01:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Oh boy - finally found it. DeleteInterpProc was releasing
      the interp's handle before tearing down the global
      namespace, so that TclCleanupByteCode was being called with
      a NULL interp. This prevented the proper freeing of literals.
      
      The current solution may have an impact on interp deletion
      speed; leaving open so that I remember to look for more a
      more efficient solution.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. priority changed to: "5 Medium"
    5. resolution changed to: "Fixed"
    6. title changed to: "Leak of unshared literals at interp deletion"
    7. username: "msofer"
  17. Ticket change [eff31e1243] (rid 109086) by msofer on 2004-07-08 05:47:14:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      The performance issue is: 
      * before the patch, the interp deletion loops through the
      interp's literal table releasing all literals in the interp
      (in a suboptimal manner, but just one loop and with no hashing)
      * after the patch, every proc in the interp will loop
      through its own literal array releasing the literals - and
      doing a hash lookup for each one. No literals remain for the
      overall interp deletion loop.
      
      A possible solution is to register unshared literals in the
      interp's table with refCount -1 (to signal that they should
      not be shared). Note that this is actually specified in the
      comments (tclInt.h line 921), but not done in the code.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  18. Ticket change [fc8df42df6] (rid 108257) by msofer on 2004-07-09 01:49:31:

    1. closedate changed to: "2004-07-08T18:49:31"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Fix modified: at interp deletion, each bytecodeobject
      releases its literal references but does not update the
      dying literal table; in this way, there are is no hashing
      involved. 
      When TclDeleteLiteralTable is called, the only remaining
      references are those in the table itself.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "msofer"
  19. Ticket change [f0e3664731] (rid 109274) by msofer on 2004-07-15 19:20:29:

    1. priority changed to: "9 Immediate"
    2. resolution changed to: "None"
    3. status changed to: "Open"
  20. Ticket change [59fbf75639] (rid 118063) by msofer on 2004-07-15 19:20:30:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Reopening: the fix is buggy, compile-12.1 is failing on the
      current HEAD (compiled with --disable-shared
      --enable-symbols=all, threaded and uthreaded builds). 
      
      The new logic at interp deletion is bypassing the special
      code for empty bytecodes (see also bug 467523).
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  21. Ticket change [251d826026] (rid 131230) by msofer on 2004-07-16 00:44:54:

    1. closedate changed to: "2004-07-15T17:44:54"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Closing this ticket, bug 467523 that had been rsurrected is
      now solved.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "msofer"