16 #ifndef _BT_POOL_ALLOCATOR_H 17 #define _BT_POOL_ALLOCATOR_H 36 :m_elemSize(elemSize),
37 m_maxElements(maxElements)
39 m_pool = (
unsigned char*)
btAlignedAlloc( static_cast<unsigned int>(m_elemSize*m_maxElements),16);
46 *(
void**)p = (p + m_elemSize);
80 if (NULL != m_firstFree)
82 m_firstFree = *(
void**)m_firstFree;
92 if (((
unsigned char*)ptr >= m_pool && (
unsigned char*)ptr < m_pool + m_maxElements * m_elemSize))
103 btAssert((
unsigned char*)ptr >= m_pool && (
unsigned char*)ptr < m_pool + m_maxElements * m_elemSize);
106 *(
void**)ptr = m_firstFree;
130 #endif //_BT_POOL_ALLOCATOR_H
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
btSpinMutex – lightweight spin-mutex implemented with atomic ops, never puts a thread to sleep becau...
unsigned char * getPoolAddress()
#define btAlignedFree(ptr)
btPoolAllocator(int elemSize, int maxElements)
const unsigned char * getPoolAddress() const
void btMutexUnlock(btSpinMutex *mutex)
void * allocate(int size)
The btPoolAllocator class allows to efficiently allocate a large pool of objects, instead of dynamica...
int getElementSize() const
void btMutexLock(btSpinMutex *mutex)
#define btAlignedAlloc(size, alignment)
void freeMemory(void *ptr)