The mi_free() function

The mi_free() routine frees the user memory that was previously allocated with the mi_alloc(), mi_dalloc(), or mi_zalloc() function.

Syntax

void mi_free(ptr)
   void *ptr;
ptr
A pointer to memory that mi_alloc(), mi_dalloc(), or mi_zalloc() previously allocated.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_free() function frees the user memory that ptr references. This function behaves like the free() system call, except that it frees memory that one of the DataBlade® API memory-management routines allocated. The mi_free() function does not free memory allocated with malloc(). To conserve resources, use the mi_free() function to deallocate the user memory explicitly when your DataBlade API module no longer needs it. The mi_free() function is the destructor function for user memory. If you do not explicitly free user memory, the database server frees it when its memory duration expires.

Server only: In a C UDR, the mi_free() function does not assume that the memory that ptr references is in the current memory duration. Instead, the function figures out the memory duration of the memory to deallocate.
Client only: In client LIBMI applications, you must call mi_free() to free memory that it has allocated with the mi_alloc(), mi_dalloc(), or mi_zalloc() function. Otherwise, this memory is not freed until the client LIBMI application exits. The database server does not automatically free memory for client LIBMI applications.

Return values

None.