feel free to email me at

Simple malloc/free logger.

You probably should go there instead, that thingy can do 64-bit and much more: log-malloc2

Single 4k file only. No dependencies. Zero configuration. Logs parameters, return value and call stack. No need to rebuild application.

Please, note that it's x86 32-bit only. It's because 64-bit ABI optimized frame pointers to oblivion!

Download: log-malloc.c.

Build: gcc -DWITH_PTHREADS -nostartfiles --shared -fPIC -g -ldl -o log-malloc.so log-malloc.c

Build without pthread locks: gcc -nostartfiles --shared -fPIC -g -ldl -o log-malloc.so log-malloc.c

Usage:

LD_PRELOAD=./log-malloc.so command args ...

Redirect output to file:

LD_PRELOAD=./log-malloc.so command args ... 200>filename

Sample output: log-malloc.log.txt

Use addr2line tool from GNU binutils to convert 0x addresses into source code line numbers.

Thanks Dan Carpenter for help in fixing bug.