From ba7904a3a80713f726d434fc82e9a80306372e2c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 18 Nov 2016 00:12:09 +0000 Subject: [PATCH] a few more changes on potencial mem issues --- OpenSim/Capabilities/Caps.cs | 5 +++++ OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs | 5 +++++ .../Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 10 ++++++++-- ThirdParty/SmartThreadPool/WorkItemsQueue.cs | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs index 3efab8e7ec..5e89c388f4 100644 --- a/OpenSim/Capabilities/Caps.cs +++ b/OpenSim/Capabilities/Caps.cs @@ -141,6 +141,11 @@ namespace OpenSim.Framework.Capabilities m_capsActive.Reset(); } + ~Caps() + { + m_capsActive.Dispose(); + } + /// /// Register a handler. This allows modules to register handlers. /// diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs index 9056548a51..4ff8cbabfa 100644 --- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs +++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs @@ -55,6 +55,11 @@ namespace OpenSim.Framework Dictionary2 = new Dictionary(capacity); } + ~DoubleDictionaryThreadAbortSafe() + { + rwLock.Dispose(); + } + public void Add(TKey1 key1, TKey2 key2, TValue value) { bool gotLock = false; diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index 98c2e71caf..2ae0881e78 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs @@ -1483,6 +1483,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing lock (diskLock) { + Stream stream = null; try { if (!Directory.Exists(dir)) @@ -1490,8 +1491,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing Directory.CreateDirectory(dir); } - using(Stream stream = File.Open(filename, FileMode.Create)) - ok = mesh.ToStream(stream); + stream = File.Open(filename, FileMode.Create); + ok = mesh.ToStream(stream); } catch (IOException e) { @@ -1500,6 +1501,11 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing filename, e.Message, e.StackTrace); ok = false; } + finally + { + if(stream != null) + stream.Dispose(); + } if (!ok && File.Exists(filename)) { diff --git a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs index e0bc9168ec..019c0d34b2 100644 --- a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs +++ b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs @@ -625,6 +625,7 @@ namespace Amib.Threading.Internal if (!_isDisposed) { Cleanup(); + _headWaiterEntry.Close(); } _isDisposed = true; }