Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::BasicMemoryPool< T > Class Template Reference

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...
 

Detailed Description

template<typename T>
class mitsuba::BasicMemoryPool< T >

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.

Constructor & Destructor Documentation

template<typename T>
mitsuba::BasicMemoryPool< T >::BasicMemoryPool ( size_t  nEntries = 128)
inline

Create a new memory pool with an initial set of 128 entries.

template<typename T>
mitsuba::BasicMemoryPool< T >::~BasicMemoryPool ( )
inline

Destruct the memory pool and release all entries.

Member Function Documentation

template<typename T>
T* mitsuba::BasicMemoryPool< T >::alloc ( )
inline

Acquire an entry.

template<typename T>
void mitsuba::BasicMemoryPool< T >::assertNotContained ( T *  ptr)
inline
template<typename T>
void mitsuba::BasicMemoryPool< T >::release ( T *  ptr)
inline

Release an entry.

template<typename T>
size_t mitsuba::BasicMemoryPool< T >::size ( ) const
inline

Return the total size of the memory pool.

template<typename T>
std::string mitsuba::BasicMemoryPool< T >::toString ( ) const
inline

Return a human-readable description.

template<typename T>
bool mitsuba::BasicMemoryPool< T >::unused ( ) const
inline

Check if every entry has been released.


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