Regarding memory consumption, perhaps libmudflap's default backtrace
parameter should be set to zero, for both speed and space reasons.
If it's storing all the backtraces that is burning up all the memory,
another approach might be to keep a separate hash table for storing
backtraces, then hash new backtraces and see if the same backtrace already
exists from a previous call to malloc. If so, no need to allocate a
new one. That's essentially what the hprof Java profiler does, and it
works pretty well. The average application might have many thousands
of mallocs, but only a few distinct backtraces. Also, saving program
counters instead of symbolic names in the backtrace would probably save
a lot of memory, and might also make hashing the backtrace cheaper.
Or the strings containing the symbolic names could be internalized rather
than allocating a new string for every symbolic name in every backtrace.