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/Region | |
parent | Fix: get embedded objects from Notecard fails with activated FreeSwitchVoiceM... (diff) | |
download | opensim-SC_OLD-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.zip opensim-SC_OLD-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.tar.gz opensim-SC_OLD-ebe5e1731d24e68ec7a8aa61a397f5febc1c2662.tar.bz2 opensim-SC_OLD-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 '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 41 |
3 files changed, 47 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 693a79e..e66678a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -359,7 +359,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
359 | m_log.ErrorFormat( | 359 | m_log.ErrorFormat( |
360 | "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", | 360 | "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", |
361 | sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); | 361 | sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); |
362 | 362 | ||
363 | return false; | 363 | return false; |
364 | } | 364 | } |
365 | 365 | ||
@@ -368,12 +368,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
368 | // m_log.DebugFormat( | 368 | // m_log.DebugFormat( |
369 | // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", | 369 | // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", |
370 | // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); | 370 | // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); |
371 | 371 | ||
372 | return false; | 372 | return false; |
373 | } | 373 | } |
374 | 374 | ||
375 | // m_log.DebugFormat( | 375 | // m_log.DebugFormat( |
376 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", | 376 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", |
377 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); | 377 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); |
378 | 378 | ||
379 | SceneObjectPart[] parts = sceneObject.Parts; | 379 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -409,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | 409 | ||
410 | lock (SceneObjectGroupsByFullID) | 410 | lock (SceneObjectGroupsByFullID) |
411 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 411 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
412 | 412 | ||
413 | lock (SceneObjectGroupsByFullPartID) | 413 | lock (SceneObjectGroupsByFullPartID) |
414 | { | 414 | { |
415 | foreach (SceneObjectPart part in parts) | 415 | foreach (SceneObjectPart part in parts) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4c339d9..b130bf7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -303,6 +303,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
303 | 303 | ||
304 | // ~SceneObjectPart() | 304 | // ~SceneObjectPart() |
305 | // { | 305 | // { |
306 | // Console.WriteLine( | ||
307 | // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", | ||
308 | // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); | ||
306 | // m_log.DebugFormat( | 309 | // m_log.DebugFormat( |
307 | // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", | 310 | // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", |
308 | // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); | 311 | // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 80f198d..7737d8e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Threading; | ||
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
43 | [TestFixture] | 44 | [TestFixture] |
44 | public class SceneObjectBasicTests | 45 | public class SceneObjectBasicTests |
45 | { | 46 | { |
47 | // [TearDown] | ||
48 | // public void TearDown() | ||
49 | // { | ||
50 | // Console.WriteLine("TearDown"); | ||
51 | // GC.Collect(); | ||
52 | // Thread.Sleep(3000); | ||
53 | // } | ||
54 | |||
55 | // public class GcNotify | ||
56 | // { | ||
57 | // public static AutoResetEvent gcEvent = new AutoResetEvent(false); | ||
58 | // private static bool _initialized = false; | ||
59 | // | ||
60 | // public static void Initialize() | ||
61 | // { | ||
62 | // if (!_initialized) | ||
63 | // { | ||
64 | // _initialized = true; | ||
65 | // new GcNotify(); | ||
66 | // } | ||
67 | // } | ||
68 | // | ||
69 | // private GcNotify(){} | ||
70 | // | ||
71 | // ~GcNotify() | ||
72 | // { | ||
73 | // if (!Environment.HasShutdownStarted && | ||
74 | // !AppDomain.CurrentDomain.IsFinalizingForUnload()) | ||
75 | // { | ||
76 | // Console.WriteLine("GcNotify called"); | ||
77 | // gcEvent.Set(); | ||
78 | // new GcNotify(); | ||
79 | // } | ||
80 | // } | ||
81 | // } | ||
82 | |||
46 | /// <summary> | 83 | /// <summary> |
47 | /// Test adding an object to a scene. | 84 | /// Test adding an object to a scene. |
48 | /// </summary> | 85 | /// </summary> |
@@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
147 | public void TestDeleteSceneObject() | 184 | public void TestDeleteSceneObject() |
148 | { | 185 | { |
149 | TestHelpers.InMethod(); | 186 | TestHelpers.InMethod(); |
150 | 187 | ||
151 | TestScene scene = SceneHelpers.SetupScene(); | 188 | TestScene scene = SceneHelpers.SetupScene(); |
152 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
153 | scene.DeleteSceneObject(part.ParentGroup, false); | 190 | scene.DeleteSceneObject(part.ParentGroup, false); |
154 | 191 | ||
155 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 192 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
156 | Assert.That(retrievedPart, Is.Null); | 193 | Assert.That(retrievedPart, Is.Null); |
157 | } | 194 | } |