When a DataBlade API module needs to perform dynamic memory allocation, it must do so from user memory. The following table shows the memory-management functions that the DataBlade API provides for memory operations for user memory.
Memory Duration | Memory Operation | Function Name |
---|---|---|
Not applicable | Constructor | mi_alloc( ),
mi_dalloc( ), mi_realloc( ), mi_zalloc( ) |
Destructor | mi_free( ) |
A client LIBMI application allocates user memory from the process of the client LIBMI application. In a client LIBMI application, the DataBlade API memory-management functions perform the same type of allocation as operating-system memory functions such as malloc( ) and free( ). Therefore, use of the DataBlade API memory-management functions is optional in a client LIBMI application. However, use of the DataBlade API memory-management functions to ensure consistency and portability of code between client and server DataBlade API modules is recommended.