Artifacts Associated With Ticket 219038
Ticket change [c8e1030c1a] (rid 122183) by nobody on 2000-10-26 01:09:47:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- 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 - foundin initialized to: "obsolete: 8.3b2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "10. Objects"
- title initialized to: "memory leak in lsort command"
- type initialized to: "Bug"
Ticket change [07798d87d3] (rid 89406) by welch on 2000-10-26 08:34:05:
- closedate changed to: "2000-10-26T01:34:05"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"