malloc_size(3)

malloc_size3

Memory allocation information

Usage

#include <malloc/malloc.h>

size_t

malloc_good_size(size_t size);

size_t

malloc_size(const void *ptr);

Overview

The malloc_size() function returns the size of the memory block that backs the allocation pointed to by ptr. The memory block size is always at least as large as the allocation it backs, and may be larger.

The malloc_good_size() function rounds size up to a value that the allocator implementation can allocate without adding any padding; it then returns that rounded-up value.

Releases

Unchanged in 109 releases since Mac OS X 10.5.

  1. 10.5–26.5

From libmalloc 812.100.31 in macOS 26.5. Parsed by carta from the page's mdoc source.