diff options
author | erwin coumans <erwin.coumans@gmail.com> | 2022-04-25 19:32:25 -0700 |
---|---|---|
committer | erwin coumans <erwin.coumans@gmail.com> | 2022-04-25 19:32:25 -0700 |
commit | a899725cc699354765dda47398e039e7bd58bfb4 (patch) | |
tree | 2268c951bf1cc6924ba55f0253b68df69da9fddc | |
parent | 9185f93174d5e24f06dbec6bb4c2868fd72617ed (diff) | |
download | bullet3-a899725cc699354765dda47398e039e7bd58bfb4.tar.gz |
clear the m_userVisualShapeHandles at resetSimulation to avoid memory build-up (not a leak at exit, since memory was del-allocated in the destructor)
-rw-r--r-- | examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index d3f1ee799..8275451ed 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -240,6 +240,10 @@ struct InternalVisualShapeData b3AlignedObjectArray<std::string> m_pathPrefixes; + virtual ~InternalVisualShapeData() + { + clear(); + } void clear() { m_tinyRendererVisualShapeIndex = -1; @@ -259,8 +263,14 @@ struct InternalCollisionShapeData m_used(0) { } + + virtual ~InternalCollisionShapeData() + { + clear(); + } void clear() { + m_urdfCollisionObjects.clear(); m_collisionShape = 0; m_used = 0; } @@ -15949,6 +15959,9 @@ void PhysicsServerCommandProcessor::resetSimulation(int flags) m_data->m_bodyHandles.exitHandles(); m_data->m_bodyHandles.initHandles(); + m_data->m_userVisualShapeHandles.exitHandles(); + m_data->m_userVisualShapeHandles.initHandles(); + m_data->m_userCollisionShapeHandles.exitHandles(); m_data->m_userCollisionShapeHandles.initHandles(); |