void * pm_arena_zalloc(pm_arena_t *arena, size_t size, size_t alignment)
Allocate zero-initialized memory from the arena.
struct pm_arena_block pm_arena_block_t
A single block of memory in the arena.
void * pm_arena_memdup(pm_arena_t *arena, const void *src, size_t size, size_t alignment)
Allocate memory from the arena and copy the given data into it.
void * pm_arena_alloc(pm_arena_t *arena, size_t size, size_t alignment)
Allocate memory from the arena.
PRISM_EXPORTED_FUNCTION void pm_arena_free(pm_arena_t *arena)
Free all blocks in the arena.
Macro definitions used throughout the prism library.
#define PM_FLEX_ARY_LEN
A macro for defining a flexible array member.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
A single block of memory in the arena.
struct pm_arena_block * prev
The previous block in the chain (for freeing).
char data[PM_FLEX_ARY_LEN]
The block's data.
size_t used
The number of bytes consumed so far.
size_t capacity
The total usable bytes in data[].
size_t block_count
The number of blocks allocated.
pm_arena_block_t * current
The active block (allocate from here).