The Pedigree Project  0.1
Public Member Functions | Private Attributes | List of all members
ObjectPool< T, poolSize > Class Template Reference

#include <ObjectPool.h>

+ Inheritance diagram for ObjectPool< T, poolSize >:
+ Collaboration diagram for ObjectPool< T, poolSize >:

Public Member Functions

template<typename... Args>
T * allocate (Args...args)
 
void deallocate (T *object)
 

Private Attributes

Vector< T * > m_Pool
 
Spinlock m_Spinlock
 

Detailed Description

template<class T, size_t poolSize = 16>
class ObjectPool< T, poolSize >

Todo:
add a MemoryPressureHandler here.

ObjectPool manages a set of objects for rapid allocation and deallocation, which is particularly useful for objects which are used frequently (e.g. nodes in a list).

If no objects are available (none have been deallocated yet), new objects are allocated from the heap.

Definition at line 42 of file ObjectPool.h.


The documentation for this class was generated from the following file: