Manage memory in client LIBMI applications

When a DataBlade® API module needs to perform dynamic memory allocation, it must do so from user memory.
Table 1. Memory-management functions that the DataBlade API provides for memory operations for user memory.
Memory duration Header Function name
Not applicable Constructor mi_alloc(), mi_dalloc(), mi_realloc(), mi_zalloc()
Not applicable 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.
Tip: To use these DataBlade API memory-management functions, be sure to include the mi.h header file in the appropriate source files of your client LIBMI application.