Forum: Ruby Continuations and GC

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E4d8c6e0e9e5ca6ab51b4b1937586e6f?d=identicon&s=25 Christoffer Lernö (Guest)
on 2006-02-05 12: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:

http://onestepback.org/articles/invitationtoruby/c...

Altering the end of this demo to do:

first.start
first = nil
second = nil
garbage_collect
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?

Sincerly,

Christoffer
This topic is locked and can not be replied to.