Xengine: remove option CompactMemOnLoad, that wasn't that good; add option AttachmentsDomainLoading to allow attachments to load on own appdomain even if AppDomainLoading is false. Scripts will be slower, use more memory but will be disposed on avatar leave, if gc is in good mood. This may be usefull on regions with a lot of traffic, sure use Yengine even better,
parent
0c716cbd73
commit
be5c2bb212
|
@ -110,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
private int m_ScriptFailCount; // Number of script fails since compile queue was last empty
|
private int m_ScriptFailCount; // Number of script fails since compile queue was last empty
|
||||||
private string m_ScriptErrorMessage;
|
private string m_ScriptErrorMessage;
|
||||||
private bool m_AppDomainLoading;
|
private bool m_AppDomainLoading;
|
||||||
private bool m_CompactMemOnLoad;
|
private bool m_AttachmentsDomainLoading;
|
||||||
private Dictionary<UUID,ArrayList> m_ScriptErrors =
|
private Dictionary<UUID,ArrayList> m_ScriptErrors =
|
||||||
new Dictionary<UUID,ArrayList>();
|
new Dictionary<UUID,ArrayList>();
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_StackSize = m_ScriptConfig.GetInt("ThreadStackSize", 262144);
|
m_StackSize = m_ScriptConfig.GetInt("ThreadStackSize", 262144);
|
||||||
m_SleepTime = m_ScriptConfig.GetInt("MaintenanceInterval", 10) * 1000;
|
m_SleepTime = m_ScriptConfig.GetInt("MaintenanceInterval", 10) * 1000;
|
||||||
m_AppDomainLoading = m_ScriptConfig.GetBoolean("AppDomainLoading", false);
|
m_AppDomainLoading = m_ScriptConfig.GetBoolean("AppDomainLoading", false);
|
||||||
m_CompactMemOnLoad = m_ScriptConfig.GetBoolean("CompactMemOnLoad", false);
|
m_AttachmentsDomainLoading = m_ScriptConfig.GetBoolean("AttachmentsDomainLoading", false);
|
||||||
m_EventLimit = m_ScriptConfig.GetInt("EventLimit", 30);
|
m_EventLimit = m_ScriptConfig.GetInt("EventLimit", 30);
|
||||||
m_KillTimedOutScripts = m_ScriptConfig.GetBoolean("KillTimedOutScripts", false);
|
m_KillTimedOutScripts = m_ScriptConfig.GetBoolean("KillTimedOutScripts", false);
|
||||||
m_SaveTime = m_ScriptConfig.GetInt("SaveInterval", 120) * 1000;
|
m_SaveTime = m_ScriptConfig.GetInt("SaveInterval", 120) * 1000;
|
||||||
|
@ -1295,22 +1295,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// optionaly do not load a assembly on top of a lot of to release memory
|
|
||||||
// only if logins disable since causes a lot of rubber banding
|
|
||||||
if(m_CompactMemOnLoad && !m_Scene.LoginsEnabled)
|
|
||||||
GC.Collect(2);
|
|
||||||
|
|
||||||
ScriptInstance instance = null;
|
ScriptInstance instance = null;
|
||||||
lock (m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
// Create the object record
|
// Create the object record
|
||||||
if ((!m_Scripts.ContainsKey(itemID)) ||
|
if ((!m_Scripts.ContainsKey(itemID)) || (m_Scripts[itemID].AssetID != assetID))
|
||||||
(m_Scripts[itemID].AssetID != assetID))
|
|
||||||
{
|
{
|
||||||
// UUID appDomain = assetID;
|
|
||||||
|
|
||||||
// if (part.ParentGroup.IsAttachment)
|
bool attachDomains = m_AttachmentsDomainLoading && part.ParentGroup.IsAttachmentCheckFull();
|
||||||
// appDomain = part.ParentGroup.RootPart.UUID;
|
|
||||||
UUID appDomain = part.ParentGroup.RootPart.UUID;
|
UUID appDomain = part.ParentGroup.RootPart.UUID;
|
||||||
|
|
||||||
if (!m_AppDomains.ContainsKey(appDomain))
|
if (!m_AppDomains.ContainsKey(appDomain))
|
||||||
|
@ -1318,7 +1310,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AppDomain sandbox;
|
AppDomain sandbox;
|
||||||
if (m_AppDomainLoading)
|
if (m_AppDomainLoading || attachDomains)
|
||||||
{
|
{
|
||||||
AppDomainSetup appSetup = new AppDomainSetup();
|
AppDomainSetup appSetup = new AppDomainSetup();
|
||||||
appSetup.PrivateBinPath = Path.Combine(
|
appSetup.PrivateBinPath = Path.Combine(
|
||||||
|
@ -1349,7 +1341,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
//sandbox.SetAppDomainPolicy(sandboxPolicy);
|
//sandbox.SetAppDomainPolicy(sandboxPolicy);
|
||||||
|
|
||||||
m_AppDomains[appDomain] = sandbox;
|
m_AppDomains[appDomain] = sandbox;
|
||||||
|
|
||||||
m_DomainScripts[appDomain] = new List<UUID>();
|
m_DomainScripts[appDomain] = new List<UUID>();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -1366,6 +1357,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DomainScripts[appDomain].Add(itemID);
|
m_DomainScripts[appDomain].Add(itemID);
|
||||||
|
|
||||||
IScript scriptObj = null;
|
IScript scriptObj = null;
|
||||||
|
@ -1616,13 +1608,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
UnloadAppDomain(instance.AppDomain);
|
UnloadAppDomain(instance.AppDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
OnObjectRemoved?.Invoke(instance.ObjectID);
|
||||||
if (handlerObjectRemoved != null)
|
OnScriptRemoved?.Invoke(itemID);
|
||||||
handlerObjectRemoved(instance.ObjectID);
|
|
||||||
|
|
||||||
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
|
|
||||||
if (handlerScriptRemoved != null)
|
|
||||||
handlerScriptRemoved(itemID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnScriptReset(uint localID, UUID itemID)
|
public void OnScriptReset(uint localID, UUID itemID)
|
||||||
|
|
|
@ -1800,6 +1800,10 @@
|
||||||
; so default is now false until a fix is found
|
; so default is now false until a fix is found
|
||||||
; AppDomainLoading = false
|
; AppDomainLoading = false
|
||||||
|
|
||||||
|
; Set this to true to load attachment scripts in separated domain, if AppDomainLoading is false
|
||||||
|
; same issues as AppDomainLoading, but my be usefull on regions with a lot of avatars traffic, if they carry scripts like AOs
|
||||||
|
; AppDomainLoading = false
|
||||||
|
|
||||||
; Controls whether previously compiled scripts DLLs are deleted on sim restart.
|
; Controls whether previously compiled scripts DLLs are deleted on sim restart.
|
||||||
; If you set this to false then startup will be considerably faster since scripts won't need to be recompiled.
|
; If you set this to false then startup will be considerably faster since scripts won't need to be recompiled.
|
||||||
; It should be true on first run after updating opensim binary version
|
; It should be true on first run after updating opensim binary version
|
||||||
|
@ -1808,12 +1812,6 @@
|
||||||
; This does not delete cached scripts state.
|
; This does not delete cached scripts state.
|
||||||
; DeleteScriptsOnStartup = true
|
; DeleteScriptsOnStartup = true
|
||||||
|
|
||||||
; CompactMemOnLoad
|
|
||||||
; forces calls to memory garbage collector before loading each script DLL during region startup.
|
|
||||||
; Peak memory usage is reduced and region starts with a more compacted memory allocation.
|
|
||||||
; But this costs a lot of time, so region load will take a lot longer.
|
|
||||||
; it is more usefull if there are no previously compiled scripts DLLs (or DeleteScriptsOnStartup = true)
|
|
||||||
; CompactMemOnLoad = false
|
|
||||||
|
|
||||||
; Controls whether scripts are stopped by aborting their threads externally (abort)
|
; Controls whether scripts are stopped by aborting their threads externally (abort)
|
||||||
; or by co-operative checks inserted by OpenSimulator into compiled script (co-op).
|
; or by co-operative checks inserted by OpenSimulator into compiled script (co-op).
|
||||||
|
|
Loading…
Reference in New Issue