It’s not standard but if your library has a msize()
function that will give you the size.
A common solution is to wrap malloc
with your own function that logs each request along with the size and resulting memory range, in the release build you can switch back to the ‘real’ malloc
.