The mi_named_free() function

The mi_named_free() function frees a block of named memory.

Syntax

void mi_named_free(mem_name, duration)
   mi_string *mem_name;
   MI_MEMORY_DURATION duration;
mem_name
The null-terminated name of an existing named-memory block.
duration
A value that specifies the memory duration of the named-memory block to free. Valid values for duration are:
PER_ROUTINE
For the duration of one iteration of the UDR
PER_COMMAND
For the duration of the execution of the current subquery
PER_STATEMENT (Deprecated)
For the duration of the current SQL statement
PER_STMT_EXEC
For the duration of the execution of the current SQL statement
PER_STMT_PREP
For the duration of the current prepared SQL statement
PER_TRANSACTION
For the duration of one transaction
PER_SESSION
For the duration of the current client session
PER_SYSTEM
For the duration of the database server execution
Valid in client LIBMI application? Valid in user-defined routine?
No Yes
Important: This advanced function can adversely affect your UDR if you use the function incorrectly. Use it only when no regular DataBlade® API function can perform the task you need done.

Usage

The mi_named_free() function frees a named-memory block based on its memory duration of duration and its name, which mem_name references. To conserve resources, use the mi_named_free() function to explicitly deallocate the named memory once your DataBlade® API module no longer needs it. The mi_named_free() function is the destructor function for named memory. If you do not explicitly free named memory, the database server frees it when its memory duration expires.

If mem_name references a named-memory block that was already freed or does not reference a named-memory block, the mi_named_free() function does not return a value. The function returns silently in all cases, even when it cannot find mem_name.

The mi_named_free() function frees named memory previously allocated with the mi_named_alloc() or mi_named_zalloc() function. It does not free memory allocated with the malloc(), mi_alloc(), mi_dalloc(), or the mi_zalloc() function.
Restriction: Do not attempt to free a named-memory block if it is currently locked. Always unlock a named-memory block with the mi_unlock_memory() function before you attempt to free the memory. Failure to do so can severely impact the operation of the database server.

Return values

None.