|
LiteFX 0.5.1.2025
Computer Graphics Engine
|
Represents a virtual allocator that manages memory distribution from a piece of raw memory. More...
#include <rendering_api.hpp>
Classes | |
| struct | Allocation |
| Represents an allocation within the memory managed by the virtual allocator. More... | |
Public Member Functions | |
| VirtualAllocator (const VirtualAllocator &)=delete | |
| VirtualAllocator (VirtualAllocator &&) noexcept=delete | |
| VirtualAllocator & | operator= (const VirtualAllocator &)=delete |
| VirtualAllocator & | operator= (VirtualAllocator &&) noexcept=delete |
| ~VirtualAllocator () noexcept=default | |
| UInt64 | size () const noexcept |
| Returns the size of the memory managed by the virtual allocator. | |
| AllocationAlgorithm | algorithm () const noexcept |
| Returns the algorithm used by the allocator. | |
| Allocation | allocate (UInt64 size, UInt32 alignment=1u, AllocationStrategy strategy=AllocationStrategy::OptimizePacking, void *privateData=nullptr) const |
| Allocates a piece of memory of size bytes, aligned to alignment . | |
| void | free (Allocation &&allocation) const |
| Releases an allocation from the allocator, so that its memory can be re-used later. | |
| void * | privateData (const Allocation &allocation) const |
| Returns the private data associated with an allocation. | |
Static Public Member Functions | |
| template<typename TBackend > | |
| static VirtualAllocator | create (UInt64 overallMemory, AllocationAlgorithm algorithm=AllocationAlgorithm::Default) |
| Creates a new virtual allocator instance. | |
Represents a virtual allocator that manages memory distribution from a piece of raw memory.
Note that the virtual allocator does not actually contain memory, but rather keeps track over a range of memory that is externally managed.
|
delete |
|
deletenoexcept |
|
defaultnoexcept |
|
inlinenoexcept |
Returns the algorithm used by the allocator.
|
inlinenodiscard |
Allocates a piece of memory of size bytes, aligned to alignment .
| size | The size (in bytes) of the resource to place in the allocation. |
| alignment | The alignment requirements of the resource. |
| strategy | The strategy to look for a place to put the allocation in. |
| privateData | A pointer to an object that should be internally associated with the allocation. |
|
inlinestaticnodiscard |
Creates a new virtual allocator instance.
| overallMemory | The overall size (in bytes) of memory available to the allocator. |
| algorithm | The algorithm used to find a suitable block in the allocator memory. |
|
inline |
Releases an allocation from the allocator, so that its memory can be re-used later.
Releasing an allocation that was not allocated from the virtual allocator is undefined behavior.
| allocation | The allocation to release. |
|
delete |
|
deletenoexcept |
|
inline |
Returns the private data associated with an allocation.
| allocation | The allocation for which to obtain the private data. |
|
inlinenoexcept |
Returns the size of the memory managed by the virtual allocator.