From 36a1248b317cd80717fef6bc7c8fab318172a075 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 6 Aug 2012 09:06:46 +0100 Subject: ** DANGER someone should stress test more ** release unused physics meshs, including unmanaged memory allocations (allocated by managed code) --- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 32 +++++++++---------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index a3534a4..fbc6134 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -57,7 +57,6 @@ using OdeAPI; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; - namespace OpenSim.Region.Physics.OdePlugin { public class OdePrim : PhysicsActor @@ -538,24 +537,6 @@ namespace OpenSim.Region.Physics.OdePlugin { set { -/* - IMesh mesh = null; - if (_parent_scene.needsMeshing(value)) - { - bool convex; - if (m_shapetype == 0) - convex = false; - else - convex = true; - mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true, convex); - } - - if (mesh != null) - { - lock (m_meshlock) - m_mesh = mesh; - } -*/ AddChange(changes.Shape, value); } } @@ -1357,7 +1338,6 @@ namespace OpenSim.Region.Physics.OdePlugin IMesh mesh = null; - lock (m_meshlock) { if (m_mesh == null) @@ -1403,7 +1383,7 @@ namespace OpenSim.Region.Physics.OdePlugin hasOOBoffsetFromMesh = true; mesh.releaseSourceMeshData(); - m_mesh = null; + m_mesh = mesh; } IntPtr geo = IntPtr.Zero; @@ -1545,7 +1525,10 @@ namespace OpenSim.Region.Physics.OdePlugin d.GeomTriMeshDataDestroy(_triMeshData); _triMeshData = IntPtr.Zero; } + } + + // catch (System.AccessViolationException) catch (Exception e) { @@ -1559,6 +1542,13 @@ namespace OpenSim.Region.Physics.OdePlugin { m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction BAD {0}", Name); } + + if (m_mesh != null) + { + _parent_scene.mesher.ReleaseMesh(m_mesh); + m_mesh = null; + } + Body = IntPtr.Zero; hasOOBoffsetFromMesh = false; } -- cgit v1.1