Internal type defining a memory buffer. The allocation space is found behind this object itself as it is placed at the start of each allocated buffer.
Definition at line 25 of file monoallocator.inl.
Public Static Field Index: | |
static constexpr unsigned char | CLEAR = 0xF1 |
static constexpr unsigned char | MAGIC = 0xA1 |
Public Static Method Index: | |
static constexpr size_t | firstOffset (size_t firstObject, size_t alignment) |
Public Field Index: | |
char * | act |
Pointer to the next free space in the buffer. | |
char * | end |
Pointer to the first byte behind the buffer. | |
Buffer * | previous |
the previously allocated buffer. | |
Public Method Index: | |
Buffer ()=default | |
Defaulted default constructor. | |
Buffer (size_t size) | |
char * | allocate (size_t size, size_t alignment) |
void | reset () |
size_t | Size () |
char* alib::monomem::detail::Buffer::act |
Pointer to the next free space in the buffer.
Definition at line 36 of file monoallocator.inl.
|
staticconstexpr |
A magic byte written when memory is freed.
Definition at line 34 of file monoallocator.inl.
char* alib::monomem::detail::Buffer::end |
Pointer to the first byte behind the buffer.
Definition at line 37 of file monoallocator.inl.
|
staticconstexpr |
A magic byte, used with the compiler-symbol ALIB_DEBUG_ALLOCATIONS to mark memory and detect out-of-bounds writes.
Definition at line 30 of file monoallocator.inl.
Buffer* alib::monomem::detail::Buffer::previous |
the previously allocated buffer.
Definition at line 38 of file monoallocator.inl.
|
inline |
Initializes the members of this buffer to reflect the given size.
size | The size of the given mem. |
Definition at line 53 of file monoallocator.inl.
|
inline |
Returns a pointer to an aligned piece of memory of the requested size inside this buffer. If there is not enough space left, nullptr
is returned.
size | The size to allocate. |
alignment | The necessary alignment. |
nullptr
on failure, otherwise pointer to the requested memory. Definition at line 87 of file monoallocator.inl.
|
inlinestaticconstexpr |
Returns the first offset of an object with given alignment behind an object with. smaller alignment.
firstObject | The allocation size of the first object allocated in a buffer. |
alignment | The allocation alignment of the first object allocated in a buffer. |
Definition at line 46 of file monoallocator.inl.
|
inline |
"Frees" all allocated memory, by simply resetting the fill marker of the this buffer to the first usable byte of the allocated buffer.
Definition at line 71 of file monoallocator.inl.
|
inline |
Definition at line 65 of file monoallocator.inl.