Also... If you only have the CreateScope method and not the Execute method in the loop then there is no memory increase. With both in the loop you get a linear increase in memory usage, even if you regularly force a Garbage Collection, of approximately 10K per iteration. Pete
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Clauson Sent: Saturday,12 July 12, 2008 14:00 To: [email protected] 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 [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core
