From e1c9b67ef79d73b9927fcf76d8a2ccab4a6f64f0 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Mon, 12 Dec 2011 16:52:52 +0000 Subject: [PATCH] reduce dynamic memory allocations in btDbvt::rayTestInternal, fixes Issue 574, thanks to Anton Breusov --- src/BulletCollision/BroadphaseCollision/btDbvt.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.h b/src/BulletCollision/BroadphaseCollision/btDbvt.h index 2bb8ef5d2..409da80ae 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -259,6 +259,7 @@ struct btDbvt btAlignedObjectArray m_stkStack; + mutable btAlignedObjectArray m_rayTestStack; // Methods @@ -955,7 +956,7 @@ inline void btDbvt::rayTestInternal( const btDbvtNode* root, int depth=1; int treshold=DOUBLE_STACKSIZE-2; - btAlignedObjectArray stack; + btAlignedObjectArray& stack = m_rayTestStack; stack.resize(DOUBLE_STACKSIZE); stack[0]=root; btVector3 bounds[2];