Forum: Ruby Continuations and GC

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Christoffer Lernö (Guest)
on 2006-02-05 13:15
(Received via mailing list)
I have problems getting things GC:ed properly when using
continuations, which is a bit disturbing.

I was looking at a few implementations of coroutines and they seem to
prevent their continuations from being gc:ed.
For example, I looked at this implementation:

Altering the end of this demo to do:

first = nil
second = nil
ObjectSpace.each_object(Continuation) {|x| puts x }

Gave me a list of all the continuations spawned by the two
coroutines. Apparently they had yet to be GC:ed. Another
implementation seemed to be similarly flawed.

Is there a way to make this work or perhaps my understanding of the
GC is flawed?


This topic is locked and can not be replied to.