the Code:
class MyClass
{
        this(){
                by = new ubyte[10000];
                ++i;
        }
        ~this(){
                GC.free(by.ptr);
                by = null;
                writeln("free");
        }
        void show(){
                writeln(i);
        };
private:
        ubyte[]   by;
        static i = 0;
};

void main()
{
        bool start = true;
        int i = 0;
        while(start){
                auto obj = new MyClass();
                obj.show();
                Thread.sleep(5.msecs);
                //obj.destroy;
                //GC.free(cast(void *)obj);
                ++i;
                if (i > 20000)
                        break;
        }
}

the code will be :
341
core.exception.InvalidMemoryOperationError@src/core/exception.d(679): Invalid 
memory operation
----------------
core.exception.InvalidMemoryOperationError@src/core/exception.d(679): Invalid 
memory operation
----------------

.why is it?
if < obj.destroy; > is exec. the code will not errno.

Reply via email to