Might the btDiscreteDynamicsWorld recreate/expand it's own Octree/SpatialHash from the whole DynamicsWorld and keep expanding it as I increase the distance of added objects from (0,0,0)? Adding a new top level to the octree for example and therefore using more memory and never shrinking it back again?
I use a btDiscreteDynamicsWorld containing multiple objects of btBvhTriangleMeshShape for static collision. Also some other primitive Entities (btBoxes and btCylinders) colliding with the static triangle meshes. I move the "point of action" constantly away from the origin (0,0,0) of the DynamicsWorld, removing old TriangleMeshes and old primitive Entities, while also adding new ones in the same manner. (procedurally generated world) When I keep moving along the x-axis the memory use increases constantly. But when I stop at some point and move back the way I came, deleting and adding new Shapes again, the memory use stays constant.
After hunting possible memory leaks with adding and removing (also deleting) the collision objects properly from my heap (like removing MotionStates manually etc.), I still face this behavior.
The technical documentation of bullet is not very detailed and skimming through the source code of bullet did not give me any clues either. API does not show something like a recalcOctree() function.
Can I force a complete recalculation of the internal collision structure without deleting the whole btDynamicsWorld object? Or am I completely on the wrong run here? Has anyone else experienced increased memory usage in bullet when adding objects far away from (0,0,0) compared to objects near the origin?
I use Bullet 2.79