The mi_realloc() function

The mi_realloc() function reallocates a block of user memory to a specified size and returns a pointer to that block.

Syntax

void *mi_realloc(void *ptr, mi_integer size)
mi_integer size;
ptr
A pointer to a memory block.
size
The number of bytes to reallocate.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_realloc() function changes the size of user memory to the specified size, with the current default memory duration. If the ptr parameter is NULL, then mi_realloc() is a constructor function for user memory that behaves the same as mi_alloc().

The mi_realloc() function returns a pointer to the reallocated user memory. Cast this pointer to match the structure of the user-defined buffer or structure that you allocate. A DataBlade® API module can use mi_free() to free memory allocated by mi_realloc() when that memory is no longer needed.

For more information, see the discussion about how to allocate user memory in the HCL OneDB™ DataBlade API Programmer's Guide.

Return values

A void pointer
A pointer to the reallocated memory. Cast this pointer to match the user-defined buffer or structure for which the memory was allocated.
NULL
The function was unable to allocate the memory.

The mi_realloc() function does not throw an MI_Exception event when it encounters a runtime error. Therefore, it does not cause callbacks to start.