Processor simulator which tracks all memory accesses by a process. Use -g -O0 to prevent optimization by the compiler.
Instrumented versions of malloc/free exist which can be linked into a program as a replacement for the original versions. The debugging versions allow fine-grained tracking of memory allocation errors
No program changes are necessary. This tool just tracks which function needs how much memory. It also tracks unused memory areas which have been allocated but are no longer reachable.