From 7b6b36cee930c61c5d760bbf6089b90567401468 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 25 Oct 2011 21:38:02 +0100
Subject: Fix bug where collision event listeners were not removed once the
listener had gone away.
This was causing continuous use of temporary memory even when all avatars had left the scene.
Memory does leak but it does cause more calls to the garbage collector, which would pause the scene thread for a very short while during collection.
---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 2b29ce4..c3279c6 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1633,6 +1633,8 @@ namespace OpenSim.Region.Physics.OdePlugin
///
internal void AddCollisionEventReporting(PhysicsActor obj)
{
+// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName);
+
lock (_collisionEventPrim)
{
if (!_collisionEventPrim.Contains(obj))
@@ -1646,11 +1648,10 @@ namespace OpenSim.Region.Physics.OdePlugin
///
internal void RemoveCollisionEventReporting(PhysicsActor obj)
{
+// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName);
+
lock (_collisionEventPrim)
- {
- if (!_collisionEventPrim.Contains(obj))
- _collisionEventPrim.Remove(obj);
- }
+ _collisionEventPrim.Remove(obj);
}
#region Add/Remove Entities
--
cgit v1.1