Otto Moerbeek thought me this: First compile your program with debug symbols (and, conveniently, without optimization settings.)
$ DEBUG="-g -O0" make Then: $ MALLOC_OPTIONS=D ktrace -tu <program and args> $ kdump -u malloc kdump will though you lines like this: 0x34f10a4b153 20480 1 20480 addr2line -e /usr/lib/libc.so.97.1 0x4d153 0x34f10a96470 410576 25 16423 addr2line -e /usr/src/usr.bin/<the program you're hacking> 0x98470 If you compiled your program with debugging symbols and your program has some leak, the name of your program will appear in some of those lines. Then you run that addr2line command and it'll show you in which file and line the leak is produced. It will show your errors that valgrind won't.