How far do you want to take this? I ask because if you want to test a heap management replacement I recommend you see the tip I posted here :
Memory Allocation Tracking for C++ Code[
^]. If you use those macros in a header file and implement your own version of what Microsoft did in CRTdbg.h you can have a full heap management replacement library. Then add this macro :
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <CRTdbg.h>
#endif
with your header file instead and you are ready to go. You will have a drop-in replacement for new, delete, alloc, calloc, and free so you can investigate exactly what goes on in a memory manager. It only requires that you implement two functions (_malloc_dbg and _free_dbg in their implementation) and rewrite the macros similar to what CRTdbg.h has. You will need a copy of Visual Studio to see that file but it is available for free.
If you don't have that file you can still do what is necessary because in the tip I posted you can see how those functions are called and you can find the prototypes for the other functions so you just have to write translation macros to connect them all together.
I tend to recommend this path because you can then use just standard memory allocation code to test your stuff. You don't have to write anything 'special' - you just use standard stuff like new, delete, calloc, and free. If you have more questions about this then a separate question would probably be best.