diff options
author | Justin Clark-Casey (justincc) | 2012-02-15 01:45:25 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-15 01:45:25 +0000 |
commit | ebe5e1731d24e68ec7a8aa61a397f5febc1c2662 (patch) | |
tree | e735ca22a967b6fc82e36678042dbc53db5bfee9 /OpenSim/Tests/Torture/ObjectTortureTests.cs | |
parent | Fix: get embedded objects from Notecard fails with activated FreeSwitchVoiceM... (diff) | |
download | opensim-SC-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.zip opensim-SC-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.tar.gz opensim-SC-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.tar.bz2 opensim-SC-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.tar.xz |
In ObjectTortureTests, run garbage collector on Teardown and run scene loop update when scene objects have been deleted.
At least on mono 2.6.4, running GC.Collect() is not guaranteed to force gc of all objects when run in the same method where those objects had references.
Therefore, GC.Collect() is now being done in the per-script teardown of ObjectTortureTests.
In addition, scene loop update is being run after garbage collection in order to clean out the viewer update list of scene objects in the SceneGraph.
These measures mean that scene objects/parts are now garbage collected after a test run if deleted from the scene, resulting in a much better memory usage report (though probably still not very accurate).
However, deletion takes a very long time - what's really needed is to find out now why the entire scene isn't being GC'd by this measure.
This change hasn't yet been applied to the other stress tests.
Diffstat (limited to 'OpenSim/Tests/Torture/ObjectTortureTests.cs')
-rw-r--r-- | OpenSim/Tests/Torture/ObjectTortureTests.cs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs index 74b336e..e83186a 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs | |||
@@ -49,6 +49,13 @@ namespace OpenSim.Tests.Torture | |||
49 | [TestFixture] | 49 | [TestFixture] |
50 | public class ObjectTortureTests | 50 | public class ObjectTortureTests |
51 | { | 51 | { |
52 | [TearDown] | ||
53 | public void TearDown() | ||
54 | { | ||
55 | GC.Collect(); | ||
56 | GC.WaitForPendingFinalizers(); | ||
57 | } | ||
58 | |||
52 | // [Test] | 59 | // [Test] |
53 | // public void Test0000Clean() | 60 | // public void Test0000Clean() |
54 | // { | 61 | // { |
@@ -141,8 +148,18 @@ namespace OpenSim.Tests.Torture | |||
141 | string.Format("Object {0} could not be retrieved", i)); | 148 | string.Format("Object {0} could not be retrieved", i)); |
142 | } | 149 | } |
143 | 150 | ||
144 | // This does not work to fire the SceneObjectGroup destructors - something else is hanging on to them. | 151 | // When a scene object is added to a scene, it is placed in the update list for sending to viewers |
145 | // scene.DeleteAllSceneObjects(); | 152 | // (though in this case we have none). When it is deleted, it is not removed from the update which is |
153 | // fine since it will later be ignored. | ||
154 | // | ||
155 | // However, that means that we need to manually run an update here to clear out that list so that deleted | ||
156 | // objects will be clean up by the garbage collector before the next stress test is run. | ||
157 | scene.Update(); | ||
158 | |||
159 | // Currently, we need to do this in order to garbage collect the scene objects ready for the next test run. | ||
160 | // However, what we really need to do is find out why the entire scene is not garbage collected in | ||
161 | // teardown. | ||
162 | scene.DeleteAllSceneObjects(); | ||
146 | 163 | ||
147 | Console.WriteLine( | 164 | Console.WriteLine( |
148 | "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", | 165 | "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", |