Basic memory pool for efficient allocation and deallocation of objects of the same type. More...
#include <mitsuba/core/mempool.h>
Public Member Functions | |
BasicMemoryPool (size_t nEntries=128) | |
Create a new memory pool with an initial set of 128 entries. More... | |
~BasicMemoryPool () | |
Destruct the memory pool and release all entries. More... | |
T * | alloc () |
Acquire an entry. More... | |
void | assertNotContained (T *ptr) |
void | release (T *ptr) |
Release an entry. More... | |
size_t | size () const |
Return the total size of the memory pool. More... | |
bool | unused () const |
Check if every entry has been released. More... | |
std::string | toString () const |
Return a human-readable description. More... | |
Basic memory pool for efficient allocation and deallocation of objects of the same type.
This class attempts to keep most instances contiguous in memory, while having only minimal interaction with the underlying allocator.
|
inline |
Create a new memory pool with an initial set of 128 entries.
|
inline |
Destruct the memory pool and release all entries.
|
inline |
Acquire an entry.
|
inline |
|
inline |
Release an entry.
|
inline |
Return the total size of the memory pool.
|
inline |
Return a human-readable description.
|
inline |
Check if every entry has been released.