mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
Scripts no longer crash sim after 5 minutes (override InitializeLifetimeService). Loading/Unloading of scripts are now handled in separate thread so server is no delayed because of this. Each script is loaded into a single AppDomain (temporary test for script unload, eats ~15KB more memory for each script). Unload of scripts has been verified to free up memory.
This commit is contained in:
@@ -5,14 +5,33 @@ using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
{
|
||||
public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
|
||||
{
|
||||
|
||||
// Object never expires
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()");
|
||||
// return null;
|
||||
ILease lease = (ILease)base.InitializeLifetimeService();
|
||||
|
||||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
|
||||
//lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
|
||||
//lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
return lease;
|
||||
}
|
||||
|
||||
|
||||
private Executor m_Exec;
|
||||
public Executor Exec {
|
||||
public Executor Exec
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Exec == null)
|
||||
|
||||
@@ -7,6 +7,7 @@ using OpenSim.Region.Environment.Scenes.Scripting;
|
||||
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using OpenSim.Framework.Console;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||
{
|
||||
@@ -35,6 +36,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||
return m_state;
|
||||
}
|
||||
|
||||
// Object never expires
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
|
||||
// return null;
|
||||
ILease lease = (ILease)base.InitializeLifetimeService();
|
||||
|
||||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
|
||||
// lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
|
||||
// lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
return lease;
|
||||
}
|
||||
|
||||
|
||||
public Scene World
|
||||
{
|
||||
get { return m_manager.World; }
|
||||
|
||||
Reference in New Issue
Block a user