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.prioritization
parent
1eb6f99d19
commit
44776fea72
|
@ -66,7 +66,9 @@ namespace OpenSim.Framework
|
|||
if (m_pqueue.Count > 0)
|
||||
return m_pqueue.Dequeue();
|
||||
|
||||
return m_queue.Dequeue();
|
||||
if (m_queue.Count > 0)
|
||||
return m_queue.Dequeue();
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +121,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
m_pqueue.Clear();
|
||||
m_queue.Clear();
|
||||
Monitor.Pulse(m_queueSync);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1127,7 +1127,6 @@ namespace OpenSim.Framework
|
|||
|
||||
void SetClientOption(string option, string value);
|
||||
string GetClientOption(string option);
|
||||
void Terminate();
|
||||
|
||||
void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters);
|
||||
void SendClearFollowCamProperties(UUID objectID);
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks,
|
||||
/// resends, pings, etc.)
|
||||
/// </summary>
|
||||
public interface ILLPacketHandler
|
||||
public interface ILLPacketHandler : IDisposable
|
||||
{
|
||||
event PacketStats OnPacketStats;
|
||||
event PacketDrop OnPacketDrop;
|
||||
|
@ -70,7 +70,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
void OutPacket(Packet NewPack,
|
||||
ThrottleOutPacketType throttlePacketType, Object id);
|
||||
LLPacketQueue PacketQueue { get; }
|
||||
void Stop();
|
||||
void Flush();
|
||||
void Clear();
|
||||
ClientInfo GetClientInfo();
|
||||
|
|
|
@ -633,6 +633,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// of the client thread regardless of where Close() is called.
|
||||
KillEndDone();
|
||||
}
|
||||
|
||||
Terminate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -737,16 +739,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
private void Terminate()
|
||||
{
|
||||
IsActive = false;
|
||||
|
||||
m_clientPingTimer.Close();
|
||||
m_avatarTerseUpdateTimer.Close();
|
||||
m_primTerseUpdateTimer.Close();
|
||||
m_primFullUpdateTimer.Close();
|
||||
m_textureRequestTimer.Close();
|
||||
|
||||
m_PacketHandler.OnPacketStats -= PopulateStats;
|
||||
m_PacketHandler.Stop();
|
||||
m_PacketHandler.Dispose();
|
||||
|
||||
// wait for thread stoped
|
||||
m_clientThread.Join();
|
||||
// m_clientThread.Join();
|
||||
|
||||
// delete circuit code
|
||||
m_networkServer.CloseClient(this);
|
||||
//m_networkServer.CloseClient(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -876,6 +886,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
while (IsActive)
|
||||
{
|
||||
LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue();
|
||||
|
||||
if (nextPacket == null) {
|
||||
m_log.DebugFormat("[CLIENT]: PacketQueue return null LLQueItem");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nextPacket.Incoming)
|
||||
{
|
||||
|
|
|
@ -176,9 +176,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_AckTimer.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
public void Dispose()
|
||||
{
|
||||
m_AckTimer.Stop();
|
||||
m_AckTimer.Close();
|
||||
|
||||
m_PacketQueue.Enqueue(null);
|
||||
m_PacketQueue.Close();
|
||||
|
|
|
@ -39,7 +39,7 @@ using Timer=System.Timers.Timer;
|
|||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public class LLPacketQueue : IPullStatsProvider
|
||||
public class LLPacketQueue : IPullStatsProvider, IDisposable
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -341,12 +341,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Flush();
|
||||
WipeClean(); // I'm sure there's a dirty joke in here somewhere. -AFrisby
|
||||
|
||||
m_enabled = false;
|
||||
throttleTimer.Stop();
|
||||
throttleTimer.Close();
|
||||
|
||||
if (StatsManager.SimExtraStats != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue