Home | Previous Page | Next Page   Function Descriptions >

mi_free( )

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
is 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 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.

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.

End of Server Only
Client Only

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.

End of Client Only

Return Values

None.

Related Topics

See also the descriptions of mi_alloc( ), mi_dalloc( ), mi_switch_mem_duration( ), and mi_zalloc( ).

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]