How to get memory block length after malloc?

You don’t have to track it by your self!

size_t malloc_usable_size (void *ptr);

But it returns the real size of the allocated memory block!
Not the size you passed to malloc!

Leave a Comment