Charlie Savage <cfis / savagexi.com> wrote:
> #define CALC_EXACT_MALLOC_SIZE 0
I tried flipping this a few months back in trunk but didn't have time to
investigate what went wrong when I did. I'm not sure how much people
care for it or if it's even maintained/tested by anyone (I'm not sure
I care).
I have found (and helped fix at least one) 3rd-party extensions that had
an issue with this (due to a x*alloc() paired with a regular free() or
vice-versa). So I suspect this is a common (but currently non-fatal)
bug in other extensions, too.
Anyways, several (most?) malloc implementations support
malloc_usable_size() (or similar) and have various hooks that could be
used to instrument malloc. Unfortunately the various extensions I know
of aren't compatible with each other (dlmalloc/ptmalloc, tcmalloc,
jemalloc).