From 862ea08d3b47e6a78d8c699a0dbe30838b6d4fab Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Fri, 5 Sep 2008 05:58:37 +0000 Subject: [PATCH] use new/delete[] array, overriden by BT_ALIGNED_ALLOCATOR macro. Thanks to Russell Bartley for the feedback. --- .../BroadphaseCollision/btAxisSweep3.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h index 8964e422b..ed28c3516 100644 --- a/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h +++ b/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h @@ -78,7 +78,7 @@ protected: BP_FP_INT_TYPE m_numHandles; // number of active handles BP_FP_INT_TYPE m_maxHandles; // max number of handles Handle* m_pHandles; // handles pool - void* m_pHandlesRawPtr; + BP_FP_INT_TYPE m_firstFreeHandle; // free handles list Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) @@ -271,11 +271,9 @@ m_invalidPair(0) m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize; - // allocate handles buffer and put all handles on free list - m_pHandlesRawPtr = btAlignedAlloc(sizeof(Handle)*maxHandles,16); - m_pHandles = new(m_pHandlesRawPtr) Handle[maxHandles]; - btAssert(m_pHandlesRawPtr==m_pHandles); //placement new[] should just return the same pointer - + // allocate handles buffer, using btAlignedAlloc, and put all handles on free list + m_pHandles = new Handle[maxHandles]; + m_maxHandles = maxHandles; m_numHandles = 0; @@ -326,7 +324,7 @@ btAxisSweep3Internal::~btAxisSweep3Internal() { btAlignedFree(m_pEdgesRawPtr[i]); } - btAlignedFree(m_pHandlesRawPtr); + delete [] m_pHandles; if (m_ownsPairCache) {