void mi_free(ptr)
void *ptr;
Valid in Client LIBMI Application? | Valid in User-Defined Routine? |
---|---|
Yes | Yes |
The mi_free( ) function frees the user memory that ptr references. This function behaves just 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.
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.
In client LIBMI applications, you must call mi_free( ) to free memory that it has allocated with mi_alloc( ), mi_dalloc( ), or mi_zalloc( ). Otherwise, this memory is not freed until the client LIBMI application exits. The database server does not automatically free memory for client LIBMI applications.
None.
See also the descriptions of mi_alloc( ), mi_dalloc( ), mi_switch_mem_duration( ), and mi_zalloc( ).