Continuations and GC

  • Thread starter Christoffer Lernö
  • Start date
C

Christoffer Lernö

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/coroutinedemo.html

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top