mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 11:25:39 +08:00
GC.GetTotalMemory(true) was blocking.
We now support individual scripts on individual prims. Do the script dance... \o/ \o\ /o/ \o/ .o.
This commit is contained in:
@@ -58,6 +58,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
/// <returns>Free AppDomain</returns>
|
||||
private AppDomainStructure GetFreeAppDomain()
|
||||
{
|
||||
Console.WriteLine("Finding free AppDomain");
|
||||
FreeAppDomains(); // Outsite lock, has its own GetLock
|
||||
lock (GetLock)
|
||||
{
|
||||
@@ -141,8 +142,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
// Find next available AppDomain to put it in
|
||||
AppDomainStructure FreeAppDomain = GetFreeAppDomain();
|
||||
|
||||
if (FreeAppDomain == null) Console.WriteLine("FreeAppDomain == null");
|
||||
if (FreeAppDomain.CurrentAppDomain == null) Console.WriteLine("FreeAppDomain.CurrentAppDomain == null");
|
||||
//if (FreeAppDomain == null) Console.WriteLine("FreeAppDomain == null");
|
||||
//if (FreeAppDomain.CurrentAppDomain == null) Console.WriteLine("FreeAppDomain.CurrentAppDomain == null");
|
||||
Console.WriteLine("Loading into AppDomain: " + FileName);
|
||||
LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
|
||||
//Type mytype = mbrt.GetType();
|
||||
Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt));
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
// TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager
|
||||
|
||||
// Hook up a test event to our test form
|
||||
//myScriptEngine.Log.Verbose("ScriptEngine", "EventManager Hooking up to server events");
|
||||
myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events");
|
||||
myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start);
|
||||
myScriptEngine.World.EventManager.OnRezScript += new OpenSim.Region.Environment.Scenes.EventManager.NewRezScript(OnRezScript);
|
||||
myScriptEngine.World.EventManager.OnRemoveScript += new OpenSim.Region.Environment.Scenes.EventManager.RemoveScript(OnRemoveScript);
|
||||
@@ -62,6 +62,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
// Add to queue for all scripts in ObjectID object
|
||||
//myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
|
||||
Console.WriteLine("touch_start localID: " + localID);
|
||||
myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 });
|
||||
}
|
||||
public void OnRezScript(uint localID, LLUUID itemID, string script)
|
||||
@@ -75,11 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
// new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
|
||||
//);
|
||||
Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length);
|
||||
myScriptEngine.myScriptManager.StartScript(
|
||||
localID,
|
||||
itemID,
|
||||
script
|
||||
);
|
||||
myScriptEngine.myScriptManager.StartScript(localID, itemID, script);
|
||||
|
||||
}
|
||||
public void OnRemoveScript(uint localID, LLUUID itemID)
|
||||
|
||||
@@ -241,7 +241,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
||||
// Do we have any scripts in this object at all? If not, return
|
||||
if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false)
|
||||
{
|
||||
Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (LLUUID itemID in myScriptEngine.myScriptManager.GetScriptKeys(localID))
|
||||
{
|
||||
|
||||
@@ -169,11 +169,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
//OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName);
|
||||
|
||||
//OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, localID);
|
||||
long before;
|
||||
before = GC.GetTotalMemory(true);
|
||||
|
||||
//long before;
|
||||
//before = GC.GetTotalMemory(true);
|
||||
LSL_BaseClass CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
|
||||
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
|
||||
before = GC.GetTotalMemory(true);
|
||||
//Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
|
||||
//before = GC.GetTotalMemory(true);
|
||||
|
||||
|
||||
//Script = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
|
||||
//Console.WriteLine("Script occupies {0} bytes", GC.GetTotalMemory(true) - before);
|
||||
//before = GC.GetTotalMemory(true);
|
||||
|
||||
Reference in New Issue
Block a user