[Ironruby-core] Memory Leak with Certain Script Exceptions
lists at ruby-forum.com
Mon Jul 7 04:23:13 EDT 2008
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;
ScriptRuntime scriptRuntime = IronRuby.CreateRuntime();
rubyScope = scriptRuntime.CreateScope("IronRuby");
DialPlanHelper helper = new DialPlanHelper();
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.
Posted via http://www.ruby-forum.com/.
More information about the Ironruby-core