libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
Go to the source code of this file.
Data Structures | |
struct | GblArenaAllocatorPage |
struct | GblArenaAllocatorClass |
struct | GblArenaAllocator |
struct | GblArenaAllocatorState |
Macros | |
#define | GblArenaAllocator_construct(...) |
#define | GblArenaAllocator_alloc(...) |
Type System | |
Type UUID and cast operators | |
#define | GBL_ARENA_ALLOCATOR_TYPE |
#define | GBL_ARENA_ALLOCATOR(self) |
#define | GBL_ARENA_ALLOCATOR_CLASS(klass) |
#define | GBL_ARENA_ALLOCATOR_GET_CLASS(self) |
Functions | |
GblType | GblArenaAllocator_type (void) |
GBL_RESULT | GblArenaAllocator_construct (GblArenaAllocator *pSelf, size_t pageSize, size_t pageAlign, GblArenaAllocatorPage *pInitialPage, GblContext *pCtx) |
GBL_RESULT | GblArenaAllocator_destruct (GblArenaAllocator *pSelf) |
size_t | GblArenaAllocator_pageCount (const GblArenaAllocator *pSelf) |
size_t | GblArenaAllocator_bytesUsed (const GblArenaAllocator *pSelf) |
size_t | GblArenaAllocator_bytesAvailable (const GblArenaAllocator *pSelf) |
size_t | GblArenaAllocator_totalCapacity (const GblArenaAllocator *pSelf) |
size_t | GblArenaAllocator_fragmentedBytes (const GblArenaAllocator *pSelf) |
float | GblArenaAllocator_utilization (const GblArenaAllocator *pSelf) |
void | GblArenaAllocator_saveState (const GblArenaAllocator *pSelf, GblArenaAllocatorState *pState) |
GBL_RESULT | GblArenaAllocator_loadState (GblArenaAllocator *pSelf, const GblArenaAllocatorState *pState) |
void * | GblArenaAllocator_alloc (GblArenaAllocator *pSelf, size_t size, size_t alignment) |
GBL_RESULT | GblArenaAllocator_freeAll (GblArenaAllocator *pSelf) |
GblArenaAllocator zone/region/area-based allocator + API.
Arena/zone/region/area-based paged allocator.
GblArenaAllocator is a custom allocator which is useful for when you are allocating a bunch of data dynamically which all has the same shared lifetime. The allocator is created once, then as allocations are requested, it only allocates new memory in per-page incremements rather than for individual allocations. Finally, when you're done, rather than calling delete, you simply destruct the allocator, which frees its pages all at once. This can be SUBSTANTIALLY faster than calling malloc() or new for backing data structures with such allocation patterns.
Definition in file gimbal_arena_allocator.h.
#define GBL_ARENA_ALLOCATOR_TYPE |
Type UUID for GblArenaAllocator.
Definition at line 20 of file gimbal_arena_allocator.h.
#define GBL_ARENA_ALLOCATOR | ( | self | ) |
Cast a GblInstance to GblArenaAllocator.
Definition at line 21 of file gimbal_arena_allocator.h.
#define GBL_ARENA_ALLOCATOR_CLASS | ( | klass | ) |
Cast a GblClass to GblArenaAllocatorClass.
Definition at line 22 of file gimbal_arena_allocator.h.
#define GBL_ARENA_ALLOCATOR_GET_CLASS | ( | self | ) |
Get a GblArenaAllocatorClass from a GblInstance.
Definition at line 23 of file gimbal_arena_allocator.h.
#define GblArenaAllocator_construct | ( | ... | ) |
Definition at line 148 of file gimbal_arena_allocator.h.
#define GblArenaAllocator_alloc | ( | ... | ) |
Definition at line 149 of file gimbal_arena_allocator.h.