Foundation
Loading...
Searching...
No Matches
AllocatorHeap.hpp
Go to the documentation of this file.
1#pragma once
2#include "Allocator.hpp"
3#include "Atomic.hpp"
4
5namespace Foundation::Core {
14 class AllocatorHeap : public Allocator {
15 public:
16 pointer Allocate(size_type size, size_t alignment) override;
17 void Deallocate(pointer ptr) override;
18 pointer Reallocate(pointer ptr, size_type new_size, size_t alignment) override;
22 void QueryBudget(size_t& used, size_t& budget) const override;
23 size_t QueryHeapUsage() const override;
24 private:
26 };
27}
General purpose heap allocator.
Definition AllocatorHeap.hpp:14
pointer Allocate(size_type size, size_t alignment) override
Definition AllocatorHeap.cpp:39
pointer Reallocate(pointer ptr, size_type new_size, size_t alignment) override
Definition AllocatorHeap.cpp:52
size_t QueryHeapUsage() const override
Definition AllocatorHeap.cpp:93
void QueryBudget(size_t &used, size_t &budget) const override
Definition AllocatorHeap.cpp:79
Atomic< size_t > mHeapUsage
Definition AllocatorHeap.hpp:25
void Deallocate(pointer ptr) override
Definition AllocatorHeap.cpp:97
General Purpose Allocator (GPA) interface.
Definition Allocator.hpp:24
Lock-free atomic primitives and implementations of data structures.
Definition Allocator.hpp:5
std::size_t size_type
Definition Allocator.hpp:6
std::atomic< T > Atomic
Alias of std::atomic<T>.
Definition Atomic.hpp:26
void * pointer
Definition Allocator.hpp:7
T * Construct(Allocator *resource, Args &&...args)
Convenience placement new with object of type T using a Foundation::Core::Allocator.
Definition Allocator.hpp:153