The following code returns a memory error. I did notice it did happens whenever I did a memory allocation. Is this not possible in the descontrutor? if so, why?

core.exception.InvalidMemoryOperationError@src\core\exception.d(647): Invalid 
memory operation

import std.stdio;

int main()
{
        auto a = new A;
        return 0;
}

class A
{
        this() { }
        
        ~this()
        {
                f();
        }
}

void f()
{
        auto str = new string[100];
}

Reply via email to