diff options
author | Tedd Hansen | 2007-08-25 15:31:47 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-08-25 15:31:47 +0000 |
commit | 53be4774b32f6736373c1364c3bd659c977fbb4e (patch) | |
tree | c81bbc0d41b375bcc403c574da612d18b038c228 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler | |
parent | Hopefully fixed the bugs in primitives rotation editing (diff) | |
download | opensim-SC_OLD-53be4774b32f6736373c1364c3bd659c977fbb4e.zip opensim-SC_OLD-53be4774b32f6736373c1364c3bd659c977fbb4e.tar.gz opensim-SC_OLD-53be4774b32f6736373c1364c3bd659c977fbb4e.tar.bz2 opensim-SC_OLD-53be4774b32f6736373c1364c3bd659c977fbb4e.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | 18 |
2 files changed, 39 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index bfb8913..cb0f9ba 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -5,14 +5,33 @@ using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | |||
5 | using OpenSim.Region.ScriptEngine.Common; | 5 | using OpenSim.Region.ScriptEngine.Common; |
6 | using System.Threading; | 6 | using System.Threading; |
7 | using System.Reflection; | 7 | using System.Reflection; |
8 | 8 | using System.Runtime.Remoting.Lifetime; | |
9 | 9 | ||
10 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 10 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
11 | { | 11 | { |
12 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript | 12 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript |
13 | { | 13 | { |
14 | |||
15 | // Object never expires | ||
16 | public override Object InitializeLifetimeService() | ||
17 | { | ||
18 | Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); | ||
19 | // return null; | ||
20 | ILease lease = (ILease)base.InitializeLifetimeService(); | ||
21 | |||
22 | if (lease.CurrentState == LeaseState.Initial) | ||
23 | { | ||
24 | lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); | ||
25 | //lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); | ||
26 | //lease.RenewOnCallTime = TimeSpan.FromSeconds(2); | ||
27 | } | ||
28 | return lease; | ||
29 | } | ||
30 | |||
31 | |||
14 | private Executor m_Exec; | 32 | private Executor m_Exec; |
15 | public Executor Exec { | 33 | public Executor Exec |
34 | { | ||
16 | get | 35 | get |
17 | { | 36 | { |
18 | if (m_Exec == null) | 37 | if (m_Exec == null) |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index ca51542..187ac59 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -7,6 +7,7 @@ using OpenSim.Region.Environment.Scenes.Scripting; | |||
7 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 7 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; |
8 | using OpenSim.Region.ScriptEngine.Common; | 8 | using OpenSim.Region.ScriptEngine.Common; |
9 | using OpenSim.Framework.Console; | 9 | using OpenSim.Framework.Console; |
10 | using System.Runtime.Remoting.Lifetime; | ||
10 | 11 | ||
11 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | 12 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler |
12 | { | 13 | { |
@@ -35,6 +36,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
35 | return m_state; | 36 | return m_state; |
36 | } | 37 | } |
37 | 38 | ||
39 | // Object never expires | ||
40 | public override Object InitializeLifetimeService() | ||
41 | { | ||
42 | Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); | ||
43 | // return null; | ||
44 | ILease lease = (ILease)base.InitializeLifetimeService(); | ||
45 | |||
46 | if (lease.CurrentState == LeaseState.Initial) | ||
47 | { | ||
48 | lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); | ||
49 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); | ||
50 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(2); | ||
51 | } | ||
52 | return lease; | ||
53 | } | ||
54 | |||
55 | |||
38 | public Scene World | 56 | public Scene World |
39 | { | 57 | { |
40 | get { return m_manager.World; } | 58 | get { return m_manager.World; } |