herald
2.0.0
|
Very basic paged memory arena class. More...
#include <memory_arena.h>
Public Member Functions | |
void | reserve (MemoryArenaEntry &entry, std::size_t newSize) |
MemoryArenaEntry | allocate (std::size_t size) |
void | deallocate (MemoryArenaEntry &entry) |
void | set (const MemoryArenaEntry &entry, unsigned short bytePosition, unsigned char value) |
char | get (const MemoryArenaEntry &entry, unsigned short bytePosition) |
std::size_t | pagesFree () const |
Static Public Attributes | |
static constexpr std::size_t | Size = MaxSize |
The Maximum size to use for data (doesn't include page table) | |
static constexpr std::size_t | PageSize = AllocationSize |
The allocation size for each page. Note total mem usage is Size + (Size / PageSize) Thus for MemoryArena<2048,10>() you use 2048 + (2048 / 10) = 2253 bytes. | |
Very basic paged memory arena class.
Can be used one arena per dynamic allocation class, or used by multiple classes. In this non-global implementation, pass it as a static reference variable to the class once during application startup after allocation in a main class or similar.