pub unsafe extern "C" fn wasm_runtime_module_malloc(
module_inst: wasm_module_inst_t,
size: u64,
p_native_addr: *mut *mut c_void,
) -> u64
Expand description
Allocate memory from the heap of WASM module instance
Note: wasm_runtime_module_malloc can call heap functions inside the module instance and thus cause a memory growth. This API needs to be used very carefully when you have a native pointers to the module instance memory obtained with wasm_runtime_addr_app_to_native or similar APIs.
@param module_inst the WASM module instance which contains heap @param size the size bytes to allocate @param p_native_addr return native address of the allocated memory if it is not NULL, and return NULL if memory malloc failed
@return the allocated memory address, which is a relative offset to the base address of the module instance’s memory space. Note that it is not an absolute address. Return non-zero if success, zero if failed.