InvalidMemoryOperationError when calling functions from destructors

Vladimir Panteleev vladimir at thecybershadow.net
Thu Apr 25 10:57:13 PDT 2013


On Thursday, 25 April 2013 at 16:17:57 UTC, Jacob Carlborg wrote:
> You cannot access GC controlled memory in class destructors.

Not true.

> There's no guarantee in which order the destructors will be 
> called. You don't know if the memory is still valid in a 
> destructor.

The memory is valid, it's just that referenced objects may 
already be finalized.

Regardless, the above (accessing objects in destructors) is not 
related to the InvalidMemoryOperationError. See the documentation 
for it:
http://dlang.org/phobos/core_exception.html#.InvalidMemoryOperationError


More information about the Digitalmars-d mailing list