From 7cf2e812233d767b5a3573b74792aa28d6d91988 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 29 Dec 2016 00:47:02 +0000 Subject: reinforce gc.collect on region load to also do pending finalizers --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e44f11a..d7a4ca4 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1582,6 +1582,8 @@ namespace OpenSim.Region.Framework.Scenes } GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); // tell physics to finish building actor m_sceneGraph.ProcessPhysicsPreSimulation(); @@ -1856,13 +1858,9 @@ namespace OpenSim.Region.Framework.Scenes if (!LoginsEnabled && Frame == 20) { - // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); - - // In 99.9% of cases it is a bad idea to manually force garbage collection. However, - // this is a rare case where we know we have just went through a long cycle of heap - // allocations, and there is no more work to be done until someone logs in GC.Collect(); - + GC.WaitForPendingFinalizers(); + GC.Collect(); if (!LoginLock) { if (!StartDisabled) @@ -1887,6 +1885,7 @@ namespace OpenSim.Region.Framework.Scenes // LoginLock can currently only be set by a region module implementation. // If somehow this hasn't been done then the quickest way to bugfix is to see the // NullReferenceException + IRegionReadyModule rrm = RequestModuleInterface(); rrm.TriggerRegionReady(this); } -- cgit v1.1