2019-05-07 02:18:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
2019-11-11 23:45:21 +00:00
|
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2019-05-07 02:18:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MEM_ALLOC_H
|
|
|
|
#define __MEM_ALLOC_H
|
|
|
|
|
2020-03-16 08:43:57 +00:00
|
|
|
#include "bh_platform.h"
|
2019-05-07 02:18:18 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef void *mem_allocator_t;
|
|
|
|
|
|
|
|
mem_allocator_t
|
|
|
|
mem_allocator_create(void *mem, uint32_t size);
|
|
|
|
|
|
|
|
void
|
|
|
|
mem_allocator_destroy(mem_allocator_t allocator);
|
|
|
|
|
|
|
|
void *
|
|
|
|
mem_allocator_malloc(mem_allocator_t allocator, uint32_t size);
|
|
|
|
|
2020-03-08 13:18:18 +00:00
|
|
|
void *
|
|
|
|
mem_allocator_realloc(mem_allocator_t allocator, void *ptr, uint32_t size);
|
|
|
|
|
2019-05-07 02:18:18 +00:00
|
|
|
void
|
|
|
|
mem_allocator_free(mem_allocator_t allocator, void *ptr);
|
|
|
|
|
2020-04-13 02:49:40 +00:00
|
|
|
int
|
|
|
|
mem_allocator_migrate(mem_allocator_t allocator,
|
|
|
|
mem_allocator_t allocator_old);
|
|
|
|
|
|
|
|
int
|
|
|
|
mem_allocator_reinit_lock(mem_allocator_t allocator);
|
|
|
|
|
|
|
|
void
|
|
|
|
mem_allocator_destroy_lock(mem_allocator_t allocator);
|
|
|
|
|
2019-05-07 02:18:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* #ifndef __MEM_ALLOC_H */
|
|
|
|
|