Skip to main content


ec_realloc — Re-allocate a block of memory, changing its size


#include "ec_malloc.h"

| void * **ec_realloc** ( | object_type, |   | |   | old, |   | |   | size); |   |

int <var class="pdparam">object_type</var>; void * <var class="pdparam">old</var>; size_t <var class="pdparam">size</var>;


Re-allocate a block of memory, changing its size. This function returns NULL if the size could not be altered; the original pointer is left untouched in this case.


This function is only valid with VSIZE memory type, not a fixed size type. For more information about memory types see Memory Types.

The "old" pointer must have been allocated against the same object_type as is being requested here, otherwise undefined behavior will result.

The commentary about mmap in the ec_malloc_size documentation also applies to ec_realloc.

It is illegal to attempt to realloc a fixed size allocation using this function. Undefined, and most certainly unwanted behavior, will result if this is attempted.

Memory returned from this function must be freed via ec_free.



This parameter is an integer indicating a memory type as defined in the section called “Memory Types”.


A pointer to the original memory location.


A size_t type unsigned integer.

Return Values

This function returns the address of the newly sized memory block; it may be the same as the original pointer.


It is legal to call this function in any thread.

See Also

Was this page helpful?