set correct stack_size for wamr

This commit is contained in:
2026-02-05 17:55:37 +01:00
parent 6307a01b6f
commit 6381727851

View File

@ -1,18 +1,14 @@
// https://github.com/bytecodealliance/wasm-micro-runtime/blob/WAMR-2.4.4/doc/embed_wamr.md
// #include <stdio.h>
#include <string.h>
#include "lib.c"
// #include "bh_read_file.h"
#include "bh_platform.h"
#include "wasm_export.h"
#include "__WASM_ARRAY_FILE__"
#define STACK_SIZE (8 * 1024)
#define HEAP_SIZE (8 * 1024)
#define STACK_SIZE (4 * 1024)
#define HEAP_SIZE (4 * 1024)
// TODO: Set this up so the lsp actually finds the includes...
@ -22,8 +18,6 @@ MAIN() {
wasm_module_inst_t module_inst;
wasm_function_inst_t func;
wasm_exec_env_t exec_env;
uint32 stack_size = 8 * 1024;
uint32 heap_size = 8 * 1024;
/* initialize the wasm runtime */
RuntimeInitArgs init_args;
@ -39,14 +33,14 @@ MAIN() {
sizeof(error_buf));
/* create an instance of the WASM module (WASM linear memory is ready) */
module_inst = wasm_runtime_instantiate(module, stack_size, heap_size,
module_inst = wasm_runtime_instantiate(module, STACK_SIZE, HEAP_SIZE,
error_buf, sizeof(error_buf));
/* lookup a WASM function by its name, the function signature can NULL here */
func = wasm_runtime_lookup_function(module_inst, "wasm_module");
/* create an execution environment to execute arbitrary WASM functions */
exec_env = wasm_runtime_create_exec_env(module_inst, stack_size);
exec_env = wasm_runtime_create_exec_env(module_inst, STACK_SIZE);
/* arguments are always transferred in 32-bit element */
uint32 args[1];