|
Foundation
|
Implements a lock-free stack-based bump allocator. More...
#include <AllocatorStack.hpp>
Public Member Functions | |
| AllocatorStack ()=default | |
| AllocatorStack (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 |
| pointer | Reallocate (pointer ptr, size_type new_size, size_t alignment) override |
| constexpr | operator bool () const noexcept |
| void | QueryBudget (size_t &used, size_t &budget) const override |
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} |
| Atomic< size_type > | mCurrent {} |
| size_type | mEnd {} |
Implements a lock-free 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 |