Skip to content

Commit c6f9344

Browse files
authored
Merge pull request #4124 from swankjesse/WAMR_BUILD_GC_HEAP_SIZE_DEFAULT
Expose WAMR_BUILD_GC_HEAP_SIZE_DEFAULT as a CMake option
2 parents 7cc2620 + 9027b2d commit c6f9344

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

core/iwasm/common/wasm_runtime_common.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,10 @@ wasm_runtime_full_init_internal(RuntimeInitArgs *init_args)
757757
#endif
758758

759759
#if WASM_ENABLE_GC != 0
760-
gc_heap_size_default = init_args->gc_heap_size;
760+
uint32 gc_heap_size = init_args->gc_heap_size;
761+
if (gc_heap_size > 0) {
762+
gc_heap_size_default = gc_heap_size;
763+
}
761764
#endif
762765

763766
#if WASM_ENABLE_JIT != 0

core/shared/mem-alloc/mem_alloc.cmake

+4
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

doc/build_wamr.md

+3
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM
142142
### **Enable Garbage Collection**
143143
- **WAMR_BUILD_GC**=1/0, default to disable if not set
144144

145+
### **Set the Garbage Collection heap size**
146+
- **WAMR_BUILD_GC_HEAP_SIZE_DEFAULT**=n, default to 128 kB (131072) if not set
147+
145148
### **Configure Debug**
146149

147150
- **WAMR_BUILD_CUSTOM_NAME_SECTION**=1/0, load the function name from custom name section, default to disable if not set

0 commit comments

Comments
 (0)