calloc, malloc, free and realloc wrappers to store the size being allocated
Check alignment.


I don;t believe you are correctly aligning your objects.

2. Realloc is wrong.

if realloc returns NULL the original pointer is not deallocated.

MemWrapper* mem2 = static_cast&lt;MemWrapper*&gt;( realloc( mem1, size + MEMWRAPPER_SIZE ) );
if ( !mem2 ) return NULL;


Here if realloc fails you have just leaked memory (as mem1 is still valid).

The standard usage pattern for realloc is:

 void* data = malloc(size);
 ...

 void* extra = realloc(data, newSize);
 if (extra) {
     data = extra;   // only reset data if the realloc worked.

 }