ubitODE leaks
parent
bb78b327c0
commit
84ab4c4462
|
@ -740,6 +740,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (Shell != IntPtr.Zero)
|
if (Shell != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.geom_name_map.Remove(Shell);
|
_parent_scene.geom_name_map.Remove(Shell);
|
||||||
|
_parent_scene.actor_name_map.Remove(Shell);
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
||||||
d.GeomDestroy(Shell);
|
d.GeomDestroy(Shell);
|
||||||
Shell = IntPtr.Zero;
|
Shell = IntPtr.Zero;
|
||||||
|
@ -1188,6 +1189,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_parent_scene.RemoveCollisionEventReporting(this);
|
||||||
_parent_scene.RemoveCharacter(this);
|
_parent_scene.RemoveCharacter(this);
|
||||||
// destroy avatar capsule and related ODE data
|
// destroy avatar capsule and related ODE data
|
||||||
AvatarGeomAndBodyDestroy();
|
AvatarGeomAndBodyDestroy();
|
||||||
|
|
|
@ -943,6 +943,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
CollisionEventsThisFrame = null;
|
CollisionEventsThisFrame = null;
|
||||||
}
|
}
|
||||||
m_eventsubscription = 0;
|
m_eventsubscription = 0;
|
||||||
|
// for now still done on odescene
|
||||||
|
// _parent_scene.RemoveCollisionEventReporting(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||||
|
|
|
@ -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 d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce;
|
||||||
const float MaxERP = 0.8f;
|
const float MaxERP = 0.8f;
|
||||||
const float minERP = 0.2f;
|
const float minERP = 0.1f;
|
||||||
const float comumContactCFM = 0.0001f;
|
const float comumContactCFM = 0.0001f;
|
||||||
|
|
||||||
float frictionMovementMult = 0.8f;
|
float frictionMovementMult = 0.8f;
|
||||||
|
@ -237,20 +237,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
private d.NearCallback nearCallback;
|
private d.NearCallback nearCallback;
|
||||||
|
|
||||||
private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
||||||
private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
|
private HashSet<OdePrim> _prims = new HashSet<OdePrim>();
|
||||||
private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
||||||
private readonly HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
|
private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
|
||||||
|
|
||||||
public OpenSim.Framework.LocklessQueue<ODEchangeitem> ChangesQueue = new OpenSim.Framework.LocklessQueue<ODEchangeitem>();
|
public OpenSim.Framework.LocklessQueue<ODEchangeitem> ChangesQueue = new OpenSim.Framework.LocklessQueue<ODEchangeitem>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of actors that should receive collision events.
|
/// A list of actors that should receive collision events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
|
private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
|
||||||
private readonly List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
||||||
|
|
||||||
private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
||||||
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
|
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
|
||||||
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
||||||
|
|
||||||
|
@ -264,26 +264,21 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private volatile int m_global_contactcount = 0;
|
private volatile int m_global_contactcount = 0;
|
||||||
|
|
||||||
|
|
||||||
private readonly IntPtr contactgroup;
|
private IntPtr contactgroup;
|
||||||
|
|
||||||
public ContactData[] m_materialContactsData = new ContactData[8];
|
public ContactData[] m_materialContactsData = new ContactData[8];
|
||||||
|
|
||||||
private readonly Dictionary<Vector3, IntPtr> RegionTerrain = new Dictionary<Vector3, IntPtr>();
|
private Dictionary<Vector3, IntPtr> RegionTerrain = new Dictionary<Vector3, IntPtr>();
|
||||||
private readonly Dictionary<IntPtr, float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
|
private Dictionary<IntPtr, float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
|
||||||
private readonly Dictionary<IntPtr, GCHandle> TerrainHeightFieldHeightsHandlers = new Dictionary<IntPtr, GCHandle>();
|
private Dictionary<IntPtr, GCHandle> TerrainHeightFieldHeightsHandlers = new Dictionary<IntPtr, GCHandle>();
|
||||||
|
|
||||||
private int m_physicsiterations = 10;
|
private int m_physicsiterations = 10;
|
||||||
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
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;
|
private float step_time = 0.0f;
|
||||||
|
|
||||||
public IntPtr world;
|
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
|
// split the spaces acording to contents type
|
||||||
// ActiveSpace contains characters and active prims
|
// ActiveSpace contains characters and active prims
|
||||||
|
@ -921,8 +916,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
cfm = 0.0001f / cfm;
|
cfm = 0.0001f / cfm;
|
||||||
if (cfm > 0.01f)
|
if (cfm > 0.01f)
|
||||||
cfm = 0.01f;
|
cfm = 0.01f;
|
||||||
else if (cfm < 0.0001f)
|
else if (cfm < 0.00001f)
|
||||||
cfm = 0.0001f;
|
cfm = 0.00001f;
|
||||||
|
|
||||||
if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
|
if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
|
||||||
mu *= frictionMovementMult;
|
mu *= frictionMovementMult;
|
||||||
|
@ -949,8 +944,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
cfm = 0.0001f / cfm;
|
cfm = 0.0001f / cfm;
|
||||||
if (cfm > 0.01f)
|
if (cfm > 0.01f)
|
||||||
cfm = 0.01f;
|
cfm = 0.01f;
|
||||||
else if (cfm < 0.0001f)
|
else if (cfm < 0.00001f)
|
||||||
cfm = 0.0001f;
|
cfm = 0.00001f;
|
||||||
|
|
||||||
if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
||||||
{
|
{
|
||||||
|
@ -993,6 +988,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
cfm = 0.0001f / cfm;
|
cfm = 0.0001f / cfm;
|
||||||
if (cfm > 0.01f)
|
if (cfm > 0.01f)
|
||||||
cfm = 0.01f;
|
cfm = 0.01f;
|
||||||
|
else if (cfm < 0.00001f)
|
||||||
|
cfm = 0.00001f;
|
||||||
|
|
||||||
if (curContact.side1 > 0) // should be 2 ?
|
if (curContact.side1 > 0) // should be 2 ?
|
||||||
IgnoreNegSides = true;
|
IgnoreNegSides = true;
|
||||||
|
@ -1159,7 +1156,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
|
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 p1events = p1.SubscribedEvents();
|
||||||
bool p2events = p2.SubscribedEvents();
|
bool p2events = p2.SubscribedEvents();
|
||||||
|
|
||||||
|
@ -1963,6 +1966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
RemoveCharacter(defect);
|
RemoveCharacter(defect);
|
||||||
}
|
}
|
||||||
|
defects.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2068,13 +2072,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
_badCharacter.Clear();
|
_badCharacter.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
|
int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
|
||||||
int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace);
|
int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace);
|
||||||
int ntopgeoms = d.SpaceGetNumGeoms(TopSpace);
|
int ntopgeoms = d.SpaceGetNumGeoms(TopSpace);
|
||||||
int nbodies = d.NTotalBodies;
|
int nbodies = d.NTotalBodies;
|
||||||
int ngeoms = d.NTotalGeoms;
|
int ngeoms = d.NTotalGeoms;
|
||||||
|
*/
|
||||||
// Finished with all sim stepping. If requested, dump world state to file for debugging.
|
// 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 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?
|
// TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?
|
||||||
|
|
Loading…
Reference in New Issue