Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AMP::MemoryPool< TYPE, INT_TYPE > Class Template Referencefinal

Pool allocator. More...

#include <MemoryPool.h>

Public Member Functions

TYPE * allocate ()
 Allocate an object.
 
void free (TYPE *ptr)
 Insert an item.
 
 MemoryPool (size_t size)
 Default constructor.
 
 ~MemoryPool ()
 destructor
 

Private Member Functions

 MemoryPool (const MemoryPool &)
 
MemoryPooloperator= (const MemoryPool &)
 

Private Attributes

volatile AtomicOperations::int32_atomic d_next
 
volatile TYPE * d_objects
 

Detailed Description

template<class TYPE, class INT_TYPE = int>
class AMP::MemoryPool< TYPE, INT_TYPE >

Pool allocator.

This class implements a basic fast pool allocator that is thread-safe.

Definition at line 14 of file MemoryPool.h.

Constructor & Destructor Documentation

◆ MemoryPool() [1/2]

template<class TYPE , class INT_TYPE = int>
AMP::MemoryPool< TYPE, INT_TYPE >::MemoryPool ( size_t  size)
explicit

Default constructor.

◆ ~MemoryPool()

template<class TYPE , class INT_TYPE = int>
AMP::MemoryPool< TYPE, INT_TYPE >::~MemoryPool ( )

destructor

◆ MemoryPool() [2/2]

template<class TYPE , class INT_TYPE = int>
AMP::MemoryPool< TYPE, INT_TYPE >::MemoryPool ( const MemoryPool< TYPE, INT_TYPE > &  )
private

Member Function Documentation

◆ allocate()

template<class TYPE , class INT_TYPE = int>
TYPE * AMP::MemoryPool< TYPE, INT_TYPE >::allocate ( )
inline

Allocate an object.

Allocates a new object from the pool

Returns
Return the new pointer, or nullptr if there is no more room in the pool

◆ free()

template<class TYPE , class INT_TYPE = int>
void AMP::MemoryPool< TYPE, INT_TYPE >::free ( TYPE *  ptr)
inline

Insert an item.

Insert an item into the list

Parameters
ptrThe pointer to free

◆ operator=()

template<class TYPE , class INT_TYPE = int>
MemoryPool & AMP::MemoryPool< TYPE, INT_TYPE >::operator= ( const MemoryPool< TYPE, INT_TYPE > &  )
private

Member Data Documentation

◆ d_next

template<class TYPE , class INT_TYPE = int>
volatile AtomicOperations::int32_atomic AMP::MemoryPool< TYPE, INT_TYPE >::d_next
private

Definition at line 40 of file MemoryPool.h.

◆ d_objects

template<class TYPE , class INT_TYPE = int>
volatile TYPE* AMP::MemoryPool< TYPE, INT_TYPE >::d_objects
private

Definition at line 39 of file MemoryPool.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page