Skip to content

Commit beb34c3

Browse files
committed
Expose WAMR_BUILD_GC_HEAP_SIZE_DEFAULT as a CMake option
This is wired through to the GC_HEAP_SIZE_DEFAULT constant. Also honor this value when configuring the engine with the wasm_c_api.
1 parent ff10b86 commit beb34c3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

core/iwasm/common/wasm_c_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ wasm_engine_new_internal(wasm_config_t *config)
393393
WASM_C_DUMP_PROC_MEM();
394394

395395
/* wasm_config_t->MemAllocOption -> RuntimeInitArgs->MemAllocOption */
396+
init_args.gc_heap_size = GC_HEAP_SIZE_DEFAULT;
396397
init_args.mem_alloc_type = config->mem_alloc_type;
397398
memcpy(&init_args.mem_alloc_option, &config->mem_alloc_option,
398399
sizeof(MemAllocOption));

core/shared/mem-alloc/mem_alloc.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ if (WAMR_BUILD_GC_CORRUPTION_CHECK EQUAL 0)
2424
add_definitions (-DBH_ENABLE_GC_CORRUPTION_CHECK=0)
2525
endif ()
2626

27+
if (DEFINED WAMR_BUILD_GC_HEAP_SIZE_DEFAULT)
28+
add_definitions ("-DGC_HEAP_SIZE_DEFAULT=${WAMR_BUILD_GC_HEAP_SIZE_DEFAULT}")
29+
endif ()
30+
2731
file (GLOB_RECURSE source_all
2832
${MEM_ALLOC_DIR}/ems/*.c
2933
${MEM_ALLOC_DIR}/tlsf/*.c

0 commit comments

Comments
 (0)