mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-10-24 01:41:17 +00:00
Add an option to pass user data to the allocator functions. It is common to
do this so that the host embedder can pass a struct as user data and access
that struct from the allocator, which gives the host embedder the ability to
do things such as track allocation statistics within the allocator.
Compile with `cmake -DWASM_MEM_ALLOC_WITH_USER_DATA=1` to enable
the option, and the allocator functions provided by the host embedder should
be like below (an extra argument `data` is added):
void *malloc(void *data, uint32 size) { .. }
void *realloc(void *data, uint32 size) { .. }
void free(void *data, void *ptr) { .. }
Signed-off-by: Andrew Chambers <ncham@amazon.com>
|
||
|---|---|---|
| .. | ||
| aot_export.h | ||
| lib_export.h | ||
| wasm_c_api.h | ||
| wasm_export.h | ||