Every frame I'm issuing a rayTest to the world to determine the ground height among other things.
However I'm noticing that the rayTest is doing temporary memory allocations, causing fragmentation and slowdowns.
The allocation itself occurs in btDbvt::rayTest when resizing a btAlignedObjectArray
(https://github.com/bulletphysics/bullet ... vt.h#L1034)
The call path during the allocation looks something like this
Code: Select all
btAlignedAllocInternal btAlignedAllocator.cpp 163
btAlignedAllocator<btDbvtNode const*, 16u>::allocate btAlignedAllocator.h 86
btAlignedObjectArray<btDbvtNode const*>::allocate btAlignedObjectArray.h 105
btAlignedObjectArray<btDbvtNode const*>::reserve btAlignedObjectArray.h 304
btAlignedObjectArray<btDbvtNode const*>::resize btAlignedObjectArray.h 234
btDbvt::rayTest btDbvt.h 1034
btCollisionWorld::rayTestSingleInternal btCollisionWorld.cpp 556
btCollisionWorld::rayTestSingle btCollisionWorld.cpp 269
btSingleRayCallback::process btCollisionWorld.cpp 916
BroadphaseRayTester::Process btDbvtBroadphase.cpp 223
btDbvt::rayTestInternal btDbvt.h 998
btDbvtBroadphase::rayTest btDbvtBroadphase.cpp 239
btCollisionWorld::rayTest btCollisionWorld.cpp 931
In btDbvt there is a rayTestInternal function that could be used instead, but it is
not clear how that function could be called via btCollisionWorld::rayTest.
Thanks