Curt Hagenlocher wrote:
> Are you continuously evaluating new bits of Ruby code? Is each
> execution in its own ScriptScope? In its own ScriptRuntime?
Yes pretty much. I have a bunch of users who can all have their own
little bit of script (the scripts are used as a dial plan on a SIP Proxy
server). At the moment a new runtime and scope is generated on for each
call received so the code per call is the equivalent of:
ScriptScope rubyScope = null;
try
{
ScriptRuntime scriptRuntime = IronRuby.CreateRuntime();
rubyScope = scriptRuntime.CreateScope("IronRuby");
DialPlanHelper helper = new DialPlanHelper();
rubyScope.SetVariable("sys", helper);
rubyScope.Execute(m_dialPlanScript);
}
finally
{
rubyScope.RemoveVariable("sys");
rubyScope = null;
}
I previously has the ScriptRuntime as a static object common across all
users thinking that that would make things quicker but since I've had
the porblems with memory leaking I've swapped that to being a local
variable as well.
The memory leak definitely only happens when the specific exceptions are
thrown. I can run 500 scripts containing an exception and increase the
process memory by 50MB. Running 500 scripts that don't generate an
exception does not budge the process memory.
Thanks,
Aaron
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core