Linux Memory Checker Comparison

I recently evaluated several different (Free only) memory overrun and leak detection utilities for Linux. In an attempt to be useful I've made some comments available here.

checkergcc

Available from http://www.gnu.org/software/checker/

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.

ccmalloc

Available from http://iseran.ira.uka.de/~armin/ccmalloc/

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

Available from http://www3.hmc.edu/~neldredge/yamd/

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

Available from http://fscked.org/proj/njamd.shtml

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

Available from ftp://ftp.perens.com/pub/ElectricFence/

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.


Summary

checker-gcc ccmalloc yamd
Version Tested 0.9.9.1 0.2.3 0.32
Works with Recompilation Yes Yes Yes
Works with Dynamic Load - - Yes
Environment Variable Configuration Yes - Yes
Dotfile Configuration Yes Yes -
Supports C Yes Yes Yes
Supports C++ - Yes Yes
Leak Detection Yes Yes Yes
Overrun Detection Yes 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
Specified
Rounded Up
to page (4k)
Speed Cost (factor of original) 17 18 28

This page most recently modified on: Tuesday, 24-Jul-2001 17:54:24 EDT

the w3c sucks, but this page is still valid
Copyright 2001 by Terran Melconian. You may mirror this page for personal use. All other rights reserved.
Contact, unfortunately now obfuscated due to ongoing spammer harvesting, is [myfirstname] at consistent.org.