mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 12:46:14 +00:00
zephyr: Implement Alloc_With_System_Allocator (#3179)
Add zephyr libc malloc/realloc/free which were introduced since version 1.13.0.
This commit is contained in:
parent
92bd3ba17d
commit
c949f3d2aa
|
@ -72,18 +72,20 @@ bh_platform_destroy()
|
||||||
void *
|
void *
|
||||||
os_malloc(unsigned size)
|
os_malloc(unsigned size)
|
||||||
{
|
{
|
||||||
return NULL;
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
os_realloc(void *ptr, unsigned size)
|
os_realloc(void *ptr, unsigned size)
|
||||||
{
|
{
|
||||||
return NULL;
|
return realloc(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
os_free(void *ptr)
|
os_free(void *ptr)
|
||||||
{}
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
os_dumps_proc_mem_info(char *out, unsigned int size)
|
os_dumps_proc_mem_info(char *out, unsigned int size)
|
||||||
|
|
|
@ -129,8 +129,12 @@ iwasm_main(void *arg1, void *arg2, void *arg3)
|
||||||
init_args.mem_alloc_type = Alloc_With_Pool;
|
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_buf = global_heap_buf;
|
||||||
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
|
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
|
||||||
|
#elif (defined(CONFIG_COMMON_LIBC_MALLOC) \
|
||||||
|
&& CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) \
|
||||||
|
|| defined(CONFIG_NEWLIB_LIBC)
|
||||||
|
init_args.mem_alloc_type = Alloc_With_System_Allocator;
|
||||||
#else
|
#else
|
||||||
#error Another memory allocation scheme than global heap pool is not implemented yet for Zephyr.
|
#error "memory allocation scheme is not defined."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* initialize runtime environment */
|
/* initialize runtime environment */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user