add a few more gc collect in some spots

0.9.1.0-post-fixes
UbitUmarov 2018-09-29 17:42:12 +01:00
parent 5a0c9c2fcf
commit ed0e2623b9
8 changed files with 39 additions and 8 deletions

View File

@ -118,8 +118,6 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary> /// </summary>
string StatusDescription { get; set; } string StatusDescription { get; set; }
// bool ReuseContext { get; set; }
/// <summary> /// <summary>
/// Add a header field and content to the response. /// Add a header field and content to the response.
/// </summary> /// </summary>

View File

@ -31,6 +31,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
@ -508,7 +509,11 @@ namespace OpenSim.Framework.Servers
private void HandleForceGc(string module, string[] args) private void HandleForceGc(string module, string[] args)
{ {
Notice("Manually invoking runtime garbage collection"); Notice("Manually invoking runtime garbage collection");
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
} }
public virtual void HandleShow(string module, string[] cmd) public virtual void HandleShow(string module, string[] cmd)

View File

@ -30,6 +30,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Runtime;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Timers; using System.Timers;
@ -635,9 +636,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if(m_scene.GetNumberOfClients() == 0) if(m_scene.GetNumberOfClients() == 0)
{ {
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();
GC.Collect(); GC.Collect();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
} }
} }

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Reflection; using System.Reflection;
using System.Runtime;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Xml; using System.Xml;
@ -216,6 +217,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
CloseArchive(e.Message); CloseArchive(e.Message);
throw; throw;
} }
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
} }
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids, private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids,
@ -282,6 +289,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
assetGatherer.GatherAll(); assetGatherer.GatherAll();
GC.Collect();
int errors = assetGatherer.FailedUUIDs.Count; int errors = assetGatherer.FailedUUIDs.Count;
m_log.DebugFormat( m_log.DebugFormat(
"[ARCHIVER]: {0} region scene objects to save reference {1} possible assets", "[ARCHIVER]: {0} region scene objects to save reference {1} possible assets",
@ -313,6 +321,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
assetUuids[regionSettings.TerrainTexture4] = (sbyte)AssetType.Texture; assetUuids[regionSettings.TerrainTexture4] = (sbyte)AssetType.Texture;
Save(scene, sceneObjects, regionDir); Save(scene, sceneObjects, regionDir);
GC.Collect();
} }
/// <summary> /// <summary>

View File

@ -133,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_timeOutTimer .AutoReset = false; m_timeOutTimer .AutoReset = false;
m_timeOutTimer.Elapsed += OnTimeout; m_timeOutTimer.Elapsed += OnTimeout;
m_timeout = false; m_timeout = false;
int gccontrol = 0;
foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids) foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids)
{ {
@ -161,6 +162,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_foundAssetUuids.Add(asset.FullID); m_foundAssetUuids.Add(asset.FullID);
m_assetsArchiver.WriteAsset(PostProcess(asset)); m_assetsArchiver.WriteAsset(PostProcess(asset));
if(++gccontrol > 5000)
{
gccontrol = 0;
GC.Collect();
}
} }
catch (Exception e) catch (Exception e)
@ -180,6 +186,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.DebugFormat("[ARCHIVER]: Successfully added {0} assets ({1} of total possible assets requested were not found, were damaged or were not assets)", m_log.DebugFormat("[ARCHIVER]: Successfully added {0} assets ({1} of total possible assets requested were not found, were damaged or were not assets)",
m_foundAssetUuids.Count, totalerrors); m_foundAssetUuids.Count, totalerrors);
GC.Collect();
PerformAssetsRequestCallback(m_timeout); PerformAssetsRequestCallback(m_timeout);
} }

View File

@ -31,6 +31,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime;
using CSJ2K; using CSJ2K;
using Nini.Config; using Nini.Config;
@ -261,8 +262,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
m_colors.Clear(); m_colors.Clear();
m_warpTextures.Clear(); m_warpTextures.Clear();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect(); GC.Collect();
// m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); GC.WaitForPendingFinalizers();
GC.Collect();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
return bitmap; return bitmap;
} }

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Runtime;
using System.Net; using System.Net;
using System.IO; using System.IO;
using System.Text; using System.Text;
@ -214,9 +215,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
m_scene.LoginLock = false; m_scene.LoginLock = false;
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();
GC.Collect(); GC.Collect();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
if (!m_scene.StartDisabled) if (!m_scene.StartDisabled)
{ {

View File

@ -204,8 +204,7 @@ namespace OpenSim.Server.Base
xw.Flush(); xw.Flush();
ms.Seek(0, SeekOrigin.Begin); ms.Seek(0, SeekOrigin.Begin);
byte[] ret = ms.GetBuffer(); byte[] ret = ms.ToArray();
Array.Resize(ref ret, (int)ms.Length);
return ret; return ret;
} }
@ -579,10 +578,13 @@ namespace OpenSim.Server.Base
// Try to read it // Try to read it
try try
{ {
XmlReader r = XmlReader.Create(url); IConfigSource cs;
IConfigSource cs = new XmlConfigSource(r); using( XmlReader r = XmlReader.Create(url))
{
cs = new XmlConfigSource(r);
source.Merge(cs); source.Merge(cs);
} }
}
catch (Exception e) catch (Exception e)
{ {
m_log.FatalFormat("[SERVER UTILS]: Exception reading config from URI {0}\n" + e.ToString(), url); m_log.FatalFormat("[SERVER UTILS]: Exception reading config from URI {0}\n" + e.ToString(), url);