You could also try Valgrind. I find it works very well. The thing with Valgrind is that it's basically an entire virtual machine: no instructions are executed directly, Valgrind handles everything. So it lets you detect memory leaks in external libraries and everything. You don't even have to re-compile your program; you don't even need the source for a program to use Valgrind on it.Quote:
Another option is to use Electric Fence (gcc prog.c -lefence) to also diagnose mis-use of allocated memory.
Of course, I've never used Electric Fence or any other memory leak detection tools besides Valgrind. ;)