Heap Consistency Checking on Embedded System

I get a crash like this:

#0  0x2c58def0 in raise () from /lib/
#1  0x2d9b8958 in abort () from /lib/
#2  0x2d9b7e34 in __malloc_consolidate () from /lib/
#3  0x2d9b6dc8 in malloc () from /lib/

I guess it is a heap corruption issue. uclibc does not have mcheck/mprobe. Valgrind does not seem to MIPS support and my app (which is multi-threaded) depends on hw specific drivers. Any suggestions to check the consistency of the heap and to detect corruption?


  • I would use a replacement malloc() (see also this answer) that can easily be made to be more verbose. I'm not saying you need garbage collection, but you do seem to need the additional logging facilities that the link provides.

    If it is heap corruption, the collector is going to choke on it as well, and give you more meaningful messages. It should not be too difficult to use, get what you need, then stop using (especially if you just let it intercept malloc()).

    Its not going to zero in on the problem like Valgrind does, but at least its an option :)