Add realloc func argument for memory allocator (#191)

This commit is contained in:
wenyongh
2020-03-08 21:18:18 +08:00
committed by GitHub
parent 057c849fc0
commit 180ee4c78a
12 changed files with 213 additions and 42 deletions

View File

@ -238,6 +238,7 @@ int main(int argc, char *argv[])
#else
init_args.mem_alloc_type = Alloc_With_Allocator;
init_args.mem_alloc.allocator.malloc_func = malloc;
init_args.mem_alloc.allocator.realloc_func = realloc;
init_args.mem_alloc.allocator.free_func = free;
#endif
@ -270,8 +271,8 @@ int main(int argc, char *argv[])
/* instantiate the module */
if (!(wasm_module_inst = wasm_runtime_instantiate(wasm_module,
64 * 1024, /* stack size */
64 * 1024, /* heap size */
48 * 1024, /* stack size */
16 * 1024, /* heap size */
error_buf,
sizeof(error_buf)))) {
bh_printf("%s\n", error_buf);