# 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
