Files
experimental-evaluation-of-…/chapters/05_experiment_setup/listings/wamrinitialization.cpp
T
2026-09-12 13:29:35 +02:00

19 lines
677 B
C++

static RuntimeInitArgs init_args;
memset(&init_args, 0, sizeof(RuntimeInitArgs));
#ifdef ALLOC_WITH_ALLOCATOR
init_args.mem_alloc_type = Alloc_With_Allocator;
init_args.mem_alloc_option.allocator.malloc_func = (void *)wamr_malloc;
init_args.mem_alloc_option.allocator.realloc_func = (void *)wamr_realloc;
init_args.mem_alloc_option.allocator.free_func = (void *)wamr_free;
#else // Alloc_With_Pool
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);
#endif
init_args.max_thread_num = 1;
if (!wasm_runtime_full_init(&init_args)) {
goto error_cleanup;
}