next up previous contents index
Next: 11.4.3 alloc_aligned: Allocate a Up: 11.4 Memory Interface Previous: 11.4.1 alloc: Allocate a

11.4.2 realloc: Reallocate a chunk of memory

 

SYNOPSIS

#include <oskit/com/mem.h>

void *oskit_mem_realloc(oskit_mem_t *m, void *ptr, oskit_u32_t oldsize, oskit_u32_t newsize, oskit_u32_t flags);

DESCRIPTION

Change the size of the previously allocated memory chunk referenced by ptr, returning a pointer to the memory chunk. The flags must include OSKIT_MEM_AUTO_SIZE if the original allocation did, otherwise oldsize must properly give the size of the original allocation. If the new size is larger, the contents of the newly allocated portion is undefined. Any other flags specified in the original allocation should necessarily be given as well. If the size of the original chunk cannot be changed in place, a new chunk of the proper size will be allocated, and the contents of the original chunk copied to it.

PARAMETERS

m
The memory object to operate on.
ptr
The original memory.
oldsize
The size (in bytes) of the original chunk.
newsize
The size (in bytes) of the new chunk.
flags
Allocation options and constraints.

RETURNS

Returns a pointer to the chunk of memory on success, or NULL if the request could not be satisfied.



Utah Flux Research Group