From c253539c04b9102bf0dc9156605a50d4540637c7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 21 Nov 2011 17:04:54 +0000 Subject: [PATCH] Instead of generating a new list for bad characters on every physics pass, keep reusing the same list. --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 8b9c5a99f3..6d1186ae8c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -188,10 +188,19 @@ namespace OpenSim.Region.Physics.OdePlugin private d.NearCallback nearCallback; public d.TriCallback triCallback; public d.TriArrayCallback triArrayCallback; + private readonly HashSet _characters = new HashSet(); private readonly HashSet _prims = new HashSet(); private readonly HashSet _activeprims = new HashSet(); + /// + /// Defects list to remove characters that no longer have finite positions due to some other bug. + /// + /// + /// Used repeatedly in Simulate() but initialized once here. + /// + private readonly List defects = new List(); + /// /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH /// @@ -2757,18 +2766,18 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); // Move characters lock (_characters) { - List defects = new List(); foreach (OdeCharacter actor in _characters) { if (actor != null) actor.Move(defects); } + if (0 != defects.Count) { foreach (OdeCharacter defect in defects) - { RemoveCharacter(defect); - } + + defects.Clear(); } }