On Monday, 13 June 2016 at 08:26:34 UTC, cy wrote:

So... that's my complaint about the D garbage collection. It's frustratingly opaque, impossible to debug, and provides no help whatsoever in its error messages to understanding what went wrong. Garbage collection causes errors after the program has entirely finished, and calling GC.collect() inside a destructor will not only cause the error, it'll completely terminate the program before it finishes the destructor. Speed is great, but debugging with garbage collection is pretty much an endless fount of misery and frustration for me.

see what objects are being destructed
Well you can detect in a destructor if you are called by the GC: https://p0nce.github.io/d-idioms/#GC-proof-resource-class

This thing helps with getting rid of such bugs.
Having a non-trivial destructor called by the GC, and relying on it, is imho an error at best, should always be manual.


Reply via email to