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 63 of file monoallocator.hpp.
#include <monoallocator.hpp>
|
static constexpr unsigned char | CLEAR = 0xF1 |
|
static constexpr unsigned char | MAGIC = 0xA1 |
|
|
static constexpr size_t | firstOffset (size_t firstObject, size_t alignment) |
|
|
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.
|
|
◆ act
◆ CLEAR
unsigned char CLEAR = 0xF1 |
|
staticconstexpr |
◆ end
◆ MAGIC
unsigned char MAGIC = 0xA1 |
|
staticconstexpr |
◆ previous
◆ Buffer()
Initializes the members of this buffer to reflect the given size.
- Parameters
-
size | The size of the given mem. |
Definition at line 92 of file monoallocator.hpp.
◆ allocate()
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.
- Parameters
-
size | The size to allocate. |
alignment | The necessary alignment. |
- Returns
nullptr
on failure, otherwise pointer to the requested memory.
Definition at line 131 of file monoallocator.hpp.
◆ firstOffset()
static constexpr size_t firstOffset |
( |
size_t | firstObject, |
|
|
size_t | alignment ) |
|
inlinestaticconstexpr |
Returns the first offset of an object with given alignment behind an object with. smaller alignment.
- Parameters
-
firstObject | The allocation size of the first object allocated in a buffer. |
alignment | The allocation alignment of the first object allocated in a buffer. |
- Returns
- The value to add to the allocation size to ensure that an object with a certain alignment fits after placing firstObject at the start..
Definition at line 84 of file monoallocator.hpp.
◆ reset()
"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 112 of file monoallocator.hpp.
◆ Size()
The documentation for this struct was generated from the following file: