From 650f457c5bb4775ef377cdf9c2ce129d30b3e307 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Thu, 5 Feb 2026 23:45:13 +0100 Subject: [PATCH] use pool memory allocator for wasm runtime --- examples/embed/host.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/embed/host.c b/examples/embed/host.c index 61c207c..e726fac 100644 --- a/examples/embed/host.c +++ b/examples/embed/host.c @@ -20,10 +20,14 @@ MAIN() { wasm_exec_env_t exec_env; /* initialize the wasm runtime */ + static char global_heap_buf[HEAP_SIZE]; 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)) { return; }