[Issue 3523] Fiber is not garbage collected properly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 15 04:15:11 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=3523



--- Comment #10 from dawg at dawgfoto.de 2012-02-15 04:15:06 PST ---
>Hm... that's tricky.  The fiber implementation needs to hold a reference to the
>fiber on its stack for context switching, and that's the reference that is
>keeping the fiber alive.  I'll play with the stack pointers a bit and see if
>things work if I exclude that reference from the GC scan.

It's simple to fix I think. Don't add the fiber context to the global context
list but GCscan all nested contexts instead. Now you only need to push/pop a
reference to the Fiber object for call/yield.
It's like swapping ownership. When the fiber is halted the Fiber object owns
it's stack, when the fiber is being executed the stack owns the Fiber object.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list