16 #ifndef _BT_POOL_ALLOCATOR_H 17 #define _BT_POOL_ALLOCATOR_H 34 :m_elemSize(elemSize),
35 m_maxElements(maxElements)
37 m_pool = (
unsigned char*)
btAlignedAlloc( static_cast<unsigned int>(m_elemSize*m_maxElements),16);
44 *(
void**)p = (p + m_elemSize);
77 m_firstFree = *(
void**)m_firstFree;
85 if (((
unsigned char*)ptr >= m_pool && (
unsigned char*)ptr < m_pool + m_maxElements * m_elemSize))
96 btAssert((
unsigned char*)ptr >= m_pool && (
unsigned char*)ptr < m_pool + m_maxElements * m_elemSize);
98 *(
void**)ptr = m_firstFree;
121 #endif //_BT_POOL_ALLOCATOR_H
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
unsigned char * getPoolAddress()
#define btAlignedFree(ptr)
btPoolAllocator(int elemSize, int maxElements)
int getElementSize() const
void * allocate(int size)
The btPoolAllocator class allows to efficiently allocate a large pool of objects, instead of dynamica...
#define btAlignedAlloc(size, alignment)
const unsigned char * getPoolAddress() const
void freeMemory(void *ptr)