diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs index 33d0364b6e..99ac25d09d 100644 --- a/OpenSim/Framework/MinHeap.cs +++ b/OpenSim/Framework/MinHeap.cs @@ -63,12 +63,15 @@ namespace OpenSim.Framework internal void Clear() { - this.value = default(T); if (this.handle != null) - { this.handle.Clear(); - this.handle = null; - } + ClearRef(); + } + + internal void ClearRef() + { + this.value = default(T); + this.handle = null; } } @@ -285,6 +288,7 @@ namespace OpenSim.Framework if (--this.size > 0 && index != this.size) { Set(this.items[this.size], index); + this.items[this.size].ClearRef(); if (!BubbleUp(index)) BubbleDown(index); } diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs index c9e57ce7b3..3f918f3bd9 100644 --- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs +++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs @@ -48,10 +48,26 @@ namespace OpenSim.Framework.Statistics string.Format( "Allocated to OpenSim objects: {0} MB\n", Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); - sb.Append( - string.Format( - "Process memory : {0} MB\n", - Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0))); + + Process myprocess = Process.GetCurrentProcess(); + if (!myprocess.HasExited) + { + myprocess.Refresh(); + sb.Append( + string.Format( + "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", + Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0))); + sb.Append( + string.Format( + "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", + Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0))); + } + else + sb.Append("Process reported as Exited \n"); return sb.ToString(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a600b86cde..058784694f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1820,6 +1820,8 @@ namespace OpenSim.Region.Framework.Scenes { parentGroup.LinkToGroup(child); + child.DetachFromBackup(); + // this is here so physics gets updated! // Don't remove! Bad juju! Stay away! or fix physics! child.AbsolutePosition = child.AbsolutePosition; diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 1e0f01f73a..2a01fc4070 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -596,7 +596,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (!m_Enabled) return; lockScriptsForRead(true); - foreach (IScriptInstance instance in m_Scripts.Values) + + List instancesToDel = new List(m_Scripts.Values); + +// foreach (IScriptInstance instance in m_Scripts.Values) + foreach (IScriptInstance instance in instancesToDel) { // Force a final state save // @@ -619,7 +623,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine // Must be done explicitly because they have infinite // lifetime // - if (!m_SimulatorShuttingDown) +// if (!m_SimulatorShuttingDown) { m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); if (m_DomainScripts[instance.AppDomain].Count == 0) @@ -629,10 +633,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine } } - m_Scripts.Clear(); - m_PrimObjects.Clear(); - m_Assemblies.Clear(); - m_DomainScripts.Clear(); +// m_Scripts.Clear(); +// m_PrimObjects.Clear(); +// m_Assemblies.Clear(); +// m_DomainScripts.Clear(); } lockScriptsForRead(false); lockScriptsForWrite(true);