diff options
author | James J Greensky | 2009-09-30 17:30:28 -0700 |
---|---|---|
committer | Melanie | 2009-10-01 04:11:32 +0100 |
commit | 44776fea723774f0674881d69855af9657398d18 (patch) | |
tree | 272546e38e5a21bcddaf5446c9a7bc07878596b4 | |
parent | Create j2k cache directory if it doesn't exist. The Meshmerizer needs it there. (diff) | |
download | opensim-SC_OLD-44776fea723774f0674881d69855af9657398d18.zip opensim-SC_OLD-44776fea723774f0674881d69855af9657398d18.tar.gz opensim-SC_OLD-44776fea723774f0674881d69855af9657398d18.tar.bz2 opensim-SC_OLD-44776fea723774f0674881d69855af9657398d18.tar.xz |
Fixing LLClientView memory leak
Fixing LLClientView memory leak by disposing of all timers utilized
in LLClientView as they contain references to the callback method.
This required the use of the Terminate and Close infrastructure that
was already in place but was not being utilized.
-rw-r--r-- | OpenSim/Framework/BlockingQueue.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 8 |
6 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index e03229b..857930a 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs | |||
@@ -66,7 +66,9 @@ namespace OpenSim.Framework | |||
66 | if (m_pqueue.Count > 0) | 66 | if (m_pqueue.Count > 0) |
67 | return m_pqueue.Dequeue(); | 67 | return m_pqueue.Dequeue(); |
68 | 68 | ||
69 | return m_queue.Dequeue(); | 69 | if (m_queue.Count > 0) |
70 | return m_queue.Dequeue(); | ||
71 | return default(T); | ||
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
@@ -119,6 +121,7 @@ namespace OpenSim.Framework | |||
119 | { | 121 | { |
120 | m_pqueue.Clear(); | 122 | m_pqueue.Clear(); |
121 | m_queue.Clear(); | 123 | m_queue.Clear(); |
124 | Monitor.Pulse(m_queueSync); | ||
122 | } | 125 | } |
123 | } | 126 | } |
124 | } | 127 | } |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 430cbd7..91a5d5c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -1127,7 +1127,6 @@ namespace OpenSim.Framework | |||
1127 | 1127 | ||
1128 | void SetClientOption(string option, string value); | 1128 | void SetClientOption(string option, string value); |
1129 | string GetClientOption(string option); | 1129 | string GetClientOption(string option); |
1130 | void Terminate(); | ||
1131 | 1130 | ||
1132 | void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters); | 1131 | void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters); |
1133 | void SendClearFollowCamProperties(UUID objectID); | 1132 | void SendClearFollowCamProperties(UUID objectID); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs index 665c773..09edc94 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
40 | /// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks, | 40 | /// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks, |
41 | /// resends, pings, etc.) | 41 | /// resends, pings, etc.) |
42 | /// </summary> | 42 | /// </summary> |
43 | public interface ILLPacketHandler | 43 | public interface ILLPacketHandler : IDisposable |
44 | { | 44 | { |
45 | event PacketStats OnPacketStats; | 45 | event PacketStats OnPacketStats; |
46 | event PacketDrop OnPacketDrop; | 46 | event PacketDrop OnPacketDrop; |
@@ -70,7 +70,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
70 | void OutPacket(Packet NewPack, | 70 | void OutPacket(Packet NewPack, |
71 | ThrottleOutPacketType throttlePacketType, Object id); | 71 | ThrottleOutPacketType throttlePacketType, Object id); |
72 | LLPacketQueue PacketQueue { get; } | 72 | LLPacketQueue PacketQueue { get; } |
73 | void Stop(); | ||
74 | void Flush(); | 73 | void Flush(); |
75 | void Clear(); | 74 | void Clear(); |
76 | ClientInfo GetClientInfo(); | 75 | ClientInfo GetClientInfo(); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 9788f40..460f94e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -633,6 +633,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
633 | // of the client thread regardless of where Close() is called. | 633 | // of the client thread regardless of where Close() is called. |
634 | KillEndDone(); | 634 | KillEndDone(); |
635 | } | 635 | } |
636 | |||
637 | Terminate(); | ||
636 | } | 638 | } |
637 | 639 | ||
638 | /// <summary> | 640 | /// <summary> |
@@ -737,16 +739,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
737 | 739 | ||
738 | } | 740 | } |
739 | 741 | ||
740 | public void Terminate() | 742 | private void Terminate() |
741 | { | 743 | { |
744 | IsActive = false; | ||
745 | |||
746 | m_clientPingTimer.Close(); | ||
747 | m_avatarTerseUpdateTimer.Close(); | ||
748 | m_primTerseUpdateTimer.Close(); | ||
749 | m_primFullUpdateTimer.Close(); | ||
750 | m_textureRequestTimer.Close(); | ||
751 | |||
742 | m_PacketHandler.OnPacketStats -= PopulateStats; | 752 | m_PacketHandler.OnPacketStats -= PopulateStats; |
743 | m_PacketHandler.Stop(); | 753 | m_PacketHandler.Dispose(); |
744 | 754 | ||
745 | // wait for thread stoped | 755 | // wait for thread stoped |
746 | m_clientThread.Join(); | 756 | // m_clientThread.Join(); |
747 | 757 | ||
748 | // delete circuit code | 758 | // delete circuit code |
749 | m_networkServer.CloseClient(this); | 759 | //m_networkServer.CloseClient(this); |
750 | } | 760 | } |
751 | 761 | ||
752 | #endregion | 762 | #endregion |
@@ -876,6 +886,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
876 | while (IsActive) | 886 | while (IsActive) |
877 | { | 887 | { |
878 | LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); | 888 | LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); |
889 | |||
890 | if (nextPacket == null) { | ||
891 | m_log.DebugFormat("[CLIENT]: PacketQueue return null LLQueItem"); | ||
892 | continue; | ||
893 | } | ||
879 | 894 | ||
880 | if (nextPacket.Incoming) | 895 | if (nextPacket.Incoming) |
881 | { | 896 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index eaf8f60..67ece75 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | |||
@@ -176,9 +176,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
176 | m_AckTimer.Start(); | 176 | m_AckTimer.Start(); |
177 | } | 177 | } |
178 | 178 | ||
179 | public void Stop() | 179 | public void Dispose() |
180 | { | 180 | { |
181 | m_AckTimer.Stop(); | 181 | m_AckTimer.Stop(); |
182 | m_AckTimer.Close(); | ||
182 | 183 | ||
183 | m_PacketQueue.Enqueue(null); | 184 | m_PacketQueue.Enqueue(null); |
184 | m_PacketQueue.Close(); | 185 | m_PacketQueue.Close(); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 798c1e7..6dd0697 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -39,7 +39,7 @@ using Timer=System.Timers.Timer; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.ClientStack.LindenUDP | 40 | namespace OpenSim.Region.ClientStack.LindenUDP |
41 | { | 41 | { |
42 | public class LLPacketQueue : IPullStatsProvider | 42 | public class LLPacketQueue : IPullStatsProvider, IDisposable |
43 | { | 43 | { |
44 | private static readonly ILog m_log | 44 | private static readonly ILog m_log |
45 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -342,11 +342,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
342 | 342 | ||
343 | public void Close() | 343 | public void Close() |
344 | { | 344 | { |
345 | Dispose(); | ||
346 | } | ||
347 | |||
348 | public void Dispose() | ||
349 | { | ||
345 | Flush(); | 350 | Flush(); |
346 | WipeClean(); // I'm sure there's a dirty joke in here somewhere. -AFrisby | 351 | WipeClean(); // I'm sure there's a dirty joke in here somewhere. -AFrisby |
347 | 352 | ||
348 | m_enabled = false; | 353 | m_enabled = false; |
349 | throttleTimer.Stop(); | 354 | throttleTimer.Stop(); |
355 | throttleTimer.Close(); | ||
350 | 356 | ||
351 | if (StatsManager.SimExtraStats != null) | 357 | if (StatsManager.SimExtraStats != null) |
352 | { | 358 | { |