13 #ifndef HTGS_MEMORYPOOL_HPP 14 #define HTGS_MEMORYPOOL_HPP 47 this->
allMemory =
new std::list<m_data_t<T>>();
83 HTGS_DEBUG(
"Inserting " << remainingSize <<
" elements to memory pool");
85 for (
size_t i = 0; i < remainingSize; i++) {
96 std::shared_ptr<MemoryData<T>> shrMem = std::shared_ptr<MemoryData<T>>(newMemory);
121 for (
size_t i = 0; i < poolSize; i++) {
153 #endif //HTGS_MEMORYPOOL_HPP m_data_t< T > getMemory() const
Gets the next piece of memory from the MemoryPool.
Definition: MemoryPool.hpp:133
T remove()
Removes an element from the queue.
Definition: BlockingQueue.hpp:114
MemoryData< T > * copy()
Creates a copy of this MemoryData.
Definition: MemoryData.hpp:267
MemoryPool(size_t queueSize)
Creates a memory pool with the specified size number of elements.
Definition: MemoryPool.hpp:45
void memAlloc()
Allocates the memory that this MemoryData is using.
Definition: MemoryData.hpp:193
bool isEmpty()
Gets whether the queue is empty or not.
Definition: BlockingQueue.hpp:93
#define HTGS_DEBUG_VERBOSE(msg)
Prints a debug message to std:cerr with VERBOSE level.
Definition: debug_message.hpp:75
Describes memory allocated by a MemoryManager to manage shared memory across multiple ITask...
Definition: ICudaTask.hpp:28
size_t size()
Gets the number of elements in the queue.
Definition: BlockingQueue.hpp:101
Creates a thread-safe queue that will wait when no data is available and can block if the queue is fu...
Definition: BlockingQueue.hpp:32
Creates a pool of memory that allocates/frees MemoryData.
Definition: MemoryPool.hpp:39
size_t queueSize
The size of the memory queue.
Definition: MemoryPool.hpp:148
Implements a thread-safe BlockingQueue.
MemoryPool< T > * copy()
Creates a shallow copy of the MemoryPool.
Definition: MemoryPool.hpp:106
void Enqueue(T const &value)
Adds an element into the queue.
Definition: BlockingQueue.hpp:126
~MemoryPool()
Destructor, deallocates all memory allocated by the MemoryPool.
Definition: MemoryPool.hpp:54
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...
Definition: MemoryPool.hpp:80
#define HTGS_DEBUG(msg)
Prints a debug message to std::cerr with standard level If DEBUG_FLAG is not defined, this equates to a no op Each message includes the file and line number for where the debug is called.
Definition: debug_message.hpp:65
T Dequeue()
Removes an element from the queue.
Definition: BlockingQueue.hpp:162
std::list< m_data_t< T > > * allMemory
The list of all memory that has been allocated by the memory pool.
Definition: MemoryPool.hpp:146
Defines common types used throughout the HTGS API and some of which that are used by users of HTGS su...
size_t remainingCapacity()
Gets the remaining capacity of the queue based on the queueSize.
Definition: BlockingQueue.hpp:79
void emptyPool(bool free) const
Empties the memory pool releasing memory that had been allocated.
Definition: MemoryPool.hpp:119
void addMemory(m_data_t< T > o) const
Adds memory back into the MemoryPool.
Definition: MemoryPool.hpp:141
BlockingQueue< m_data_t< T > > * memoryQueue
A blocking queue for getting/recycling memory.
Definition: MemoryPool.hpp:147
bool isPoolEmpty() const
Gets whether the pool is empty or not.
Definition: MemoryPool.hpp:114
std::shared_ptr< MemoryData< V > > m_data_t
Defines a shared pointer to htgs::MemoryData.
Definition: Types.hpp:101
void releaseAllMemory()
Releases all memory associated with this memory pool.
Definition: MemoryPool.hpp:66
Definition: Bookkeeper.hpp:23
Provides functionality for debug messaging.
void setPipelineId(size_t id)
Sets the pipelineId associated with the MemoryManager that allocated the memory.
Definition: MemoryData.hpp:132