For a 32-bit Linux system:
When malloc () allocates memory, it allocates 8 in number (pad 8) and allocates an additional 8 bytes for accounting.
For instance:
malloc (10) and malloc (12) will allocate 24 bytes of memory (16 bytes after filling + 8 Bytes for accounting).
malloc () does padding because the returned addresses will be a multiple of eight, and therefore will be valid for pointers of any type. Accounting 8 bytes is used when we call a free function. The storage bytes store the length of the allocated memory.
source share