48struct cx_mempool_memory_s;
65 struct cx_mempool_memory_s **
data;
Interface for custom allocators.
void(* cx_destructor_func)(void *memory)
Function pointer type for destructor functions.
Definition: allocator.h:117
Common definitions and feature checks.
#define __attribute__(x)
Removes GNU C attributes where they are not supported.
Definition: common.h:127
static CxMempool * cxBasicMempoolCreate(size_t capacity)
Creates a basic array-based memory pool.
Definition: mempool.h:98
CxMempool * cxMempoolCreate(size_t capacity, cx_destructor_func destr)
Creates an array-based memory pool with a shared destructor function.
int cxMempoolRegister(CxMempool *pool, void *memory, cx_destructor_func destr)
Registers foreign memory with this pool.
void cxMempoolDestroy(CxMempool *pool)
Destroys a memory pool and frees the managed memory.
void cxMempoolSetDestructor(void *memory, cx_destructor_func fnc)
Sets the destructor function for a specific allocated memory object.
Structure holding the data for an allocator.
Definition: allocator.h:86
The basic structure of a memory pool.
Definition: mempool.h:54
size_t capacity
Memory pool capacity.
Definition: mempool.h:71
struct cx_mempool_memory_s ** data
Array of pooled memory.
Definition: mempool.h:65
cx_destructor_func auto_destr
A destructor that shall be automatically registered for newly allocated memory.
Definition: mempool.h:62
CxAllocator const * allocator
The provided allocator.
Definition: mempool.h:56
size_t size
Number of pooled memory items.
Definition: mempool.h:68