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 93 of file monoallocator.hpp.
#include <monoallocator.hpp>
Public Static Method Index: | |
static ALIB_FORCE_INLINE Chunk * | create (size_t size) |
Public Field Index: | |
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. | |
Public Method Index: | |
Chunk ()=default | |
template<size_t requestedSize, size_t alignment> | |
ALIB_FORCE_INLINE char * | alloc () |
ALIB_FORCE_INLINE char * | alloc (size_t requestedSize, size_t alignment) |
void | destruct () |
void | reset () |
char* act |
Pointer to the free space in the chunk.
Definition at line 96 of file monoallocator.hpp.
char* end |
Pointer to the first byte behind the chunk.
Definition at line 97 of file monoallocator.hpp.
Chunk* previous |
the previously allocated chunk.
Definition at line 95 of file monoallocator.hpp.
|
default |
Defaulted default constructor
|
inline |
Templated version of alloc(size_t, size_t). Used with sizes and alignment known at compile-time.
requestedSize | The size to allocate. |
alignment | The necessary alignment. |
nullptr
on failure, otherwise pointer to the requested memory. Definition at line 180 of file monoallocator.hpp.
|
inline |
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.
requestedSize | The size to allocate. |
alignment | The necessary alignment. |
nullptr
on failure, otherwise pointer to the requested memory. Definition at line 158 of file monoallocator.hpp.
|
inlinestatic |
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.
size | The minimum size (of the usable part) of the chunk of memory allocate, taking the maximum possible alignment space into account. |
Definition at line 113 of file monoallocator.hpp.
|
inline |
Deletes the allocated chunk and with it, this object itself.
Definition at line 133 of file monoallocator.hpp.
|
inline |
"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 142 of file monoallocator.hpp.