Debugging heap corruption

Matthias Walter walter at mail.math.uni-magdeburg.de
Sun Jul 29 07:02:08 PDT 2007


Leandro Lucarella Wrote:
> Vladimir Panteleev, el 29 de julio a las 10:03 me escribiste:
> > Someone has also suggested GDB/Vargrind, however I haven't attempted this combination out of reasoning that since D's GC handles all the allocation and manages the memory, Valgrind wouldn't be able to hook the memory allocation routines and take over memory management from D's GC. If I reasoned wrongly, please let me know.
> 
> Valgrind override both libc and system calls, and D's GC have to use them,
> so my wild guess is *yes*, valgrind should help.
> 

Yes, valgrind works like a charm with D - except that D seems to not free all GC variables at the end, but this should be no problem. Memory corruption is still shown completely. Only problem I see here is if you have some errors in destructors, because then you'll see many corruptions evoked by GC-routines although the reasons are in your code.
Also the symbol names are the mangled ones, so reading them is a bit odd.

Matthias Walter



More information about the Digitalmars-d mailing list