Artifact
16f3c1b515df64a2df65fb07982bf999986b02e3:
Attachment "threadpool_leakdemo84_fast.tcl" to
ticket [3382401fff]
added by
auriocus
2011-07-30 03:54:47.
# version that leaks
package require Thread
set t [tpool::create]
proc leak {} {
# compute 1000 rand() s in parallel
set joblist {}
for {set i 0} {$i<10} {incr i} {
lappend joblist [tpool::post -nowait $::t {expr rand()}]
}
set max 0.0
while {[llength $joblist]!=0} {
foreach job [tpool::wait $::t $joblist joblist] {
set max [tpool::get $::t $job]
}
}
puts -nonewline "."
}
time leak 1000000