Re-org memory allocation interfaces, add --stack-size and --heap-size option (#193)
This commit is contained in:
@ -124,7 +124,7 @@ void wgl_native_func_call(wasm_module_inst_t module_inst,
|
||||
argc1++; /* module_inst */
|
||||
argc1 += func_def->arg_num;
|
||||
if (argc1 > 16) {
|
||||
argv_copy = (intptr_t *)bh_malloc(func_def->arg_num *
|
||||
argv_copy = (intptr_t *)wasm_runtime_malloc(func_def->arg_num *
|
||||
sizeof(intptr_t));
|
||||
if (argv_copy == NULL)
|
||||
return;
|
||||
@ -190,14 +190,14 @@ void wgl_native_func_call(wasm_module_inst_t module_inst,
|
||||
}
|
||||
|
||||
if (argv_copy != argv_copy_buf)
|
||||
bh_free(argv_copy);
|
||||
wasm_runtime_free(argv_copy);
|
||||
|
||||
/* success return */
|
||||
return;
|
||||
|
||||
fail:
|
||||
if (argv_copy != argv_copy_buf)
|
||||
bh_free(argv_copy);
|
||||
wasm_runtime_free(argv_copy);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ static void cleanup_object_list(uint32 module_id)
|
||||
found = true;
|
||||
lv_obj_del(elem->obj);
|
||||
bh_list_remove(&g_object_list, elem);
|
||||
bh_free(elem);
|
||||
wasm_runtime_free(elem);
|
||||
elem = next;
|
||||
} else {
|
||||
elem = (object_node_t *)bh_list_elem_next(elem);
|
||||
@ -150,7 +150,7 @@ bool wgl_native_add_object(lv_obj_t *obj, uint32 module_id, uint32 *obj_id)
|
||||
{
|
||||
object_node_t *node;
|
||||
|
||||
node = (object_node_t *) bh_malloc(sizeof(object_node_t));
|
||||
node = (object_node_t *) wasm_runtime_malloc(sizeof(object_node_t));
|
||||
|
||||
if (node == NULL)
|
||||
return false;
|
||||
@ -200,7 +200,7 @@ static void _obj_del_recursive(lv_obj_t *obj)
|
||||
while (elem) {
|
||||
if (obj == elem->obj) {
|
||||
bh_list_remove(&g_object_list, elem);
|
||||
bh_free(elem);
|
||||
wasm_runtime_free(elem);
|
||||
vm_mutex_unlock(&g_object_list_mutex);
|
||||
return;
|
||||
}
|
||||
@ -237,7 +237,7 @@ static void post_widget_msg_to_module(object_node_t *object_node, lv_event_t eve
|
||||
if (module == NULL)
|
||||
return;
|
||||
|
||||
object_event = (object_event_t *)bh_malloc(sizeof(*object_event));
|
||||
object_event = (object_event_t *)wasm_runtime_malloc(sizeof(*object_event));
|
||||
if (object_event == NULL)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user