Overview
| Artifact ID: | 3b6091586af54fbe26bfdad9b83b487a3d7fbdb6 |
|---|---|
| Ticket: | 219597ffffffffffffffffffffffffffffffffff
Memory leak with info exists and arrays |
| User & Date: | msp on 2000-10-28 01:53:46 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
I've noticed some strange memory leaks using info exists on arrays.The leak is also present in 8.3.1. I'm running Tcl on Linux. The below scripts demonstrate the memory leak. # this leaks big time proc main {argv} { expr {srand([clock clicks])} for {set i 0} {$i < 1000} {incr i} { set n1 [expr {int(rand() * 1000)}] set n2 [expr {int(rand() * 1000)}] set x($n1,$n2) 0 } while {1} { set n1 [expr {int(rand() * 1000)}] set n2 [expr {int(rand() * 1000)}] if {[info exists x($n1,$n2)]} { incr x($n1,$n2) } } } # no leak proc main2 {argv} { expr {srand([clock clicks])} for {set i 0} {$i < 1000} {incr i} { set n1 [expr {int(rand() * 1000)}] set n2 [expr {int(rand() * 1000)}] set x($n1,$n2) 0 } while {1} { set n1 [expr {int(rand() * 1000)}] set n2 [expr {int(rand() * 1000)}] catch { incr x($n1,$n2) } } } # no leak proc main3 {argv} { expr {srand([clock clicks])} for {set i 0} {$i < 1000} {incr i} { set n1 [expr {int(rand() * 1000)}] set x($n1) 0 } while {1} { set n1 [expr {int(rand() * 1000)}] if {[info exists x($n1)]} { incr x($n1) } } } - foundin changed to: "obsolete: 8.4a1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "msp"
- subsystem changed to: "07. Variables"
- title changed to: "Memory leak with info exists and arrays"
- type changed to: "Bug"