mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
* Unregister Mono.Addins event handlers in PluginLoader.Dispose() and always handle PluginLoader with the using pattern. This freed up 121,634,796 bytes on my system
* Avoid allocating an Action<IClientAPI> object every round of the OutgoingPacketHandler * Removed unnecessary semi-colon endings from OpenSim.ini.example [InterestManagement] section
This commit is contained in:
@@ -119,14 +119,15 @@ namespace OpenSim.Data
|
||||
|
||||
PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath);
|
||||
|
||||
PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser);
|
||||
using (PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser))
|
||||
{
|
||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||
loader.Add(extensionPointPath, new PluginProviderFilter(provider));
|
||||
loader.Load();
|
||||
|
||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||
loader.Add(extensionPointPath, new PluginProviderFilter(provider));
|
||||
loader.Load();
|
||||
|
||||
return loader.Plugins;
|
||||
return loader.Plugins;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -194,10 +194,15 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters Mono.Addins event handlers, allowing temporary Mono.Addins
|
||||
/// data to be garbage collected. Since the plugins created by this loader
|
||||
/// are meant to outlive the loader itself, they must be disposed separately
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (T plugin in Plugins)
|
||||
plugin.Dispose();
|
||||
AddinManager.AddinLoadError -= on_addinloaderror_;
|
||||
AddinManager.AddinLoaded -= on_addinloaded_;
|
||||
}
|
||||
|
||||
private void initialise_plugin_dir_(string dir)
|
||||
|
||||
@@ -115,11 +115,11 @@ namespace OpenSim.Grid.GridServer
|
||||
|
||||
protected virtual void LoadPlugins()
|
||||
{
|
||||
PluginLoader<IGridPlugin> loader =
|
||||
new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this));
|
||||
|
||||
loader.Load("/OpenSim/GridServer");
|
||||
m_plugins = loader.Plugins;
|
||||
using (PluginLoader<IGridPlugin> loader = new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)))
|
||||
{
|
||||
loader.Load("/OpenSim/GridServer");
|
||||
m_plugins = loader.Plugins;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ShutdownSpecific()
|
||||
|
||||
@@ -162,11 +162,11 @@ namespace OpenSim
|
||||
|
||||
protected virtual void LoadPlugins()
|
||||
{
|
||||
PluginLoader<IApplicationPlugin> loader =
|
||||
new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this));
|
||||
|
||||
loader.Load("/OpenSim/Startup");
|
||||
m_plugins = loader.Plugins;
|
||||
using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)))
|
||||
{
|
||||
loader.Load("/OpenSim/Startup");
|
||||
m_plugins = loader.Plugins;
|
||||
}
|
||||
}
|
||||
|
||||
protected override List<string> GetHelpTopics()
|
||||
|
||||
@@ -814,6 +814,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// on to en-US to avoid number parsing issues
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
// Typecast the function to an Action<IClientAPI> once here to avoid allocating a new
|
||||
// Action generic every round
|
||||
Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler;
|
||||
|
||||
while (base.IsRunning)
|
||||
{
|
||||
try
|
||||
@@ -862,7 +866,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
// Handle outgoing packets, resends, acknowledgements, and pings for each
|
||||
// client. m_packetSent will be set to true if a packet is sent
|
||||
m_scene.ClientManager.ForEachSync(ClientOutgoingPacketHandler);
|
||||
m_scene.ClientManager.ForEachSync(clientPacketHandler);
|
||||
|
||||
// If nothing was sent, sleep for the minimum amount of time before a
|
||||
// token bucket could get more tokens
|
||||
|
||||
@@ -1223,10 +1223,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!m_backingup)
|
||||
{
|
||||
m_backingup = true;
|
||||
|
||||
System.ComponentModel.BackgroundWorker backupWorker = new System.ComponentModel.BackgroundWorker();
|
||||
backupWorker.DoWork += delegate(object sender, System.ComponentModel.DoWorkEventArgs e) { Backup(); };
|
||||
backupWorker.RunWorkerAsync();
|
||||
Util.FireAndForget(BackupWaitCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1238,6 +1235,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_eventManager.TriggerOnFrame();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for Backup() that can be called with Util.FireAndForget()
|
||||
/// </summary>
|
||||
private void BackupWaitCallback(object o)
|
||||
{
|
||||
Backup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backup the scene. This acts as the main method of the backup thread.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user