Skip to content
Tcl Source Code History Of Ticket 604609ffffffffff
Login

History Of Ticket 604609ffffffffff

Artifacts Associated With Ticket 604609ffffffffff

  1. Ticket change [46e0b11cbe] (rid 99594) by msofer on 2002-09-04 16:42:01:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The following scriptlet leaks two structs: a
      TraceCommandInfo and a Command
      
      # distilled from test trace-20.9 
      #
      # No leak if the trace really renames and does
      # not delete
      
      proc foo x {set x}
      trace add command foo rename {rename foo "";#}
      rename foo bar
      
      Valgrind's complaint:
      
      40 bytes in 1 blocks are definitely lost in loss record
      3 of 7
       at 0x400467C4: malloc (vg_clientfuncs.c:100)
       by 0x80F9571: TclpAlloc (./../generic/tclAlloc.c:679)
       by 0x806B501: Tcl_Alloc (./../generic/tclCkalloc.c:1002)
       by 0x807A50B: TclTraceCommandObjCmd
      (./../generic/tclCmdMZ.c:3385)
       by 0x80798D6: Tcl_TraceObjCmd
      (./../generic/tclCmdMZ.c:2932)
       by 0x8066091: TclEvalObjvInternal
      (./../generic/tclBasic.c:3033)
      
      56 bytes in 1 blocks are definitely lost in loss record
      4 of 7
       at 0x400467C4: malloc (vg_clientfuncs.c:100)
       by 0x80F9571: TclpAlloc (./../generic/tclAlloc.c:679)
       by 0x806B501: Tcl_Alloc (./../generic/tclCkalloc.c:1002)
       by 0x8064813: Tcl_CreateCommand
      (./../generic/tclBasic.c:1512)
       by 0x80CC92E: Tcl_ProcObjCmd (./../generic/tclProc.c:136)
       by 0x8066091: TclEvalObjvInternal
      (./../generic/tclBasic.c:3033)
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "8"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "msofer"
    9. subsystem initialized to: "45. Parsing and Eval"
    10. title initialized to: "leak in command rename traces"
    11. type initialized to: "Bug"
  2. Ticket change [059db61135] (rid 89096) by hemanglavana on 2002-09-05 23:20:29:

    1. icomment:
      Logged In: YES 
      user_id=81875
      
      The following patch should take care of the first complaint:
      
      Index: tclBasic.c
      ===================================================================
      RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
      retrieving revision 1.69
      diff -r1.69 tclBasic.c
      2526,2527c2526,2532
      <        * rename traces; while a delete trace is active we
      will not
      <        * process any more delete traces 
      ---
      >        * rename traces; while if a delete trace is active
      we will never
      >        * reach here -- because Tcl_DeleteCommandFromToken
      checks for the
      >        * condition (cmdPtr->flags & CMD_IS_DELETED) and
      returns immediately
      >          * when a command deletion is in progress. For all
      other traces,
      >          * delete traces will not be invoked but a call to
      TraceCommandProc
      >          * will ensure that tracePtr->clientData is freed
      whenever the
      >          * command is "oldName" deleted.
      2531,2533d2535
      <       }
      <       if (cmdPtr->flags & TCL_TRACE_DELETE) {
      <           flags &= ~TCL_TRACE_DELETE;
      
      Let me know if the 2nd complaint persists.
      
      Hemang.
      
      
    2. login: "hemanglavana"
    3. mimetype: "text/plain"
    4. username: "hemanglavana"
  3. Ticket change [dbb44572df] (rid 108005) by msofer on 2002-09-06 01:19:19:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      First leak plugged by the patch; second still there ...
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  4. Ticket change [1cb693254d] (rid 90655) by hemanglavana on 2002-09-06 04:15:04:

    1. icomment:
      Logged In: YES 
      user_id=81875
      
      Okay, here's a combined patch to fix both the memory leaks. 
      
      Hemang.
      
      Index: tclBasic.c
      =============================================
      ======================
      RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
      retrieving revision 1.69
      diff -r1.69 tclBasic.c
      2003a2004,2010
      >     /*
      >      * Script for rename traces can delete the 
      command "oldName".
      >      * Therefore increment the reference count for cmdPtr so 
      that
      >      * it's Command structure is freed only towards the end 
      of this
      >      * function by calling TclCleanupCommand.
      >      */
      >     cmdPtr->refCount++;
      2025a2033,2038
      >     /*
      >      * Now free the Command structure, if the "oldName" 
      command has
      >      * been deleted by invocation of rename traces.
      >      */
      >     TclCleanupCommand(cmdPtr);
      > 
      2525,2527c2538,2545
      <        * While a rename trace is active, we will not process 
      any more
      <        * rename traces; while a delete trace is active we will 
      not
      <        * process any more delete traces 
      ---
      >          * While a rename trace is active, we will not process 
      any more
      >          * rename traces; while if a delete trace is active we 
      will never
      >          * reach here -- because 
      Tcl_DeleteCommandFromToken checks for the
      >          * condition (cmdPtr->flags & CMD_IS_DELETED) 
      and returns immediately
      >          * when a command deletion is in progress. For all 
      other traces,
      >          * delete traces will not be invoked but a call to 
      TraceCommandProc
      >          * will ensure that tracePtr->clientData is freed 
      whenever the
      >          * command "oldName" is deleted.
      2531,2533d2548
      <       }
      <       if (cmdPtr->flags & TCL_TRACE_DELETE) {
      <           flags &= ~TCL_TRACE_DELETE;
      
      
      
    2. login: "hemanglavana"
    3. mimetype: "text/plain"
    4. username: "hemanglavana"
  5. Ticket change [f3649b3770] (rid 129703) by dgp on 2002-09-06 07:12:17:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2002-09-06T00:12:17"
    3. closer changed to: "dgp"
    4. foundin changed to: "obsolete: 8.4.0"
    5. icomment:
      Logged In: YES 
      user_id=80530
      
      Test script in report leaks before patch.
      Does not leak after patch.
      Test suite still passes after patch.
      Committing.
      Adding script in report to test suite, so
      Purify testing in the future will catch
      any recurrence of this problem.
      
      Thanks, Hemang!
      
      
    6. login: "dgp"
    7. mimetype: "text/plain"
    8. resolution changed to: "Fixed"
    9. status changed to: "Closed"
    10. username: "dgp"