aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-23 13:14:29 -0700
committerJohn Hurliman2009-10-23 13:14:29 -0700
commita41cd1d0695c01e4096fa0b7696b415a4c7455fc (patch)
treea942c2f79906a7de36e3fe363fba2f8130e9f8c3
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-a41cd1d0695c01e4096fa0b7696b415a4c7455fc.zip
opensim-SC_OLD-a41cd1d0695c01e4096fa0b7696b415a4c7455fc.tar.gz
opensim-SC_OLD-a41cd1d0695c01e4096fa0b7696b415a4c7455fc.tar.bz2
opensim-SC_OLD-a41cd1d0695c01e4096fa0b7696b415a4c7455fc.tar.xz
* 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
-rw-r--r--OpenSim/Data/DataPluginFactory.cs15
-rw-r--r--OpenSim/Framework/PluginLoader.cs9
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs10
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs10
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--bin/OpenSim.ini.example10
7 files changed, 44 insertions, 29 deletions
diff --git a/OpenSim/Data/DataPluginFactory.cs b/OpenSim/Data/DataPluginFactory.cs
index 718c6b2..841f71e 100644
--- a/OpenSim/Data/DataPluginFactory.cs
+++ b/OpenSim/Data/DataPluginFactory.cs
@@ -119,14 +119,15 @@ namespace OpenSim.Data
119 119
120 PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath); 120 PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath);
121 121
122 PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser); 122 using (PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser))
123 123 {
124 // loader will try to load all providers (MySQL, MSSQL, etc) 124 // loader will try to load all providers (MySQL, MSSQL, etc)
125 // unless it is constrainted to the correct "Provider" entry in the addin.xml 125 // unless it is constrainted to the correct "Provider" entry in the addin.xml
126 loader.Add(extensionPointPath, new PluginProviderFilter(provider)); 126 loader.Add(extensionPointPath, new PluginProviderFilter(provider));
127 loader.Load(); 127 loader.Load();
128 128
129 return loader.Plugins; 129 return loader.Plugins;
130 }
130 } 131 }
131 132
132 /// <summary> 133 /// <summary>
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index 5d38f5f..819cb7b 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -194,10 +194,15 @@ namespace OpenSim.Framework
194 } 194 }
195 } 195 }
196 196
197 /// <summary>
198 /// Unregisters Mono.Addins event handlers, allowing temporary Mono.Addins
199 /// data to be garbage collected. Since the plugins created by this loader
200 /// are meant to outlive the loader itself, they must be disposed separately
201 /// </summary>
197 public void Dispose() 202 public void Dispose()
198 { 203 {
199 foreach (T plugin in Plugins) 204 AddinManager.AddinLoadError -= on_addinloaderror_;
200 plugin.Dispose(); 205 AddinManager.AddinLoaded -= on_addinloaded_;
201 } 206 }
202 207
203 private void initialise_plugin_dir_(string dir) 208 private void initialise_plugin_dir_(string dir)
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index d63ac2e..113d5c8 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -115,11 +115,11 @@ namespace OpenSim.Grid.GridServer
115 115
116 protected virtual void LoadPlugins() 116 protected virtual void LoadPlugins()
117 { 117 {
118 PluginLoader<IGridPlugin> loader = 118 using (PluginLoader<IGridPlugin> loader = new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)))
119 new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)); 119 {
120 120 loader.Load("/OpenSim/GridServer");
121 loader.Load("/OpenSim/GridServer"); 121 m_plugins = loader.Plugins;
122 m_plugins = loader.Plugins; 122 }
123 } 123 }
124 124
125 public override void ShutdownSpecific() 125 public override void ShutdownSpecific()
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 3df3a1c..cc18f1a 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -162,11 +162,11 @@ namespace OpenSim
162 162
163 protected virtual void LoadPlugins() 163 protected virtual void LoadPlugins()
164 { 164 {
165 PluginLoader<IApplicationPlugin> loader = 165 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)))
166 new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)); 166 {
167 167 loader.Load("/OpenSim/Startup");
168 loader.Load("/OpenSim/Startup"); 168 m_plugins = loader.Plugins;
169 m_plugins = loader.Plugins; 169 }
170 } 170 }
171 171
172 protected override List<string> GetHelpTopics() 172 protected override List<string> GetHelpTopics()
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 232c9c9..1dd58bf 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -814,6 +814,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
814 // on to en-US to avoid number parsing issues 814 // on to en-US to avoid number parsing issues
815 Culture.SetCurrentCulture(); 815 Culture.SetCurrentCulture();
816 816
817 // Typecast the function to an Action<IClientAPI> once here to avoid allocating a new
818 // Action generic every round
819 Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler;
820
817 while (base.IsRunning) 821 while (base.IsRunning)
818 { 822 {
819 try 823 try
@@ -862,7 +866,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
862 866
863 // Handle outgoing packets, resends, acknowledgements, and pings for each 867 // Handle outgoing packets, resends, acknowledgements, and pings for each
864 // client. m_packetSent will be set to true if a packet is sent 868 // client. m_packetSent will be set to true if a packet is sent
865 m_scene.ClientManager.ForEachSync(ClientOutgoingPacketHandler); 869 m_scene.ClientManager.ForEachSync(clientPacketHandler);
866 870
867 // If nothing was sent, sleep for the minimum amount of time before a 871 // If nothing was sent, sleep for the minimum amount of time before a
868 // token bucket could get more tokens 872 // token bucket could get more tokens
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ee848bb..a3bc04b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1223,10 +1223,7 @@ namespace OpenSim.Region.Framework.Scenes
1223 if (!m_backingup) 1223 if (!m_backingup)
1224 { 1224 {
1225 m_backingup = true; 1225 m_backingup = true;
1226 1226 Util.FireAndForget(BackupWaitCallback);
1227 System.ComponentModel.BackgroundWorker backupWorker = new System.ComponentModel.BackgroundWorker();
1228 backupWorker.DoWork += delegate(object sender, System.ComponentModel.DoWorkEventArgs e) { Backup(); };
1229 backupWorker.RunWorkerAsync();
1230 } 1227 }
1231 } 1228 }
1232 1229
@@ -1239,6 +1236,14 @@ namespace OpenSim.Region.Framework.Scenes
1239 } 1236 }
1240 1237
1241 /// <summary> 1238 /// <summary>
1239 /// Wrapper for Backup() that can be called with Util.FireAndForget()
1240 /// </summary>
1241 private void BackupWaitCallback(object o)
1242 {
1243 Backup();
1244 }
1245
1246 /// <summary>
1242 /// Backup the scene. This acts as the main method of the backup thread. 1247 /// Backup the scene. This acts as the main method of the backup thread.
1243 /// </summary> 1248 /// </summary>
1244 /// <returns></returns> 1249 /// <returns></returns>
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index f426556..9ee9829 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1396,11 +1396,11 @@
1396[InterestManagement] 1396[InterestManagement]
1397 ; This section controls how state updates are prioritized for each client 1397 ; This section controls how state updates are prioritized for each client
1398 ; Valid values are Time, Distance, SimpleAngularDistance, and FrontBack 1398 ; Valid values are Time, Distance, SimpleAngularDistance, and FrontBack
1399 UpdatePrioritizationScheme = FrontBack; 1399 UpdatePrioritizationScheme = FrontBack
1400 ReprioritizationEnabled = true; 1400 ReprioritizationEnabled = true
1401 ReprioritizationInterval = 2000.0; 1401 ReprioritizationInterval = 2000.0
1402 RootReprioritizationDistance = 10.0; 1402 RootReprioritizationDistance = 10.0
1403 ChildReprioritizationDistance = 20.0; 1403 ChildReprioritizationDistance = 20.0
1404 1404
1405;; 1405;;
1406;; These are defaults that are overwritten below in [Architecture]. 1406;; These are defaults that are overwritten below in [Architecture].