From: Tom Rauchenwald Date: 2006-07-06T07:31:27+09:00 Subject: Re: thread mystery ara.t.howard@noaa.gov writes: > any idea why this script slows downs drastically as it runs and seems to leak > memory? First, I'm not a Ruby expert or something, but.. [Code skipped] > switch = Switch.new Here you create the switch. > toggle = SwitchToggle.new switch Here, toggle is created and registered as listener (in the constructor) > switch.on! So now you switch it on. Toggle gets notified, and creates a thread that switches it off. But when that Thread switches it off, toggle gets notified, and starts a thread that switches it on again.. Basically it's an infinite loop, and i suspect it's leaking because GC doesn't kick in.