This is my favorite utility for C. Sadly, its support for C++ is lacking. It cannot be used on any program which uses libstdc++, which is probably most C++ programs. Thus, while it's everything I want for C, it's useless for C++. Work is being done to correct this, but as of this writing, it should not be expected in the immediate future.
When I had to do some work on a C++ program, I started looking for alternatives to checkergcc, and this is the first one I found. Its main drawback is that its over/underwrite checking is inferior to that of the others - it cannot print information on where the actual out-of-bounds access occurred, only what memory was accessed and where said memory was allocated.
YAMD has a reasonable featureset, though it is somewhat slower than the others. Its main drawback, however, is that it promotes all memory allocations to full pages - so a 50-byte allocation becomes 8k. This makes it useless for applications which allocate large numbers of small blocks.
njamd does not provide symbolic lookup of locations in the program, requiring the user to do this manually with gdb. I did not evaluate njamd, but it looks like they'll have this problem corrected fairly soon, so it's worth keeping an eye on.
Electric Fence takes a minimalist approach to things. It detects only over and underruns and not leaks, and it provides no useful output of its own; it simply makes sure your program has a segmentation fault which you can examine with your debugger. This isn't what I was looking for, so I haven't carefully evaluated Electric Fence, but I mention it because for some projects it may be exactly what you want.
|Works with Recompilation||Yes||Yes||Yes|
|Works with Dynamic Load||-||-||Yes|
|Environment Variable Configuration||Yes||-||Yes|
|Call Chain of Allocation||Yes||Yes||Yes|
|Call Chain of Overrun||Yes||-||Yes|
|Arbitrary-size Over/Underrun Check Zones||-||Yes||-|
|Fine Control of Logging||Yes||Yes||-|
|Memory Cost per Allocation||None||User|
to page (4k)
|Speed Cost (factor of original)||17||18||28|