use pool memory allocator for wasm runtime
This commit is contained in:
@ -20,10 +20,14 @@ MAIN() {
|
|||||||
wasm_exec_env_t exec_env;
|
wasm_exec_env_t exec_env;
|
||||||
|
|
||||||
/* initialize the wasm runtime */
|
/* initialize the wasm runtime */
|
||||||
|
static char global_heap_buf[HEAP_SIZE];
|
||||||
RuntimeInitArgs init_args;
|
RuntimeInitArgs init_args;
|
||||||
memset(&init_args, 0, sizeof(init_args));
|
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
||||||
|
|
||||||
init_args.mem_alloc_type = Alloc_With_System_Allocator;
|
init_args.mem_alloc_type = Alloc_With_Pool;
|
||||||
|
init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
|
||||||
|
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
|
||||||
|
init_args.max_thread_num = 1;
|
||||||
if (!wasm_runtime_full_init(&init_args)) {
|
if (!wasm_runtime_full_init(&init_args)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user