|
Foundation
|
Implements an atomic stack-based bump allocator. More...
#include <StackAllocator.hpp>
Public Member Functions | |
| StackAllocator ()=default | |
| StackAllocator (Arena arena) | |
| void | Reset (Arena arena) |
| Resets the stack allocator to the initial state, allowing for reuse of the memory block (Arena) | |
| void | Reset () |
| Resets the stack allocator to a non-allocated state. | |
| pointer | Allocate (size_type size, size_type alignment) override |
| Allocates a block of memory of the specified size with alignment. If the requested size exceeds the available memory within the arena, returns nullptr. | |
| void | Deallocate (pointer ptr) override |
| void | Deallocate (pointer ptr, size_type size) override |
| pointer | Reallocate (pointer ptr, size_type new_size, size_t alignment) override |
| constexpr | operator bool () const noexcept |
Public Member Functions inherited from Foundation::Core::Allocator | |
| virtual | ~Allocator ()=default |
| virtual pointer | Allocate (size_type size, size_t alignment=alignof(std::max_align_t))=0 |
| Arena | AllocateArena (size_type size, size_t alignment) |
| Arena | AllocateArena (size_type size) |
| void | DeallocateArena (Arena arena) |
| Allocator * | Ptr () |
Private Attributes | |
| pointer | mMemory { nullptr } |
| std::atomic< size_type > | mCurrent {} |
| size_type | mEnd {} |
Implements an atomic stack-based bump allocator.
|
default |
|
inline |
Allocates a block of memory of the specified size with alignment. If the requested size exceeds the available memory within the arena, returns nullptr.
Implements Foundation::Core::Allocator.
|
inlineoverridevirtual |
Implements Foundation::Core::Allocator.
|
inlineoverridevirtual |
Implements Foundation::Core::Allocator.
|
inline |
Resets the stack allocator to a non-allocated state.
Resets the stack allocator to the initial state, allowing for reuse of the memory block (Arena)
|
private |
|
private |