HTGS
v2.0
The Hybrid Task Graph Scheduler
|
Abstract class that describes how memory is allocated and freed. More...
#include <htgs/api/IMemoryAllocator.hpp>
Public Member Functions | |
IMemoryAllocator (size_t size) | |
Creates a memory allocator. More... | |
virtual | ~IMemoryAllocator () |
Destructor. | |
virtual T * | memAlloc (size_t size)=0 |
Pure virtual function that allocates a piece of memory with a specific size. More... | |
virtual T * | memAlloc ()=0 |
Pure virtual function that allocates a piece of memory. More... | |
virtual void | memFree (T *&memory)=0 |
Pure virtual function the frees memory. More... | |
Public Member Functions inherited from htgs::AnyMemoryAllocator | |
AnyMemoryAllocator (size_t size) | |
Creates a memory allocator. More... | |
virtual | ~AnyMemoryAllocator () |
Destructor. | |
size_t | size () const |
Gets the size. More... | |
Abstract class that describes how memory is allocated and freed.
This class is used in conjunction with TaskGraphConf::addMemoryManagerEdge and is required in order to define how a MemoryManager allocates memory for its memory pool.
If the memory allocator is to be shared among multiple memory managers, then the allocator must be wrapped into a std::shared_ptr.
Example implementation:
Example usage:
T | the memory type |
|
inline |
Creates a memory allocator.
size | the number of elements to allocate |
|
pure virtual |
Pure virtual function that allocates a piece of memory with a specific size.
|
pure virtual |
Pure virtual function that allocates a piece of memory.
|
pure virtual |
Pure virtual function the frees memory.
memory | the memory to be freed |