GC does not delete subclass

Matthias Thurau Matthiasth at gmx.de
Mon Dec 17 13:54:02 PST 2007


BTW:
This is working correctly:

void func() {
    MyClass A  =    new MyClass();
};

int main(char[][] args) {
    
    func();

    std.gc.fullCollect();
    writefln("The Sub Class from 0 does not get deleted yet!");
    MyClass C   =    new MyClass();

    return 0;
};

When i put the "scope" into the func(), then i get the output from above again. The right ouput was in my opinion:
Constructor 0
Sub_Constructor2 0
Sub_Destructor2 0
Destructor 0
The Sub Class from 0 does not get deleted yet!
Constructor 1
Sub_Constructor2 1
Sub_Destructor2 1
Destructor 1



More information about the Digitalmars-d mailing list