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>
string StatusDescription { get; set; }
// bool ReuseContext { get; set; }
/// <summary>
/// Add a header field and content to the response.
/// </summary>

View File

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

View File

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

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Runtime;
using System.Text.RegularExpressions;
using System.Threading;
using System.Xml;
@ -216,6 +217,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
CloseArchive(e.Message);
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,
@ -282,6 +289,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
assetGatherer.GatherAll();
GC.Collect();
int errors = assetGatherer.FailedUUIDs.Count;
m_log.DebugFormat(
"[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;
Save(scene, sceneObjects, regionDir);
GC.Collect();
}
/// <summary>

View File

@ -133,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_timeOutTimer .AutoReset = false;
m_timeOutTimer.Elapsed += OnTimeout;
m_timeout = false;
int gccontrol = 0;
foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids)
{
@ -161,6 +162,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_foundAssetUuids.Add(asset.FullID);
m_assetsArchiver.WriteAsset(PostProcess(asset));
if(++gccontrol > 5000)
{
gccontrol = 0;
GC.Collect();
}
}
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_foundAssetUuids.Count, totalerrors);
GC.Collect();
PerformAssetsRequestCallback(m_timeout);
}

View File

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

View File

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

View File

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