The current memory duration

Many of the constructor functions assign the current memory duration to the data type structures that they allocate.

The following table shows the data type structures that are allocated with the current memory duration.

Table 1. data type structures with the current memory duration
data type structure constructor function destructor function
Collection descriptor (MI_COLL_DESC) mi_collection_open(), mi_collection_open_with_options() mi_collection_close()
Collection (MI_COLLECTION) mi_collection_copy(), mi_collection_create(), mi_streamread_collection() mi_collection_free()
Error descriptor (MI_ERROR_DESC) mi_error_desc_copy() mi_error_desc_destroy()
LO handle (MI_LO_HANDLE) mi_get_lo_handle(), mi_lo_copy(), mi_lo_create(), mi_lo_expand(), mi_lo_from_file(), mi_lo_from_string() mi_lo_delete_immediate(), mi_lo_release()
LO-specification structure (MI_LO_SPEC) mi_lo_spec_init() mi_lo_spec_free()
LO-status structure (MI_LO_STAT) mi_lo_stat() mi_lo_stat_free()

MI_LO_LIST

mi_lo_lolist_create() None
Row descriptor (MI_ROW_DESC) mi_row_desc_create() mi_row_desc_free()
Row structure (MI_ROW) mi_row_create(), mi_streamread_row() mi_row_free()
Stream descriptor (MI_STREAM) mi_stream_init(), mi_stream_open_fio(), mi_stream_open_mi_lvarchar(), mi_stream_open_str() mi_stream_close()
User memory mi_alloc(), mi_zalloc() mi_free()
Varying-length structure (mi_lvarchar, mi_sendrecv, mi_impexp, mi_impexpbin) mi_new_var(), mi_streamread_lvarchar(), mi_string_to_lvarchar(), mi_var_copy() mi_var_free()
To change the memory duration of a data type structure, call the mi_switch_mem_duration() function with the desired duration before the function call that allocates the object. For more information, see Change the memory duration.
Important: All the functions in data type structures with the current memory duration allocate structures with the current memory duration. If you switch the current memory duration, you affect not only explicit allocations you make with mi_alloc() or mi_zalloc() but the memory allocations that all these constructor functions do as well.