From 62009ba9c02590f689d202da1753c91498f5b51d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 10 Dec 2015 14:00:43 +0000 Subject: [PATCH] remove some SOG references on delete to help GC --- .../Avatar/Attachments/AttachmentsModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 7 ++++++- .../Framework/Scenes/SceneObjectGroup.cs | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 39e352607b..a21b52cc9a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -1083,6 +1083,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Now, remove the scripts so.RemoveScriptInstances(true); + so.Clear(); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8bdf39a6de..9061244c64 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1577,6 +1577,7 @@ namespace OpenSim.Region.Framework.Scenes m_heartbeatThread = null; } + GC.Collect(); // tell physics to finish building actor m_sceneGraph.ProcessPhysicsPreSimulation(); @@ -2798,7 +2799,11 @@ namespace OpenSim.Region.Framework.Scenes if (!silent) SendKillObject(new List() { group.LocalId }); - // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); + // use this to mean also full delete + if (removeScripts) + group.Clear(); + partList = null; + // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 71d9017bd7..473c8022a5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -764,6 +764,7 @@ namespace OpenSim.Region.Framework.Scenes } avsToCross.Clear(); sog.RemoveScriptInstances(true); + sog.Clear(); return sog; } else // cross failed, put avas back ?? @@ -2245,7 +2246,6 @@ namespace OpenSim.Region.Framework.Scenes { part.Inventory.ProcessInventoryBackup(datastore); - // take the change to delete things if(part.KeyframeMotion != null) { part.KeyframeMotion.Delete(); @@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes } }); - + backup_group.Clear(); backup_group = null; } // else @@ -4846,6 +4846,20 @@ namespace OpenSim.Region.Framework.Scenes }); } + // clear some references to easy cg + public void Clear() + { + m_parts.Clear(); + m_sittingAvatars.Clear(); + m_rootPart = null; + + m_PlaySoundMasterPrim = null; + m_PlaySoundSlavePrims.Clear(); + m_LoopSoundMasterPrim = null; + m_targets.Clear(); + } + #endregion } + }