include the mcheck.h header file in all your .c files, and call mtrace as the first statement in main.
Do not use mcheck() and malloc_usable_size() at the same time, as mcheck() changes the implementation of malloc(), and malloc_usable_size() looks for the size at the wrong place.
See also LD_DEBUG, MALLOC_CHECK_,
http://www.gnu.org/manual/glibc-2.0.6/html_node/libc_30.html
2 pages link to mcheck: