Implement memory.grow and limit heap space base offset to 1G (#36)

* Implement memory profiler, optimize memory usage, modify code indent

* Implement memory.grow and limit heap space base offset to 1G; modify iwasm build type to Release and 64 bit by default
This commit is contained in:
wenyongh
2019-05-31 01:21:39 -05:00
committed by GitHub
parent ff7cbdd2fb
commit 504268b297
11 changed files with 237 additions and 140 deletions

View File

@ -52,6 +52,12 @@ int bh_memory_init_with_allocator(void *malloc_func, void *free_func);
*/
void bh_memory_destroy();
/**
* Get the pool size of memory, if memory is initialized with allocator,
* return 1GB by default.
*/
int bh_memory_pool_size();
#if BEIHAI_ENABLE_MEMORY_PROFILING == 0
/**

View File

@ -80,6 +80,15 @@
#define WORKING_FLOW_HEAP_SIZE 0
*/
/* Support memory.grow opcode and enlargeMemory function */
#define WASM_ENABLE_MEMORY_GROW 1
/* The max percentage of global heap that app memory space can grow */
#define APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT 1 / 3
/* Default base offset of app heap space */
#define DEFAULT_APP_HEAP_BASE_OFFSET (1 * BH_GB)
/* Default min/max heap size of each app */
#define APP_HEAP_SIZE_DEFAULT (8 * 1024)
#define APP_HEAP_SIZE_MIN (2 * 1024)