full allocation debugging for GC logger

Alan Knowles alan at akbkhome.com
Wed Sep 3 01:29:29 PDT 2008


This may be useful for anyone wanting to debug memory leaks.

http://www.akbkhome.com/svn/D_Stuff/gcx.d

It's basically a large addition to the logger code, so that it can find 
out the calling location that tried to allocate memory, stores this in 
the Log.file item.

Then when you do a genCollect/fullCollect - it lists where memory was 
allocated that can not be free'd yet.

Code changes are public domain - so walter is free to add what he thinks 
is a good idea....

(note I had to use the demangle code from gdb, as I think calling 
std.demangle would affect the pool...)


for Freebsd/gcc - you need to compile with the options:

gcc -Wl,-export-dynamic -lexecinfo .......


Regards
Alan



Example output:

+log_collect(Mailer.smtpdthread.SmtpdThread.run():122)
         size = 8, parent = 80fc000 - Mailer.lib.tls.Tls._ctor():34
         size = 64, parent = bfbfe488 - Mailer.lib.tls.Tls._ctor():34
         size = 24, parent = 285aff80 - 
Mailer.config.Config.getListenTo():393
         size = 5, parent = bfbfe488 - 
Mailer.config.Config.getListenTo():432
         size = 24, parent = bfbfe488 - 
Mailer.config.Config.getListenTo():393
         size = 104, parent = bfaed8c8 - Mailer.main.MailerRun():167
         size = 16, parent = bfaed8c8 - 
Mailer.listenthread.ListenThread.bindSocket():55
         size = 5, parent = bfbfe488 - Mailer.main.MailerRun():208
         size = 104, parent = bfbfe488 - Mailer.main.MailerRun():167
....




More information about the Digitalmars-d mailing list