20 Memory management library [mem] (original) (raw)

20.2 Memory [memory]

20.2.12 C library memory allocation [c.malloc]

[Note 1:

The header declares the functions described in this subclause.

— _end note_]

void* aligned_alloc(size_t alignment, size_t size);void* calloc(size_t nmemb, size_t size);void* malloc(size_t size);void* realloc(void* ptr, size_t size);

Effects: These functions have the semantics specified in the C standard library.

Remarks: These functions do not attempt to allocate storage by calling ​::​operator new() ([new.delete]).

These functions implicitly create objects ([intro.object]) in the returned region of storage and return a pointer to a suitable created object.

In the case of calloc and realloc, the objects are created before the storage is zeroed or copied, respectively.

Effects: This function has the semantics specified in the C standard library.

Remarks: This function does not attempt to deallocate storage by calling​::​operator delete().

See also: ISO/IEC 9899:2018, 7.22.3