From 21418934e05c57b78757556fa396c9efcaac36a9 Mon Sep 17 00:00:00 2001 From: Jan Matas Date: Wed, 25 Apr 2018 16:17:28 +0100 Subject: [PATCH 1/2] Reset sparsesdf to free memory. --- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 6851729a9..7e6e0a12a 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -9693,7 +9693,7 @@ void PhysicsServerCommandProcessor::stepSimulationRealTime(double dtInSec,const void PhysicsServerCommandProcessor::resetSimulation() { //clean up all data - + m_data->m_dynamicsWorld->getWorldInfo().m_sparsesdf.Reset(); if (m_data && m_data->m_guiHelper) { m_data->m_guiHelper->removeAllGraphicsInstances(); From b1f85268f08916056807536fa212545f2751fe0d Mon Sep 17 00:00:00 2001 From: Jan Matas Date: Mon, 30 Apr 2018 19:01:53 +0100 Subject: [PATCH 2/2] Check for null --- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 7e6e0a12a..11041e3a2 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -9693,7 +9693,10 @@ void PhysicsServerCommandProcessor::stepSimulationRealTime(double dtInSec,const void PhysicsServerCommandProcessor::resetSimulation() { //clean up all data - m_data->m_dynamicsWorld->getWorldInfo().m_sparsesdf.Reset(); + if (m_data && m_data->m_dynamicsWorld) + { + m_data->m_dynamicsWorld->getWorldInfo().m_sparsesdf.Reset(); + } if (m_data && m_data->m_guiHelper) { m_data->m_guiHelper->removeAllGraphicsInstances();