reinforce gc.collect on region load to also do pending finalizers

melanie
UbitUmarov 2016-12-29 00:47:02 +00:00
parent 73b2c82427
commit 7cf2e81223
2 changed files with 9 additions and 6 deletions

View File

@ -1581,6 +1581,8 @@ namespace OpenSim.Region.Framework.Scenes
m_heartbeatThread = null; m_heartbeatThread = null;
} }
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect(); GC.Collect();
// tell physics to finish building actor // tell physics to finish building actor
m_sceneGraph.ProcessPhysicsPreSimulation(); m_sceneGraph.ProcessPhysicsPreSimulation();
@ -1856,13 +1858,9 @@ namespace OpenSim.Region.Framework.Scenes
if (!LoginsEnabled && Frame == 20) 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.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!LoginLock) if (!LoginLock)
{ {
if (!StartDisabled) if (!StartDisabled)
@ -1887,6 +1885,7 @@ namespace OpenSim.Region.Framework.Scenes
// LoginLock can currently only be set by a region module implementation. // 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 // If somehow this hasn't been done then the quickest way to bugfix is to see the
// NullReferenceException // NullReferenceException
IRegionReadyModule rrm = RequestModuleInterface<IRegionReadyModule>(); IRegionReadyModule rrm = RequestModuleInterface<IRegionReadyModule>();
rrm.TriggerRegionReady(this); rrm.TriggerRegionReady(this);
} }

View File

@ -214,6 +214,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
m_scene.LoginLock = false; m_scene.LoginLock = false;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!m_scene.StartDisabled) if (!m_scene.StartDisabled)
{ {
m_scene.LoginsEnabled = true; m_scene.LoginsEnabled = true;