there is a memory leak when an empty array is created in a p
Closed / Fixed218681ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:04:04
OriginalBugID: 1727 Bug Version: 8.0p2 SubmitDate: '1999-04-05' LastModified: '1999-09-16' Severity: MED Status: Released Submitter: pat ChangedBy: hobbs OS: All OSVersion: NA Machine: NA FixedDate: '1999-09-16' FixedInVersion: 8.2 ClosedDate: '2000-10-25' Name: Mark Falco email: [email protected] Support: None Severity: 3 OperatingSystem: Windows NT Synopsis: there is a memory leak when an empty array is created in a procedure ReproducibleScript: proc abc {} { array set tmp {} } while [expr 1] { abc } #watch the memory usage, it skyrockets ObservedBehavior: in normal application this is just a slow memory leak over time DesiredBehavior: no memory leak Patch: here is a tcl script which I'm using to fix the behavior. rename array array_tcl proc array {args} { if {[llength $args] == 3} { if {[lindex $args 0] == {set}} { if {[string trim [lindex $args 2]] == {}} { #avoid a memory leak in Tcl 8.0, when creating empty arrays upvar 1 [lindex $args 1] name if ![info exists name] { set name() {} unset name() } return } } } uplevel 1 array_tcl $args } 8.2 shows no noticable signs of mem leak in this proc. -- 09/16/1999 hobbs
welch Closed ticket [218681ffff].
[History diff]2000-10-26 08:27:10
dgp Ticket [218681ffff]: 1 change
[History diff]2001-04-16 20:28:08
dgp Ticket [218681ffff]: 2 changes
[History diff]2001-04-16 20:28:09
Log in (anonymous is fine) to add a comment.