From 84ab4c44628441b32ec7ef0c728d035b5cf40b39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Jul 2012 08:13:57 +0100 Subject: ubitODE leaks --- .../Region/Physics/UbitOdePlugin/ODECharacter.cs | 2 + OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 2 + OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 54 ++++++++++++---------- 3 files changed, 33 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 6e4e41f..865180f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -740,6 +740,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (Shell != IntPtr.Zero) { _parent_scene.geom_name_map.Remove(Shell); + _parent_scene.actor_name_map.Remove(Shell); _parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace); d.GeomDestroy(Shell); Shell = IntPtr.Zero; @@ -1188,6 +1189,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { + _parent_scene.RemoveCollisionEventReporting(this); _parent_scene.RemoveCharacter(this); // destroy avatar capsule and related ODE data AvatarGeomAndBodyDestroy(); diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 14e4272..ff17a6e 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -943,6 +943,8 @@ namespace OpenSim.Region.Physics.OdePlugin CollisionEventsThisFrame = null; } m_eventsubscription = 0; + // for now still done on odescene +// _parent_scene.RemoveCollisionEventReporting(this); } public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index d5938f4..7848b35 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -175,7 +175,7 @@ namespace OpenSim.Region.Physics.OdePlugin const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce; const float MaxERP = 0.8f; - const float minERP = 0.2f; + const float minERP = 0.1f; const float comumContactCFM = 0.0001f; float frictionMovementMult = 0.8f; @@ -237,20 +237,20 @@ namespace OpenSim.Region.Physics.OdePlugin private d.NearCallback nearCallback; - private readonly HashSet _characters = new HashSet(); - private readonly HashSet _prims = new HashSet(); - private readonly HashSet _activeprims = new HashSet(); - private readonly HashSet _activegroups = new HashSet(); + private HashSet _characters = new HashSet(); + private HashSet _prims = new HashSet(); + private HashSet _activeprims = new HashSet(); + private HashSet _activegroups = new HashSet(); public OpenSim.Framework.LocklessQueue ChangesQueue = new OpenSim.Framework.LocklessQueue(); /// /// A list of actors that should receive collision events. /// - private readonly List _collisionEventPrim = new List(); - private readonly List _collisionEventPrimRemove = new List(); + private List _collisionEventPrim = new List(); + private List _collisionEventPrimRemove = new List(); - private readonly HashSet _badCharacter = new HashSet(); + private HashSet _badCharacter = new HashSet(); public Dictionary geom_name_map = new Dictionary(); public Dictionary actor_name_map = new Dictionary(); @@ -264,26 +264,21 @@ namespace OpenSim.Region.Physics.OdePlugin private volatile int m_global_contactcount = 0; - private readonly IntPtr contactgroup; + private IntPtr contactgroup; public ContactData[] m_materialContactsData = new ContactData[8]; - private readonly Dictionary RegionTerrain = new Dictionary(); - private readonly Dictionary TerrainHeightFieldHeights = new Dictionary(); - private readonly Dictionary TerrainHeightFieldHeightsHandlers = new Dictionary(); + private Dictionary RegionTerrain = new Dictionary(); + private Dictionary TerrainHeightFieldHeights = new Dictionary(); + private Dictionary TerrainHeightFieldHeightsHandlers = new Dictionary(); private int m_physicsiterations = 10; private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag - private readonly PhysicsActor PANull = new NullPhysicsActor(); + private PhysicsActor PANull = new NullPhysicsActor(); private float step_time = 0.0f; public IntPtr world; - private uint obj2LocalID = 0; - private OdeCharacter cc1; - private OdePrim cp1; - private OdeCharacter cc2; - private OdePrim cp2; // split the spaces acording to contents type // ActiveSpace contains characters and active prims @@ -921,8 +916,8 @@ namespace OpenSim.Region.Physics.OdePlugin cfm = 0.0001f / cfm; if (cfm > 0.01f) cfm = 0.01f; - else if (cfm < 0.0001f) - cfm = 0.0001f; + else if (cfm < 0.00001f) + cfm = 0.00001f; if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) mu *= frictionMovementMult; @@ -949,8 +944,8 @@ namespace OpenSim.Region.Physics.OdePlugin cfm = 0.0001f / cfm; if (cfm > 0.01f) cfm = 0.01f; - else if (cfm < 0.0001f) - cfm = 0.0001f; + else if (cfm < 0.00001f) + cfm = 0.00001f; if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) { @@ -993,6 +988,8 @@ namespace OpenSim.Region.Physics.OdePlugin cfm = 0.0001f / cfm; if (cfm > 0.01f) cfm = 0.01f; + else if (cfm < 0.00001f) + cfm = 0.00001f; if (curContact.side1 > 0) // should be 2 ? IgnoreNegSides = true; @@ -1159,7 +1156,13 @@ namespace OpenSim.Region.Physics.OdePlugin private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact) { - obj2LocalID = 0; + + OdeCharacter cc1; + OdePrim cp1; + OdeCharacter cc2; + OdePrim cp2; + + uint obj2LocalID = 0; bool p1events = p1.SubscribedEvents(); bool p2events = p2.SubscribedEvents(); @@ -1963,6 +1966,7 @@ namespace OpenSim.Region.Physics.OdePlugin { RemoveCharacter(defect); } + defects.Clear(); } } @@ -2068,13 +2072,13 @@ namespace OpenSim.Region.Physics.OdePlugin _badCharacter.Clear(); } } - +/* int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace); int ntopgeoms = d.SpaceGetNumGeoms(TopSpace); int nbodies = d.NTotalBodies; int ngeoms = d.NTotalGeoms; - +*/ // Finished with all sim stepping. If requested, dump world state to file for debugging. // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? -- cgit v1.1