Can't I allocate at descontructor?
Jack
jckj33 at gmail.com
Fri Mar 5 05:31:38 UTC 2021
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 at 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];
}
More information about the Digitalmars-d-learn
mailing list