|
AGXDynamics
2.31.1.0
|
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. More... | |
| virtual | ~MemoryPool () |
| Destructor. More... | |
| void * | allocate (uint32_t numBytes) |
| void * | allocate (uint32_t numBytes, uint32_t alignment) |
| T * | allocate () |
| Allocates one element, no constructor called. More... | |
| void * | allocateBytes (size_t numBytes, size_t alignment=16) |
| Allocate a memory section of specified alignment. More... | |
| void | clear () |
| Clears the memory pool and runs the destructor on every allocated object. More... | |
| void | clearFast () |
| Clears the memory pool without calling destructors. More... | |
| T * | create () |
| Allocates an element and calls its default constructor. More... | |
| void | deallocate (void *buffer) |
| void | deallocate (T *element) |
| Deallocates one element, no destructor called. More... | |
| void | deallocateBytes (void *buffer, size_t numBytes) |
| Deallocate a section previously allocated using allocateBytes method. More... | |
| void | deallocateBytes (void *buffer) |
| virtual void | deallocateVirtual (void *ptr) |
| void | destroy (T *element) |
| Deallocates an element and calls its destructor. More... | |
| const char * | getName () const |
| void | setContainer (class Container *) |
| size_t | size () |
| size_t | size () const |
Static Public Member Functions | |
| 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 | |
| static agx::UInt32 | allocatedMemoryPattern |
| static agx::UInt32 | deallocatedMemoryPattern |
| static bool | initMemoryFlag |
Protected Member Functions | |
| void | createChunk (uint32_t size) |
| size_t | deleteAllChunks () |
Protected Attributes | |
| uint32_t | m_chunkSize |
| Chunk * | m_firstChunk |
Memory pool.
Definition at line 26 of file MemoryPool.h.
| agx::MemoryPool< T >::MemoryPool | ( | const char * | name = "MemoryPool< T >", |
| uint32_t | initialChunkSize = 64 |
||
| ) |
|
virtual |
|
inlineinherited |
Definition at line 497 of file MemoryPool.h.
References agx::BatchAllocator::createChunk(), agx::BatchAllocator::Chunk::end, agx::BatchAllocator::Chunk::head, agx::BatchAllocator::m_firstChunk, and agx::max().
Referenced by agx::BatchAllocator::allocate(), and agx::MemoryPool< T >::allocate().
|
inlineinherited |
Definition at line 508 of file MemoryPool.h.
References agxAssert, agx::BatchAllocator::allocate(), agx::BatchAllocator::Chunk::head, agx::isPowerOfTwo(), and agx::BatchAllocator::m_firstChunk.
|
inline |
Allocates one element, no constructor called.
Definition at line 571 of file MemoryPool.h.
References agx::BatchAllocator::allocate(), and m_size.
|
inherited |
Allocate a memory section of specified alignment.
Referenced by agx::Allocator< T >::allocate(), and agx::AlignedAllocator< T >::allocate().
| void agx::MemoryPool< T >::clear | ( | ) |
Clears the memory pool and runs the destructor on every allocated object.
Definition at line 616 of file MemoryPool.h.
References agxAssert, agx::Vector< T, Allocator >::back(), agx::BatchAllocator::Chunk::buffer, agx::BatchAllocator::clear(), agx::end(), agx::BatchAllocator::Chunk::head, m_size, agx::BatchAllocator::Chunk::next, and agx::Vector< T, Allocator >::push_back().
| void agx::MemoryPool< T >::clearFast | ( | ) |
Clears the memory pool without calling destructors.
Definition at line 700 of file MemoryPool.h.
References agxAssert1, agx::BatchAllocator::clear(), and m_size.
|
inline |
Allocates an element and calls its default constructor.
Definition at line 585 of file MemoryPool.h.
|
protectedinherited |
Referenced by agx::BatchAllocator::allocate().
Definition at line 517 of file MemoryPool.h.
References agxVerify.
|
inline |
Deallocates one element, no destructor called.
Definition at line 593 of file MemoryPool.h.
References m_size.
Deallocate a section previously allocated using allocateBytes method.
Referenced by agx::Vector< T, Allocator >::clear(), agx::VectorPOD< T, Allocator >::clear(), agx::Allocator< T >::deallocate(), agx::AlignedAllocator< T >::deallocate(), agx::ByteAllocator::deallocateBytes(), agx::CellTable< CellIdT, HashT >::~CellTable(), agx::Vector< T, Allocator >::~Vector(), and agx::VectorPOD< T, Allocator >::~VectorPOD().
Definition at line 173 of file Allocator.h.
References agx::ByteAllocator::deallocateBytes().
|
virtual |
Implements agx::AbstractMemoryPool.
Definition at line 610 of file MemoryPool.h.
|
protectedinherited |
|
inline |
Deallocates an element and calls its destructor.
Definition at line 603 of file MemoryPool.h.
|
inherited |
Definition at line 164 of file Allocator.h.
|
staticinherited |
Definition at line 71 of file Allocator.h.
Referenced by agx::Vector< T, Allocator >::operator=(), agx::VectorPOD< T, Allocator >::operator=(), agx::Vector< T, Allocator >::Vector(), and agx::VectorPOD< T, Allocator >::VectorPOD().
|
inlineinherited |
Definition at line 534 of file MemoryPool.h.
References agx::BatchAllocator::Chunk::buffer, agx::BatchAllocator::Chunk::end, agx::BatchAllocator::m_firstChunk, and agx::BatchAllocator::Chunk::next.
|
inline |
Definition at line 139 of file MemoryPool.h.
|
staticinherited |
|
staticinherited |
Definition at line 79 of file Allocator.h.
|
staticinherited |
Definition at line 80 of file Allocator.h.
|
staticinherited |
Definition at line 78 of file Allocator.h.
|
protectedinherited |
Definition at line 73 of file MemoryPool.h.
|
protectedinherited |
Definition at line 72 of file MemoryPool.h.
Referenced by agx::BatchAllocator::allocate(), and agx::BatchAllocator::size().