next up previous contents index
Next: 9.5.8 free: release an Up: 9.5 Memory Allocation Previous: 9.5.6 mustcalloc: allocate cleared

9.5.7 realloc: change the size of an existing memory block

   

SYNOPSIS

#include <oskit/c/malloc.h>

void *realloc(void *buf, size_t new_size);

DESCRIPTION

Standard issue realloc function. Calls malloc if buf is zero, otherwise calls lmm_alloc to allocate an entirely new block of memory, uses memcpy to copy the old block, and lmm_frees that block when done.

May call morecore if the initial attempt to allocate memory fails.

PARAMETERS

buf
Pointer to memory to be enlarged.
new_size
Desired size of resulting block.

RETURNS

Returns a pointer to the allocated memory or zero if none.



University of Utah Flux Research Group