AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agx::MemoryPool< T > Class Template Reference

Memory pool. More...

#include <MemoryPool.h>

+ Inheritance diagram for agx::MemoryPool< T >:

Public Member Functions

 MemoryPool (const char *name="MemoryPool", uint32_t initialChunkSize=64)
 Constructor.
 
virtual ~MemoryPool ()
 Destructor.
 
T * allocate ()
 Allocates one element, no constructor called.
 
void clear ()
 Clears the memory pool and runs the destructor on every allocated object.
 
void clearFast ()
 Clears the memory pool without calling destructors.
 
T * create ()
 Allocates an element and calls its default constructor.
 
void deallocate (T *element)
 Deallocates one element, no destructor called.
 
virtual void deallocateVirtual (void *ptr)
 
void destroy (T *element)
 Deallocates an element and calls its destructor.
 
size_t size () const
 
- Public Member Functions inherited from agx::BatchAllocator
 BatchAllocator (const BatchAllocator &other)
 
 BatchAllocator (const char *name="BatchAllocator", uint32_t initialChunkSize=64)
 
 ~BatchAllocator ()
 
void * allocate (uint32_t numBytes)
 
void * allocate (uint32_t numBytes, uint32_t alignment)
 
void clear ()
 
void deallocate (void *buffer)
 
BatchAllocator & operator= (const BatchAllocator &other)
 
size_t size ()
 
- Public Member Functions inherited from agx::ByteAllocator
 ByteAllocator (const ByteAllocator &other)
 
 ByteAllocator (const char *name="ByteAllocator")
 
void * allocateBytes (size_t numBytes, size_t alignment=16)
 Allocate a memory section of specified alignment.
 
void deallocateBytes (void *buffer)
 
void deallocateBytes (void *buffer, size_t numBytes)
 Deallocate a section previously allocated using allocateBytes method.
 
const char * getName () const
 
ByteAllocator & operator= (const ByteAllocator &other)
 
void setContainer (class Container *)
 
- Public Member Functions inherited from agx::AbstractMemoryPool
virtual ~AbstractMemoryPool ()
 
virtual void deallocateVirtual (void *ptr)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::ByteAllocator
static void initMemory (void *data, size_t numBytes, agx::UInt32 pattern)
 
static void * standaloneAllocateBytes (size_t numBytes, size_t alignment=16)
 
static void standaloneDeallocateTypes (void *buffer)
 
- Static Public Attributes inherited from agx::ByteAllocator
static agx::UInt32 allocatedMemoryPattern
 
static agx::UInt32 deallocatedMemoryPattern
 
static bool initMemoryFlag
 
- Protected Member Functions inherited from agx::BatchAllocator
void createChunk (uint32_t size)
 
size_t deleteAllChunks ()
 
- Protected Attributes inherited from agx::BatchAllocator
uint32_t m_chunkSize
 
Chunk * m_firstChunk
 

Detailed Description

template<typename T>
class agx::MemoryPool< T >

Memory pool.

Definition at line 88 of file MemoryPool.h.

Constructor & Destructor Documentation

◆ MemoryPool()

template<typename T >
agx::MemoryPool< T >::MemoryPool ( const char *  name = "MemoryPool< T >",
uint32_t  initialChunkSize = 64 
)

Constructor.

Definition at line 553 of file MemoryPool.h.

References agxAssert.

◆ ~MemoryPool()

template<typename T >
agx::MemoryPool< T >::~MemoryPool
virtual

Destructor.

Definition at line 563 of file MemoryPool.h.

Member Function Documentation

◆ allocate()

template<typename T >
T * agx::MemoryPool< T >::allocate
inline

Allocates one element, no constructor called.

Definition at line 571 of file MemoryPool.h.

References agx::BatchAllocator::allocate(), and m_size.

◆ clear()

template<typename T >
void agx::MemoryPool< T >::clear

◆ clearFast()

template<typename T >
void agx::MemoryPool< T >::clearFast

Clears the memory pool without calling destructors.

Definition at line 697 of file MemoryPool.h.

References agxAssert1, agx::BatchAllocator::clear(), and m_size.

◆ create()

template<typename T >
T * agx::MemoryPool< T >::create
inline

Allocates an element and calls its default constructor.

Definition at line 585 of file MemoryPool.h.

◆ deallocate()

template<typename T >
void agx::MemoryPool< T >::deallocate ( T *  element)
inline

Deallocates one element, no destructor called.

Definition at line 593 of file MemoryPool.h.

References m_size.

◆ deallocateVirtual()

template<typename T >
void agx::MemoryPool< T >::deallocateVirtual ( void *  ptr)
virtual

Implements agx::AbstractMemoryPool.

Definition at line 610 of file MemoryPool.h.

◆ destroy()

template<typename T >
void agx::MemoryPool< T >::destroy ( T *  element)
inline

Deallocates an element and calls its destructor.

Definition at line 603 of file MemoryPool.h.

◆ size()

template<typename T >
size_t agx::MemoryPool< T >::size ( ) const
inline

Definition at line 139 of file MemoryPool.h.


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