#include <monoallocator.hpp>
Internal type defining an allocated chunk of memory. The allocation space is found behind this object itself as it is placed at the start of each allocated chunk.
Definition at line 101 of file monoallocator.hpp.
|
char * | act |
| Pointer to the free space in the chunk.
|
|
char * | end |
| Pointer to the first byte behind the chunk.
|
|
Chunk * | previous |
| the previously allocated chunk.
|
|
◆ Chunk()
Defaulted default constructor
◆ alloc() [1/2]
Templated version of alloc(size_t, size_t). Used with sizes and alignment known at compile-time.
- Template Parameters
-
requestedSize | The size to allocate. |
alignment | The necessary alignment. |
- Returns
nullptr
on failure, otherwise pointer to the requested memory.
Definition at line 188 of file monoallocator.hpp.
◆ alloc() [2/2]
Returns a pointer to an aligned piece of memory of the requested size inside this chunk. If there is not enough space left, nullptr
is returned.
- Parameters
-
requestedSize | The size to allocate. |
alignment | The necessary alignment. |
- Returns
nullptr
on failure, otherwise pointer to the requested memory.
Definition at line 166 of file monoallocator.hpp.
◆ create()
Allocates a chunk of memory of a size so that an instance of this class as well as the desired minimum size minSize plus alignment bytes are all fitting in.
This memory is not freed with a destructor. Instead, the allocated chunk that objects of this type reside in has to be deleted by invoking method destruct.
- Parameters
-
size | The minimum size (of the usable part) of the chunk of memory allocate, taking the maximum possible alignment space into account. |
- Returns
- An new allocated and internally linked chunk of memory.
Definition at line 121 of file monoallocator.hpp.
◆ destruct()
Deletes the allocated chunk and with it, this object itself.
Definition at line 141 of file monoallocator.hpp.
◆ reset()
"Frees" all allocated memory, by simply resetting the fill marker of the this chunk to the first usable byte of the allocated chunk.
Definition at line 150 of file monoallocator.hpp.
The documentation for this struct was generated from the following file: