A MemoryAllocator implementation using a finite slice of memory. More...
#include <Memory.h>
Public Member Functions | |
| FixedAllocator (void *memory, size_t capacityBytes) | |
| const void * | data () const |
| size_t | size () const |
| size_t | capacity () const |
Public Member Functions inherited from SC::MemoryAllocator | |
| 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. | |
Protected Member Functions | |
| 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. | |
| virtual void | releaseImpl (void *memory) override |
| Release virtual function to be reimplemented. | |
Protected Attributes | |
| void * | memory = nullptr |
| size_t | capacityBytes = 0 |
| void * | lastAllocation = nullptr |
| size_t | lastAllocatedSize = 0 |
| size_t | position = 0 |
Additional Inherited Members | |
Public Attributes inherited from SC::MemoryAllocator | |
| Statistics | statistics |
| Holds statistics about how many allocations/release have been issued. | |
A MemoryAllocator implementation using a finite slice of memory.
|
overrideprotectedvirtual |
Allocate virtual function to be reimplemented.
| 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 |
false if the passed not-null owner doesn't belong to this allocator or the allocation itself fails Implements SC::MemoryAllocator.
Reimplemented in SC::VirtualAllocator.
|
overrideprotectedvirtual |
Re-allocate virtual function to be reimplemented.
Implements SC::MemoryAllocator.
Reimplemented in SC::VirtualAllocator.
|
overrideprotectedvirtual |
Release virtual function to be reimplemented.
Implements SC::MemoryAllocator.