The allocator interface.
More...
#include <IAllocator.h>
|
| IAllocator (const char *name, AllocateFunction allocFunc, ReallocateFunction reallocFunc, DeallocateFunction deallocFunc) |
|
| IAllocator (const char *name, AllocateFunction allocFunc, ReallocateFunction reallocFunc, DeallocateFunction deallocFunc, size_t size, void *base) |
|
void * | allocate (size_t bytes, uint8_t alignment) |
| Tries to allocate the specified amount of memory with the specified alignment requirement.
|
|
void * | allocate (size_t bytes) |
|
void * | reallocate (void *ptr, size_t bytes, uint8_t alignment) |
| Tries to reallocate the allocation at the specified pointer with a different size.
|
|
void * | reallocate (void *ptr, size_t bytes) |
|
void | deallocate (void *ptr) |
| Deallocates the allocation at the specified pointer.
|
|
const char * | name () const |
| Returns the name of the allocator.
|
|
size_t | size () const |
| Returns the size of the buffer used for allocations.
|
|
void * | base () const |
| Returns the address of the buffer used for allocations.
|
|
size_t | usedMemory () const |
|
size_t | freeMemory () const |
|
size_t | numAllocations () const |
| Returns the number of active allocations.
|
|
bool | copyOnReallocation () const |
| Returns the state of the copy on reallocation flag.
|
|
void | setCopyOnReallocation (bool value) |
| Sets the state of the copy on reallocation flag.
|
|
template<class T , typename... Args> |
T * | newObject (Args &&... args) |
|
template<class T > |
void | deleteObject (T *ptr) |
|
template<class T > |
T * | newArray (size_t numElements) |
|
template<class T > |
void | deleteArray (T *ptr) |
|
|
AllocateFunction | allocateFunc_ |
|
ReallocateFunction | reallocateFunc_ |
|
DeallocateFunction | deallocateFunc_ |
|
char | name_ [MaxNameLength] |
|
size_t | size_ |
|
void * | base_ |
|
size_t | usedMemory_ |
|
size_t | numAllocations_ |
|
bool | copyOnReallocation_ |
|
◆ freeMemory()
size_t nctl::IAllocator::freeMemory |
( |
| ) |
const |
|
inline |
Returns the amount of memory available in the buffer It can be less than the memory availble to allocations due to overhead or fragmentation */
◆ setCopyOnReallocation()
void nctl::IAllocator::setCopyOnReallocation |
( |
bool |
value | ) |
|
|
inline |
Sets the state of the copy on reallocation flag.
- Note
- When the flag is true a growing reallocation might move the data in a new place
◆ usedMemory()
size_t nctl::IAllocator::usedMemory |
( |
| ) |
const |
|
inline |
Returns the amount of memory in use
- Note
- It can be more than the memory used by allocations due to overhead */
The documentation for this class was generated from the following files: