![]() |
HTGS
v2.0
The Hybrid Task Graph Scheduler
|
Creates a pool of memory that allocates/frees MemoryData. More...
#include <htgs/core/memory/MemoryPool.hpp>
Public Member Functions | |
MemoryPool (size_t queueSize) | |
Creates a memory pool with the specified size number of elements. More... | |
~MemoryPool () | |
Destructor, deallocates all memory allocated by the MemoryPool. | |
void | releaseAllMemory () |
Releases all memory associated with this memory pool. | |
void | fillPool (MemoryData< T > *memory, size_t pipelineId, bool allocate) const |
Fills the pool with memory and specifies the pipelineId to be associated with the MemoryData. More... | |
MemoryPool< T > * | copy () |
Creates a shallow copy of the MemoryPool. More... | |
bool | isPoolEmpty () const |
Gets whether the pool is empty or not. More... | |
void | emptyPool (bool free) const |
Empties the memory pool releasing memory that had been allocated. | |
m_data_t< T > | getMemory () const |
Gets the next piece of memory from the MemoryPool. More... | |
void | addMemory (m_data_t< T > o) const |
Adds memory back into the MemoryPool. More... | |
Private Attributes | |
std::list< m_data_t< T > > * | allMemory |
The list of all memory that has been allocated by the memory pool. | |
BlockingQueue< m_data_t< T > > * | memoryQueue |
A blocking queue for getting/recycling memory. | |
size_t | queueSize |
The size of the memory queue. | |
Creates a pool of memory that allocates/frees MemoryData.
Currently the memory pool is static and cannot grow dynamically, although dynamic memory allocation can be added in the future, for the GPU it is better to preallocate the memory prior to execution to avoid unnecessary GPU synchronization.
|
inline |
Creates a memory pool with the specified size number of elements.
queueSize | the number of elements in the memory pool. |
|
inline |
Adds memory back into the MemoryPool.
o | the memory to be added in. |
|
inline |
Creates a shallow copy of the MemoryPool.
|
inline |
Fills the pool with memory and specifies the pipelineId to be associated with the MemoryData.
memory | the memory that is allocated. |
pipelineId | the pipelineId associated with the memory. |
allocate | whether to allocate the memory before adding |
|
inline |
Gets the next piece of memory from the MemoryPool.
|
inline |
Gets whether the pool is empty or not.
TRUE | if the pool is empty |
FALSE | if the pool is not empty |