aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-23 13:45:18 -0700
committerJohn Hurliman2009-10-23 13:45:18 -0700
commit52a4534f7fe9e7b044a54f5a794391b54a1edb94 (patch)
treedc7983ac4a3890095bed8046d0dcec457ff08820 /OpenSim/Framework/Util.cs
parent* Unregister Mono.Addins event handlers in PluginLoader.Dispose() and always ... (diff)
downloadopensim-SC-52a4534f7fe9e7b044a54f5a794391b54a1edb94.zip
opensim-SC-52a4534f7fe9e7b044a54f5a794391b54a1edb94.tar.gz
opensim-SC-52a4534f7fe9e7b044a54f5a794391b54a1edb94.tar.bz2
opensim-SC-52a4534f7fe9e7b044a54f5a794391b54a1edb94.tar.xz
* Change the way Util.FireAndForget() calls SmartThreadPool to avoid using a delegate (which STP appears to hold on to). This removes the slow leak I was seeing when using async_call_method=SmartThreadPool and stabilizes allocated memory for an idle OpenSim instance
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index b96367a..10f38ab 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1347,7 +1347,7 @@ namespace OpenSim.Framework
1347 case FireAndForgetMethod.SmartThreadPool: 1347 case FireAndForgetMethod.SmartThreadPool:
1348 if (m_ThreadPool == null) 1348 if (m_ThreadPool == null)
1349 m_ThreadPool = new SmartThreadPool(2000, 15, 2); 1349 m_ThreadPool = new SmartThreadPool(2000, 15, 2);
1350 m_ThreadPool.QueueWorkItem(delegate(object o) { callback(o); return null; }, obj); 1350 m_ThreadPool.QueueWorkItem(SmartThreadPoolCallback, new object[] { callback, obj });
1351 break; 1351 break;
1352 case FireAndForgetMethod.Thread: 1352 case FireAndForgetMethod.Thread:
1353 Thread thread = new Thread(delegate(object o) { callback(o); }); 1353 Thread thread = new Thread(delegate(object o) { callback(o); });
@@ -1358,6 +1358,16 @@ namespace OpenSim.Framework
1358 } 1358 }
1359 } 1359 }
1360 1360
1361 private static object SmartThreadPoolCallback(object o)
1362 {
1363 object[] array = (object[])o;
1364 WaitCallback callback = (WaitCallback)array[0];
1365 object obj = array[1];
1366
1367 callback(obj);
1368 return null;
1369 }
1370
1361 #endregion FireAndForget Threading Pattern 1371 #endregion FireAndForget Threading Pattern
1362 } 1372 }
1363} 1373}