Revision: 8440 http://playerstage.svn.sourceforge.net/playerstage/?rev=8440&view=rev Author: natepak Date: 2009-11-23 23:59:22 +0000 (Mon, 23 Nov 2009)
Log Message: ----------- Fixed memory leak associated with contact points Modified Paths: -------------- code/gazebo/trunk/server/physics/Geom.cc code/gazebo/trunk/server/physics/ode/ODEPhysics.cc Modified: code/gazebo/trunk/server/physics/Geom.cc =================================================================== --- code/gazebo/trunk/server/physics/Geom.cc 2009-11-23 19:41:41 UTC (rev 8439) +++ code/gazebo/trunk/server/physics/Geom.cc 2009-11-23 23:59:22 UTC (rev 8440) @@ -428,6 +428,9 @@ /// Add an occurance of a contact to this geom void Geom::AddContact(const Contact &contact) { + if (this->GetType() == Shape::RAY || this->GetType() == Shape::PLANE) + return; + this->contacts.push_back( contact.Clone() ); this->contactSignal( contact ); } Modified: code/gazebo/trunk/server/physics/ode/ODEPhysics.cc =================================================================== --- code/gazebo/trunk/server/physics/ode/ODEPhysics.cc 2009-11-23 19:41:41 UTC (rev 8439) +++ code/gazebo/trunk/server/physics/ode/ODEPhysics.cc 2009-11-23 23:59:22 UTC (rev 8440) @@ -96,7 +96,7 @@ this->contactSurfaceLayerP = new ParamT<double>("contactSurfaceLayer", 0.01, 0); Param::End(); - this->contactFeedbacks.resize(1000); + this->contactFeedbacks.resize(100); // Reset the contact pointer this->contactFeedbackIter = this->contactFeedbacks.begin(); @@ -481,9 +481,11 @@ if (numc != 0) { + (*self->contactFeedbackIter).contact.Reset(); (*self->contactFeedbackIter).contact.geom1 = geom1; (*self->contactFeedbackIter).contact.geom2 = geom2; (*self->contactFeedbackIter).feedbacks.resize(numc); + for (i=0; i<numc; i++) { @@ -552,7 +554,8 @@ self->contactFeedbackIter++; if (self->contactFeedbackIter == self->contactFeedbacks.end()) - self->contactFeedbacks.resize( self->contactFeedbacks.size() + 500); + self->contactFeedbacks.resize( self->contactFeedbacks.size() + 100); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit