Skip to content
Tcl Source Code History Of Ticket 219038
Login

History Of Ticket 219038

Artifacts Associated With Ticket 219038

  1. Ticket change [c8e1030c1a] (rid 122183) by nobody on 2000-10-26 01:09:47:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 4067 Bug
      Version: 8.3b2
      SubmitDate: '2000-01-24'
      LastModified: '2000-01-25'
      Severity: MED
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Linux
      FixedDate: '2000-01-25'
      FixedInVersion: 8.3
      ClosedDate: '2000-10-25'
      
      
      Name:
      Philip Smolen
      
      Comments:
      I downloaded the latest source release, tcl8.3b2, just to see if the bug was still there.  The bug was introducted in a much ealier version.
      
      Note that TWO new objects are created each time.  Fixing either of them caused the memory leak to grow half as quickly.
      
      ReproducibleScript:
      Tcl script:  time {catch {lsort -command \{ {a b c}}} 100000
      
      To start TCL: type tclsh or tcl from the Unix command propmt, or start Wish from the MS Windows start menu.
      
      ObservedBehavior:
      This is a memory leak.  Each iteration creates two new tcl objects which are never recovered, wasting about 50 bytes per iteration.  (The script above wastes about 5meg each time it is run.)
      
      DesiredBehavior:
      No memory leak.  No appreciable change in memory usage, no matter how often the script is run.  The lsort command should fail.
      
      Patch:
      diff -c tcl8.3b2/generic/tclCmdIL.c.orig tcl8.3b2/generic/tclCmdIL.c.fixed
      *** tcl8.3b2/generic/tclCmdIL.c.orig    Thu Jan 13 14:33:10 2000
      --- tcl8.3b2/generic/tclCmdIL.c.fixed   Mon Jan 24 00:25:08 2000
      ***************
      *** 2601,2609 ****
               */
      
                Tcl_Obj *newCommandPtr = Tcl_DuplicateObj(cmdPtr);
      ! 
      !       if (Tcl_ListObjAppendElement(interp, newCommandPtr, Tcl_NewObj()) 
                      != TCL_OK) {
                  return TCL_ERROR;
              }
              Tcl_ListObjAppendElement(interp, newCommandPtr, Tcl_NewObj());
      --- 2601,2613 ----
               */
      
                Tcl_Obj *newCommandPtr = Tcl_DuplicateObj(cmdPtr);
      !         Tcl_Obj *placeHolder = Tcl_NewObj();
      !       if (Tcl_ListObjAppendElement(interp, newCommandPtr, placeHolder) 
                      != TCL_OK) {
      +           Tcl_IncrRefCount(newCommandPtr);
      +           Tcl_DecrRefCount(newCommandPtr);
      +           Tcl_IncrRefCount(placeHolder);
      +           Tcl_DecrRefCount(placeHolder);
                  return TCL_ERROR;
              }
              Tcl_ListObjAppendElement(interp, newCommandPtr, Tcl_NewObj());
      
      PatchFiles:
      generic/tclCmdIL.c
      
      
      
      Slightly modified patch applied for 8.3.0 (you can incr newCommandPtr
      just after creation). 
      -- 01/25/2000 hobbs
      
    4. foundin initialized to: "obsolete: 8.3b2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "10. Objects"
    10. title initialized to: "memory leak in lsort command"
    11. type initialized to: "Bug"
  2. Ticket change [07798d87d3] (rid 89406) by welch on 2000-10-26 08:34:05:

    1. closedate changed to: "2000-10-26T01:34:05"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"