Implement memory context with main and temp arenas
This commit is contained in:
27
mem/include/ctx/mem_ctx.h
Normal file
27
mem/include/ctx/mem_ctx.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef MEM_CTX_H
|
||||
#define MEM_CTX_H
|
||||
|
||||
#include "mem_arena.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef enum {
|
||||
CTX_DEST_BUFFER_MAIN,
|
||||
CTX_DEST_BUFFER_TEMP,
|
||||
|
||||
COUNT_CTX_DEST_BUFFER,
|
||||
} CTXDestBuffer;
|
||||
|
||||
void wapp_mem_ctx_init(u64 main_buf_capacity, u64 temp_buf_capacity);
|
||||
void *wapp_mem_ctx_alloc(CTXDestBuffer buffer, u64 size);
|
||||
void *wapp_mem_ctx_alloc_aligned(CTXDestBuffer buffer, u64 size, u64 alignment);
|
||||
void wapp_mem_ctx_clear(CTXDestBuffer buffer);
|
||||
void wapp_mem_ctx_free(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !MEM_CTX_H
|
||||
Reference in New Issue
Block a user