libMesh::PoolAllocator< T > Class Template Reference

#include <pool_allocator.h>

Inheritance diagram for libMesh::PoolAllocator< T >:

Classes

struct  rebind
 

Public Member Functions

 PoolAllocator ()
 
 PoolAllocator (const PoolAllocator &o)
 
 PoolAllocator ()
 
 PoolAllocator (const PoolAllocator &o)
 

Static Public Member Functions

static bool release_memory ()
 
static bool purge_memory ()
 
static bool release_memory ()
 
static bool purge_memory ()
 

Detailed Description

template<typename T>
class libMesh::PoolAllocator< T >

An allocator which can be used in standard containers. Uses pool-based memory allocation to efficiently allocate many small objects. Note that object destruction returns memory to the pool rather than deallocate it. It must be explicitly deallocated prior to program termination.

An allocator which can be used in standard containers. A wrapper for std::allocator<> when Boost is not available.

Definition at line 47 of file pool_allocator.h.

Constructor & Destructor Documentation

template<typename T >
libMesh::PoolAllocator< T >::PoolAllocator ( )
inline

Definition at line 60 of file pool_allocator.h.

60  :
61  boost::pool_allocator<T>()
62  {}
template<typename T >
libMesh::PoolAllocator< T >::PoolAllocator ( const PoolAllocator< T > &  o)
inlineexplicit

Definition at line 64 of file pool_allocator.h.

64  :
65  boost::pool_allocator<T>(o)
66  {}
template<typename T >
libMesh::PoolAllocator< T >::PoolAllocator ( )
inline

Definition at line 158 of file pool_allocator.h.

158  :
159  std::allocator<T>()
160  {}
template<typename T >
libMesh::PoolAllocator< T >::PoolAllocator ( const PoolAllocator< T > &  o)
inlineexplicit

Definition at line 162 of file pool_allocator.h.

162  :
163  std::allocator<T>(o)
164  {}

Member Function Documentation

template<typename T >
static bool libMesh::PoolAllocator< T >::purge_memory ( )
inlinestatic

Frees every memory block. This function invalidates any pointers previously returned by allocation functions. Returns true if at least one memory block was freed.

Definition at line 81 of file pool_allocator.h.

82  {
83  return boost::singleton_pool<boost::pool_allocator_tag, sizeof(T)>::purge_memory();
84  }
template<typename T >
static bool libMesh::PoolAllocator< T >::purge_memory ( )
inlinestatic

Frees every memory block. This function invalidates any pointers previously returned by allocation functions. Returns true if at least one memory block was freed.

Definition at line 176 of file pool_allocator.h.

176 { /* no-op for std::allocator<> - already freed. */ return false; }
template<typename T >
static bool libMesh::PoolAllocator< T >::release_memory ( )
inlinestatic

Frees every memory block that doesn't have any allocated chunks. Returns true if at least one memory block was freed.

Definition at line 72 of file pool_allocator.h.

73  {
74  return boost::singleton_pool<boost::pool_allocator_tag, sizeof(T)>::release_memory();
75  }
template<typename T >
static bool libMesh::PoolAllocator< T >::release_memory ( )
inlinestatic

Frees every memory block that doesn't have any allocated chunks. Returns true if at least one memory block was freed.

Definition at line 170 of file pool_allocator.h.

170 { /* no-op for std::allocator<> - already freed. */ return false; }

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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:01 UTC

Hosted By:
SourceForge.net Logo