The current memory duration
Many of the DataBlade API constructor functions assign the current memory duration to the DataBlade API data type structures that they allocate.
The following table shows the DataBlade API data type structures that are allocated with the current memory duration.
DataBlade API data type structure | DataBlade API constructor function | DataBlade API 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 DataBlade
API data
type structure, call the mi_switch_mem_duration() function
with the desired duration before the DataBlade
API function
call that allocates the object. For more information, see Change the memory duration.
Important: All the DataBlade
API functions
in Table 1 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 DataBlade
API constructor
functions do as well.