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