* Added PhysicsScene.Dispose()

* In ODE, disposing of all of the ODE objects and the ODE World to reclaim memory when the simulator restarts.
ThreadPoolClientBranch
Teravus Ovares 2008-02-11 22:54:51 +00:00
parent 7647239f32
commit f603e57e9a
7 changed files with 45 additions and 1 deletions

View File

@ -472,6 +472,11 @@ namespace OpenSim.Region.Environment.Scenes
// This causes the region to restart immediatley. // This causes the region to restart immediatley.
public void RestartNow() public void RestartNow()
{ {
if (PhysicsScene != null)
{
PhysicsScene.Dispose();
}
m_log.Error("[REGION]: Closing"); m_log.Error("[REGION]: Closing");
Close(); Close();
m_log.Error("[REGION]: Firing Region Restart Message"); m_log.Error("[REGION]: Firing Region Restart Message");

View File

@ -75,6 +75,10 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
// Does nothing right now // Does nothing right now
} }
public override void Dispose()
{
}
public override PhysicsActor AddAvatar(string avName, PhysicsVector position) public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
{ {
BasicActor act = new BasicActor(); BasicActor act = new BasicActor();

View File

@ -409,7 +409,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
mesher = meshmerizer; mesher = meshmerizer;
} }
public override void Dispose()
{
}
public override PhysicsActor AddAvatar(string avName, PhysicsVector position) public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
{ {
PhysicsVector pos = new PhysicsVector(); PhysicsVector pos = new PhysicsVector();

View File

@ -81,6 +81,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract void DeleteTerrain(); public abstract void DeleteTerrain();
public abstract void Dispose();
public abstract bool IsThreaded { get; } public abstract bool IsThreaded { get; }
private class NullPhysicsScene : PhysicsScene private class NullPhysicsScene : PhysicsScene
@ -157,6 +159,10 @@ namespace OpenSim.Region.Physics.Manager
{ {
get { return false; } get { return false; }
} }
public override void Dispose()
{
}
} }
} }
} }

View File

@ -73,6 +73,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public void Dispose() public void Dispose()
{ {
d.CloseODE();
} }
} }
@ -1509,5 +1511,23 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void DeleteTerrain() public override void DeleteTerrain()
{ {
} }
public override void Dispose()
{
lock (OdeLock)
{
foreach (OdePrim prm in _prims)
{
RemovePrim(prm);
}
foreach (OdeCharacter act in _characters)
{
RemoveAvatar(act);
}
d.WorldDestroy(world);
//d.CloseODE();
}
}
} }
} }

View File

@ -77,7 +77,10 @@ namespace OpenSim.Region.Physics.POSPlugin
{ {
// Does nothing right now // Does nothing right now
} }
public override void Dispose()
{
}
public override PhysicsActor AddAvatar(string avName, PhysicsVector position) public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
{ {
POSCharacter act = new POSCharacter(); POSCharacter act = new POSCharacter();

View File

@ -88,7 +88,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{ {
// Does nothing right now // Does nothing right now
} }
public override void Dispose()
{
}
public override PhysicsActor AddAvatar(string avName, PhysicsVector position) public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
{ {