[Issue 3523] Fiber is not garbage collected properly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 25 06:11:42 PST 2009


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



--- Comment #5 from Witold Baryluk <baryluk at smp.if.uj.edu.pl> 2009-11-25 06:11:41 PST ---
Ok, i now i solved it using kind of hack:

/** This class is written because Fiber's are not correctly garbage collected
*/
class GenWrap(T : AGenerator, T2) {
    private T x; /// T derives from AGenerator which derives from Fiber
public:
    this(T x_) { x = x_; }
    ~this() { delete x; }
    T2 getNext() { return x.getNext(); }
    T o() { return x; } // don't assign return value to any variable which can
live longer than this object
}

This is hack, because it can destroy Fibers which are still referenced
somewhere. So All my direct usages of variables of type T, must be changed to
use GenWrap.o(), to be sure that delete x inside destructor is safe.

-- 
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