clear the m_userVisualShapeHandles at resetSimulation to avoid memory build-up (not a leak at exit, since memory was del-allocated in the destructor)

This commit is contained in:
erwin coumans 2022-04-25 19:32:25 -07:00
parent 9185f93174
commit a899725cc6

View File

@ -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();