From the forum thread http://forum.dlang.org/thread/ossuvfmqthllgdpgz...@forum.dlang.org?page=1

and the PR https://github.com/D-Programming-Language/dlang.org/pull/851

I learned that allocation in a destructor isn't the only crash case here.

The GC calls a class instance's invariant() method during a collection cycle, before calling the object's destructor, and possibly after destructing objects it references. So if the invariant() touches any of its member references, it can crash!

A solution to that would be to never call invariants during a collection cycle, but what other gotcha's exist during collection? Would @nogc on class destructors help them?

Reply via email to