Created
July 15, 2015 22:25
-
-
Save bovine/15c350d044325a93d5cb to your computer and use it in GitHub Desktop.
memory leak in tcl 8.6.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/tclsh | |
proc doit {newkey} { | |
global myarray | |
global clocknow | |
# store a new value into the array | |
set myarray($newkey) $clocknow | |
# clean out the array of older records. | |
foreach {key val} [array get myarray] { | |
if {$val <= $clocknow - 2000} { | |
unset myarray($key) | |
} | |
} | |
} | |
set clocknow 1 | |
for {set i 0} {$i < 10000000} {incr i} { | |
set foo [list "icao" "3C6511" "lat" "48.32737" "lon" "11.71078" "alt" 2750 "callsign" "DLH722" "speed" 183 "vspeed" 1664 "heading" "203" "squawk" "3613" "mtime" "1408040536" "postime" $clocknow] | |
lappend foo "moo1" "cow" "moo1" "cow" "moo1" "cow" "moo1" "cow" "moo1" "cow" | |
lappend foo "moo2" "cow" "moo2" "cow" "moo2" "cow" "moo2" "cow" "moo2" "cow" | |
lappend foo "moo3" "cow" "moo3" "cow" "moo3" "cow" "moo3" "cow" "moo3" "cow" | |
doit $foo | |
incr clocknow | |
if {$i % 500 == 0} { | |
puts "myarray has currently [array size myarray] elements" | |
} | |
} | |
after 1000 {puts "done"} | |
vwait ::die |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to fix this issue?