Home | Previous Page | Next Page   Data Manipulation > Using Smart Large Objects > Creating a Smart Large Object >

Freeing Resources

After you store the new smart large object in the database, make sure that any resources you no longer need are freed. When you create a new smart large object, you might need to free resources of the following data type structures:

Server Only

If any of the smart-large-object data type structures has a memory duration of PER_ROUTINE, the database server automatically frees the structure when the UDR completes.

End of Server Only

Freeing an LO-Specification Structure

Server Only

The mi_lo_spec_init( ) function allocates an LO-specification structure in the current memory duration. Therefore, if an LO-specification structure has a memory duration of PER_ROUTINE, the database server automatically frees it when the UDR completes.

End of Server Only

To explicitly free the resources assigned to an LO-specification structure, use the mi_lo_spec_free( ) function. The mi_lo_spec_free( ) function is the destructor function for the LO-specification structure. When these resources are freed, they can be reallocated to other structures that your program needs.

Freeing an LO Handle

Server Only

The LO handle structure is allocated with the current memory duration. Therefore, if it has the default memory duration of PER_ROUTINE, the database server automatically frees it when the UDR completes.

End of Server Only

To explicitly free the resources assigned to an LO handle, you can use one of the following DataBlade API functions.

DataBlade API Function Object Freed
mi_lo_release( ) Frees resources of a transient smart large object

Frees an LO handle that the DataBlade API allocated

mi_free( ) Frees an LO handle that you have allocated

If you allocate an LO handle with a DataBlade API memory-management function (such as mi_alloc( ) or mi_dalloc( )), use mi_free( ) to explicitly free the resources.

mi_lo_delete_immediate( ) Immediately frees the resources of a smart large object (rather than waiting for the end of the transaction)

When these resources are freed, they can be reallocated to other structures that your program needs.

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