free causes exception
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 27 03:54:43 PST 2016
On Tuesday, 26 January 2016 at 21:21:29 UTC, Igor wrote:
> That shouldn't be the case. I allocate in a static method
> called New once. I then deallocate in the destructor. Basically
> just as one would do in C++.
You can't deallocate in destructor in C++, because an object can
be embedded in another object, so if it's destructor deallocates
itself, it will deallocate the container object before it
finishes its destruction. It's delete operator that deallocates
memory in C++.
More information about the Digitalmars-d-learn
mailing list