aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-07-11 08:13:57 +0100
committerUbitUmarov2012-07-11 08:13:57 +0100
commit84ab4c44628441b32ec7ef0c728d035b5cf40b39 (patch)
tree097f253fe77d97e3ee2d2a15b3d1d66d7b5d97dc /OpenSim/Region
parent stop keeping references to objects on released items (diff)
downloadopensim-SC-84ab4c44628441b32ec7ef0c728d035b5cf40b39.zip
opensim-SC-84ab4c44628441b32ec7ef0c728d035b5cf40b39.tar.gz
opensim-SC-84ab4c44628441b32ec7ef0c728d035b5cf40b39.tar.bz2
opensim-SC-84ab4c44628441b32ec7ef0c728d035b5cf40b39.tar.xz
ubitODE leaks
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs54
3 files changed, 33 insertions, 25 deletions
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
740 if (Shell != IntPtr.Zero) 740 if (Shell != IntPtr.Zero)
741 { 741 {
742 _parent_scene.geom_name_map.Remove(Shell); 742 _parent_scene.geom_name_map.Remove(Shell);
743 _parent_scene.actor_name_map.Remove(Shell);
743 _parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace); 744 _parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
744 d.GeomDestroy(Shell); 745 d.GeomDestroy(Shell);
745 Shell = IntPtr.Zero; 746 Shell = IntPtr.Zero;
@@ -1188,6 +1189,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1188 } 1189 }
1189 else 1190 else
1190 { 1191 {
1192 _parent_scene.RemoveCollisionEventReporting(this);
1191 _parent_scene.RemoveCharacter(this); 1193 _parent_scene.RemoveCharacter(this);
1192 // destroy avatar capsule and related ODE data 1194 // destroy avatar capsule and related ODE data
1193 AvatarGeomAndBodyDestroy(); 1195 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
943 CollisionEventsThisFrame = null; 943 CollisionEventsThisFrame = null;
944 } 944 }
945 m_eventsubscription = 0; 945 m_eventsubscription = 0;
946 // for now still done on odescene
947// _parent_scene.RemoveCollisionEventReporting(this);
946 } 948 }
947 949
948 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 950 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
175 175
176 const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce; 176 const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce;
177 const float MaxERP = 0.8f; 177 const float MaxERP = 0.8f;
178 const float minERP = 0.2f; 178 const float minERP = 0.1f;
179 const float comumContactCFM = 0.0001f; 179 const float comumContactCFM = 0.0001f;
180 180
181 float frictionMovementMult = 0.8f; 181 float frictionMovementMult = 0.8f;
@@ -237,20 +237,20 @@ namespace OpenSim.Region.Physics.OdePlugin
237 237
238 private d.NearCallback nearCallback; 238 private d.NearCallback nearCallback;
239 239
240 private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); 240 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
241 private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); 241 private HashSet<OdePrim> _prims = new HashSet<OdePrim>();
242 private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); 242 private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
243 private readonly HashSet<OdePrim> _activegroups = new HashSet<OdePrim>(); 243 private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
244 244
245 public OpenSim.Framework.LocklessQueue<ODEchangeitem> ChangesQueue = new OpenSim.Framework.LocklessQueue<ODEchangeitem>(); 245 public OpenSim.Framework.LocklessQueue<ODEchangeitem> ChangesQueue = new OpenSim.Framework.LocklessQueue<ODEchangeitem>();
246 246
247 /// <summary> 247 /// <summary>
248 /// A list of actors that should receive collision events. 248 /// A list of actors that should receive collision events.
249 /// </summary> 249 /// </summary>
250 private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); 250 private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
251 private readonly List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>(); 251 private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
252 252
253 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); 253 private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
254 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 254 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
255 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 255 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
256 256
@@ -264,26 +264,21 @@ namespace OpenSim.Region.Physics.OdePlugin
264 private volatile int m_global_contactcount = 0; 264 private volatile int m_global_contactcount = 0;
265 265
266 266
267 private readonly IntPtr contactgroup; 267 private IntPtr contactgroup;
268 268
269 public ContactData[] m_materialContactsData = new ContactData[8]; 269 public ContactData[] m_materialContactsData = new ContactData[8];
270 270
271 private readonly Dictionary<Vector3, IntPtr> RegionTerrain = new Dictionary<Vector3, IntPtr>(); 271 private Dictionary<Vector3, IntPtr> RegionTerrain = new Dictionary<Vector3, IntPtr>();
272 private readonly Dictionary<IntPtr, float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>(); 272 private Dictionary<IntPtr, float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
273 private readonly Dictionary<IntPtr, GCHandle> TerrainHeightFieldHeightsHandlers = new Dictionary<IntPtr, GCHandle>(); 273 private Dictionary<IntPtr, GCHandle> TerrainHeightFieldHeightsHandlers = new Dictionary<IntPtr, GCHandle>();
274 274
275 private int m_physicsiterations = 10; 275 private int m_physicsiterations = 10;
276 private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 276 private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
277 private readonly PhysicsActor PANull = new NullPhysicsActor(); 277 private PhysicsActor PANull = new NullPhysicsActor();
278 private float step_time = 0.0f; 278 private float step_time = 0.0f;
279 279
280 public IntPtr world; 280 public IntPtr world;
281 281
282 private uint obj2LocalID = 0;
283 private OdeCharacter cc1;
284 private OdePrim cp1;
285 private OdeCharacter cc2;
286 private OdePrim cp2;
287 282
288 // split the spaces acording to contents type 283 // split the spaces acording to contents type
289 // ActiveSpace contains characters and active prims 284 // ActiveSpace contains characters and active prims
@@ -921,8 +916,8 @@ namespace OpenSim.Region.Physics.OdePlugin
921 cfm = 0.0001f / cfm; 916 cfm = 0.0001f / cfm;
922 if (cfm > 0.01f) 917 if (cfm > 0.01f)
923 cfm = 0.01f; 918 cfm = 0.01f;
924 else if (cfm < 0.0001f) 919 else if (cfm < 0.00001f)
925 cfm = 0.0001f; 920 cfm = 0.00001f;
926 921
927 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) 922 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
928 mu *= frictionMovementMult; 923 mu *= frictionMovementMult;
@@ -949,8 +944,8 @@ namespace OpenSim.Region.Physics.OdePlugin
949 cfm = 0.0001f / cfm; 944 cfm = 0.0001f / cfm;
950 if (cfm > 0.01f) 945 if (cfm > 0.01f)
951 cfm = 0.01f; 946 cfm = 0.01f;
952 else if (cfm < 0.0001f) 947 else if (cfm < 0.00001f)
953 cfm = 0.0001f; 948 cfm = 0.00001f;
954 949
955 if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) 950 if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
956 { 951 {
@@ -993,6 +988,8 @@ namespace OpenSim.Region.Physics.OdePlugin
993 cfm = 0.0001f / cfm; 988 cfm = 0.0001f / cfm;
994 if (cfm > 0.01f) 989 if (cfm > 0.01f)
995 cfm = 0.01f; 990 cfm = 0.01f;
991 else if (cfm < 0.00001f)
992 cfm = 0.00001f;
996 993
997 if (curContact.side1 > 0) // should be 2 ? 994 if (curContact.side1 > 0) // should be 2 ?
998 IgnoreNegSides = true; 995 IgnoreNegSides = true;
@@ -1159,7 +1156,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1159 1156
1160 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact) 1157 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
1161 { 1158 {
1162 obj2LocalID = 0; 1159
1160 OdeCharacter cc1;
1161 OdePrim cp1;
1162 OdeCharacter cc2;
1163 OdePrim cp2;
1164
1165 uint obj2LocalID = 0;
1163 bool p1events = p1.SubscribedEvents(); 1166 bool p1events = p1.SubscribedEvents();
1164 bool p2events = p2.SubscribedEvents(); 1167 bool p2events = p2.SubscribedEvents();
1165 1168
@@ -1963,6 +1966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1963 { 1966 {
1964 RemoveCharacter(defect); 1967 RemoveCharacter(defect);
1965 } 1968 }
1969 defects.Clear();
1966 } 1970 }
1967 } 1971 }
1968 1972
@@ -2068,13 +2072,13 @@ namespace OpenSim.Region.Physics.OdePlugin
2068 _badCharacter.Clear(); 2072 _badCharacter.Clear();
2069 } 2073 }
2070 } 2074 }
2071 2075/*
2072 int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); 2076 int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
2073 int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace); 2077 int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace);
2074 int ntopgeoms = d.SpaceGetNumGeoms(TopSpace); 2078 int ntopgeoms = d.SpaceGetNumGeoms(TopSpace);
2075 int nbodies = d.NTotalBodies; 2079 int nbodies = d.NTotalBodies;
2076 int ngeoms = d.NTotalGeoms; 2080 int ngeoms = d.NTotalGeoms;
2077 2081*/
2078 // Finished with all sim stepping. If requested, dump world state to file for debugging. 2082 // Finished with all sim stepping. If requested, dump world state to file for debugging.
2079 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? 2083 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
2080 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? 2084 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?