This code provides a 'shim' to intercept memory allocation and free calls. Very useful for microcontrollers where valgrind can't be used to track down memory leaks!

Library can be compiled with any compiler that has stdlib.h. Calls to malloc(), realloc(), calloc(), and free() can be appended with _t to make calls to the tracking functions malloc_t(), realloc_t(), calloc_t(), and free_t() or use the -Wl,-wrap feature of binutils for existing calls to malloc(), realloc(), calloc(), and free() without changing source code...

Sign Up For Full Access
Members gain full access to the Prosource library with dozens of source files for ARM Cortex, ATMega, PIC processors as well as desktop and embedded Linux systems. Solutions for bootloaders, Buildroot and Yocto targets as well as guided articles on embedded development to gain critical knowledge in new systems and speed up development.
Files size: 8.58 KB
RAM usage:4 bytes added to each allocation
Avg Flash:3992 bytes for test program for mem_test()
Source #1 - Members Only
Source #2 - Members Only