[Ironruby-core] Memory Usage Tests

Aaron Clauson lists at ruby-forum.com
Sat Jul 12 10:30:04 EDT 2008

Peter Bacon Darwin wrote:
> Additional info...
> If you move the scriptRuntime.CreateScope method outside the loop then 
> there
> is no increase in memory.

But from my understanding of script scopes I need a new scope when using 
local variables. I can have multiple scripts executing on different 
threads with different local variables so as far as I'm aware creating a 
new scope each time is the only way to allow that?

static void Main(string[] args)
  ScriptRuntime scriptRuntime = IronRuby.CreateRuntime();

  for (int index = 0; index < 1000; index++)
    ScriptScope rubyScope = scriptRuntime.CreateScope("IronRuby");

    rubyScope.SetVariable("local1", "hello");
    rubyScope.SetVariable("local2", "world");

    rubyScope.Execute("print \"#{local1} #{local2}\n\"");



Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list