[Ironruby-core] Memory Usage Tests
Peter Bacon Darwin
bacondarwin at googlemail.com
Sat Jul 12 09:59:33 EDT 2008
Additional info...
If you move the scriptRuntime.CreateScope method outside the loop then there
is no increase in memory.
Pete
-----Original Message-----
From: ironruby-core-bounces at rubyforge.org
[mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Aaron Clauson
Sent: Saturday,12 July 12, 2008 14:00
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Memory Usage Tests
Hi All,
In order to track down some high memory usage problems I have in a
server process that is using the IronRuby engine I have run a test using
a single line script and have encountered an issue that looks
suspiciously like a memory leak. I'm scouring through the IronRuby code
commenting out a few static lists as I find them to see if they make any
difference but to date haven't come across anything useful.
The test I'm running is:
static void Main(string[] args)
{
ScriptRuntime scriptRuntime = IronRuby.CreateRuntime();
for (int index = 0; index < 1000; index++)
{
ScriptScope rubyScope = scriptRuntime.CreateScope("IronRuby");
rubyScope.Execute("print 'execute\n'");
}
Console.WriteLine("finished");
Console.ReadLine();
}
Executing this three times on 3 separate runs the resultant process had
memory allocations of the folowing amounts as shown in the Windows Task
Manager:
31,940k
31,936k
31,936k
Executing the loop 10,000 times on 3 separate runs resulted in memory
usage of:
133,648k
134,036k
133,808k
Changing to
static void Main(string[] args)
{
for (int index = 0; index < 1000; index++)
{
Console.WriteLine("execute");
}
Console.WriteLine("finished");
Console.ReadLine();
}
For 1,000 iterations memory usage was 8,402k.
For 10,000 iterations memory usage was 8,704k.
For 1,000,000 iterations memory usage was 9,348.
The reason I'm looking into this is that I am having to jeep a close eye
on my server process and re-start it every 3 or 4 days when the memory
usage gets up to 300 to 400MB.
Regards,
Aaron
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core
More information about the Ironruby-core
mailing list