A MemoryAllocator implementation based on a growable slice of VirtualMemory.
More...
#include <VirtualMemory.h>
|
|
| VirtualAllocator (VirtualMemory &virtualMemory) |
| |
|
| FixedAllocator (void *memory, size_t capacityBytes) |
| |
|
const void * | data () const |
| |
|
size_t | size () const |
| |
|
size_t | capacity () const |
| |
| template<typename T , typename... U> |
| T * | create (U &&... u) |
| | Allocate and construct an object of type T using this allocator.
|
| |
| void * | allocate (const void *owner, size_t numBytes, size_t alignment) |
| | Allocates numBytes bytes of memory.
|
| |
| void * | reallocate (void *memory, size_t numBytes) |
| | Change size of already allocated memory block.
|
| |
| void | release (void *memory) |
| | Free memory allocated by MemoryAllocator::allocate and / or reallocated by MemoryAllocator::reallocate.
|
| |
|
| virtual void * | allocateImpl (const void *owner, size_t numBytes, size_t alignment) override |
| | Allocate virtual function to be reimplemented.
|
| |
| virtual void * | reallocateImpl (void *memory, size_t numBytes) override |
| | Re-allocate virtual function to be reimplemented.
|
| |
|
void | syncFixedAllocator () |
| |
| virtual void | releaseImpl (void *memory) override |
| | Release virtual function to be reimplemented.
|
| |
|
|
VirtualMemory & | virtualMemory |
| |
|
void * | memory = nullptr |
| |
|
size_t | capacityBytes = 0 |
| |
|
void * | lastAllocation = nullptr |
| |
|
size_t | lastAllocatedSize = 0 |
| |
|
size_t | position = 0 |
| |
A MemoryAllocator implementation based on a growable slice of VirtualMemory.
◆ allocateImpl()
| virtual void * SC::VirtualAllocator::allocateImpl |
( |
const void * | owner, |
|
|
size_t | numBytes, |
|
|
size_t | alignment ) |
|
overrideprotectedvirtual |
Allocate virtual function to be reimplemented.
- Parameters
-
| owner | Can be nullptr or an address belonging to a previous allocation of this allocator |
| numBytes | How many bytes to allocate |
| alignment | Alignment of the allocation |
- Returns
false if the passed not-null owner doesn't belong to this allocator or the allocation itself fails
Reimplemented from SC::FixedAllocator.
◆ reallocateImpl()
| virtual void * SC::VirtualAllocator::reallocateImpl |
( |
void * | memory, |
|
|
size_t | numBytes ) |
|
overrideprotectedvirtual |
The documentation for this struct was generated from the following file: