Section: C Library Functions (3)Index
Return to Main Contents
- general purpose memory allocation functions
Ft void *
Fn reallocf void *ptr size_t size
function changes the size of the previously allocated memory referenced by
The contents of the memory are unchanged up to the lesser of the new and
If the new size is larger,
the contents of the newly allocated portion of the memory are undefined.
Upon success, the memory referenced by
is freed and a pointer to the newly allocated memory is returned.
may move the memory allocation, resulting in a different return value than
Fa ptr .
function behaves identically to
for the specified size.
Upon failure, when the requested memory cannot be allocated, the passed pointer
is freed to ease the problems with traditional coding styles for
causing memory leaks in libraries.
function returns a pointer, possibly identical to
Fa ptr ,
to the allocated memory
if successful; otherwise a
pointer is returned, and
is set to
if the error was the result of an allocation failure.
The buffer is deallocated in this case.
function first appeared in
Fx 3.0 .
- RETURN VALUES
- SEE ALSO