How to debug (potential) GC bugs?

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 3 02:00:55 PDT 2016


On Saturday, 1 October 2016 at 00:06:05 UTC, Matthias Klumpp 
wrote:
> I do none of those things in my code though...

`grep "~this" *.d` gives nothing? It can be a struct with 
destructor stored in a class. Can you observe the error? Try to 
set a breakpoint at onInvalidMemoryOperationError 
https://github.com/dlang/druntime/blob/master/src/core/exception.d#L559 and see what stack leads to it.

> Unfortunately for having deterministic memory management, I 
> would essentially need to develop GC-less, and would loose 
> classes. This means many nice features of D aren't available, 
> e.g. I couldn't use interfaces (AFAIK they don't work on 
> structs) or constraints.

Not necessarily. You only need to dispose the resources in time, 
like in C#. But if you don't have destructors, you have nothing 
to dispose.

> Strangely after switching from the GDC compiler to the LDC 
> compiler, all crashes observed at Ubuntu are gone.

Sounds not good.


More information about the Digitalmars-d-learn mailing list