From 4485007fce3578079d200d15e5988355772fa592 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 17:04:54 +0000 Subject: 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(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 43d852b..fe2b2b2 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -188,11 +188,20 @@ 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 /// private readonly Object _taintedPrimLock = new Object(); @@ -2773,18 +2782,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(); } } -- cgit v1.1