How to debug (potential) GC bugs?

Matthias Klumpp via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 30 17:06:05 PDT 2016


On Thursday, 29 September 2016 at 09:56:34 UTC, Kagamin wrote:
> Does it crash only in rt_finalize2? It calls the class 
> destructor, and the destructor must not allocate or touch GC in 
> any way because the GC doesn't yet support allocation during 
> collection.

Thank you all for the good advice! I do none of those things in 
my code though...
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.

Strangely after switching from the GDC compiler to the LDC 
compiler, all crashes observed at Ubuntu are gone.
So, this problem is:
  A) A compiler / DRuntime bug, or
  B) A bug in my code (not) triggered by a certain compiler / 
DRuntime

For the excessive memory usage, I have no idea yet - the GC not 
freeing its memory pool on exit is quite bad for Valgrinding the 
code.
Memory consumption has bettered recently after not re-opening a 
LMDB database twice in the same process from multiple threads, 
which is not supported by LMDB. I haven't done longer runs yet, 
so I am not sure if that really was the problem (seems unlikely, 
but you never know...).

Cheers,
     Matthias



More information about the Digitalmars-d-learn mailing list