* Cleanup of some memory consuming items on ScenePresence.Close().
* Untangled a tangly shutdown loop for the ScenePresence. * Suggested to the Garbage Collector that this may be a good time to >.>, <.< *gasp* collect the memory.ThreadPoolClientBranch
parent
932a132116
commit
b77c48e75e
|
@ -267,7 +267,7 @@ namespace OpenSim.Region.ClientStack
|
|||
// We can't reach into other scenes and close the connection
|
||||
// We need to do this over grid communications
|
||||
//m_scene.CloseAllAgents(CircuitCode);
|
||||
|
||||
GC.Collect();
|
||||
m_clientThread.Abort();
|
||||
}
|
||||
|
||||
|
|
|
@ -1479,7 +1479,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle,
|
||||
avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y,
|
||||
avatar.AbsolutePosition.Z);
|
||||
m_sceneGridService.SendCloseChildAgentConnections(avatar);
|
||||
List<ulong> childknownRegions = new List<ulong>();
|
||||
List<ulong> ckn = avatar.GetKnownRegionList();
|
||||
for (int i = 0; i < ckn.Count; i++)
|
||||
{
|
||||
childknownRegions.Add(ckn[i]);
|
||||
}
|
||||
m_sceneGridService.SendCloseChildAgentConnections(agentID, childknownRegions);
|
||||
}
|
||||
|
||||
m_eventManager.TriggerClientClosed(agentID);
|
||||
|
@ -1554,6 +1560,22 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
||||
//m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
|
||||
}
|
||||
public void HandleRemoveKnownRegionsFromAvatar(LLUUID avatarID, List<ulong> regionslst)
|
||||
{
|
||||
ScenePresence av = GetScenePresence(avatarID);
|
||||
if (av != null)
|
||||
{
|
||||
lock (av)
|
||||
{
|
||||
|
||||
for (int i = 0; i < regionslst.Count; i++)
|
||||
{
|
||||
av.KnownChildRegions.Remove(regionslst[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void CloseAllAgents(uint circuitcode)
|
||||
{
|
||||
|
@ -1607,6 +1629,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_sceneGridService.OnRegionUp += OtherRegionUp;
|
||||
m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
|
||||
m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
|
||||
|
||||
|
||||
|
||||
|
@ -1620,6 +1643,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
public void UnRegisterReginWithComms()
|
||||
{
|
||||
m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
|
||||
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
|
||||
m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
m_sceneGridService.OnRegionUp -= OtherRegionUp;
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
public delegate void KillObjectDelegate(uint localID);
|
||||
|
||||
public delegate void RemoveKnownRegionsFromAvatarList(LLUUID avatarID, List<ulong> regionlst);
|
||||
|
||||
public class SceneCommunicationService //one instance per region
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -54,6 +56,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public event PrimCrossing OnPrimCrossingIntoRegion;
|
||||
public event RegionUp OnRegionUp;
|
||||
public event ChildAgentUpdate OnChildAgentUpdate;
|
||||
public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
|
||||
|
||||
|
||||
|
||||
|
@ -393,23 +396,23 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
d);
|
||||
}
|
||||
|
||||
public delegate void SendCloseChildAgentDelegate( ScenePresence presence);
|
||||
public delegate void SendCloseChildAgentDelegate( LLUUID agentID, List<ulong> regionlst);
|
||||
|
||||
/// <summary>
|
||||
/// This Closes child agents on neighboring regions
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
private void SendCloseChildAgentAsync(ScenePresence presence)
|
||||
private void SendCloseChildAgentAsync(LLUUID agentID, List<ulong> regionlst)
|
||||
{
|
||||
|
||||
foreach (ulong regionHandle in presence.KnownChildRegions)
|
||||
foreach (ulong regionHandle in regionlst)
|
||||
{
|
||||
bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId);
|
||||
bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
|
||||
|
||||
if (regionAccepted)
|
||||
{
|
||||
m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor");
|
||||
presence.RemoveNeighbourRegion(regionHandle);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -418,6 +421,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
}
|
||||
// We remove the list of known regions from the agent's known region list through an event
|
||||
// to scene, because, if an agent logged of, it's likely that there will be no scene presence
|
||||
// by the time we get to this part of the method.
|
||||
if (OnRemoveKnownRegionFromAvatar != null)
|
||||
{
|
||||
OnRemoveKnownRegionFromAvatar(agentID,regionlst);
|
||||
}
|
||||
}
|
||||
|
||||
private void SendCloseChildAgentCompleted(IAsyncResult iar)
|
||||
|
@ -426,11 +436,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public void SendCloseChildAgentConnections(ScenePresence presence)
|
||||
public void SendCloseChildAgentConnections(LLUUID agentID, List<ulong> regionslst)
|
||||
{
|
||||
// This assumes that we know what our neighbors are.
|
||||
SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
|
||||
d.BeginInvoke(presence,
|
||||
d.BeginInvoke(agentID, regionslst,
|
||||
SendCloseChildAgentCompleted,
|
||||
d);
|
||||
}
|
||||
|
@ -522,7 +532,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
|
||||
if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
|
||||
{
|
||||
SendCloseChildAgentConnections(avatar);
|
||||
SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -617,6 +617,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public List<ulong> GetKnownRegionList()
|
||||
{
|
||||
return m_knownChildRegions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
@ -1767,7 +1772,25 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
internal void Close()
|
||||
{
|
||||
lock (m_knownPrimUUID)
|
||||
{
|
||||
m_knownPrimUUID.Clear();
|
||||
}
|
||||
lock (m_knownChildRegions)
|
||||
{
|
||||
m_knownChildRegions.Clear();
|
||||
}
|
||||
lock (m_updateTimes)
|
||||
{
|
||||
m_updateTimes.Clear();
|
||||
}
|
||||
lock (m_partsUpdateQueue)
|
||||
{
|
||||
m_partsUpdateQueue.Clear();
|
||||
}
|
||||
|
||||
RemoveFromPhysicalScene();
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,17 @@ namespace OpenSim.Region.Environment.Types
|
|||
m_queue = new Queue<SceneObjectPart>();
|
||||
m_ids = new List<LLUUID>();
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
lock (m_ids)
|
||||
{
|
||||
m_ids.Clear();
|
||||
}
|
||||
lock (m_queue)
|
||||
{
|
||||
m_queue.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Enqueue(SceneObjectPart part)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue