Normalize how the global heap pool is configured across iwasm apps (#1628)
Use the cmake variable `WAMR_BUILD_GLOBAL_HEAP_POOL` and `WAMR_BUILD_GLOBAL_HEAP_SIZE` to enable/disable the global heap pool and set its size. And set the default global heap size in core/config.h and the cmake files. As a result, the developers who build iwasm can easily enable/disable the global heap pool and change its size regardless of the iwasm implementation, without manually finding and patching the right location for that value.
This commit is contained in:
@ -174,10 +174,8 @@ validate_env_str(char *env)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define USE_GLOBAL_HEAP_BUF 0
|
||||
|
||||
#if USE_GLOBAL_HEAP_BUF != 0
|
||||
static char global_heap_buf[10 * 1024 * 1024] = { 0 };
|
||||
#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
|
||||
static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE] = { 0 };
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_MULTI_MODULE != 0
|
||||
@ -359,7 +357,7 @@ main(int argc, char *argv[])
|
||||
|
||||
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
||||
|
||||
#if USE_GLOBAL_HEAP_BUF != 0
|
||||
#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user