I am working on a clone of the malloc (3)
functions (malloc
, realloc
and free
for now).
I would like to add support for Valgrind. I'm using these docs. However, after adding calls to the VALGRIND_MEMPOOL_FREE
, VALGRIND_MEMPOOL_ALLOC
and VALGRIND_CREATE_MEMPOOL
macros, I get the following from Valgrind:
==22303== HEAP SUMMARY:
==22303== in use at exit: 0 bytes in 0 blocks
==22303== total heap usage: 7 allocs, 0 frees, 2,039 bytes allocated
==22303==
==22303== All heap blocks were freed -- no leaks are possible
This is despite my realloc
calling VALGRIND_MEMPOOL_FREE
and my free
calling VALGRIND_MEMPOOL_FREE
.
What could be the cause of this ?
This is due to a bug in valgrind. See the link to the valgrind bug tracker in my comment to your answer.
From the other link in my comment: