Hi!
I have downloaded the Mono 2.0 preview release today to make some performance comparisions with the MS Runtime. So I wrote a simple application to test massive object creation and the garbace collection auto-cleanup functionality:
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
namespace GarbageCollectionTest
{
class TestClass
{
private string mData;
public TestClass(int i)
{
mData = i.ToString();
}
/*~TestClass()
{
}*/
};
class Program
{
static void Main(string[] args)
{
DateTime start = DateTime.Now;
TestClass class1 = null;
for (int i = 0; i < 10000000; ++i)
{
class1 = new TestClass(i);
class1 = null;
}
Console.WriteLine("time elapsed: {0}", DateTime.Now.Subtract(start));
Console.ReadKey();
}
}
}
When I run this with the Microsoft Runtime it takes 2250ms.
With the mono runtime it took 4000ms.
The next thing I tried was to add an finalizer to my test class. I started the application with the MS Runtime and it took 5700 ms.
I started the same application with mono and it took 2 minutes while the memory usage was raising continually.
I think that there is a memory leak somewhere in the Mono GC implementation or is there something about the Mono GC that is different to the MS one I missed?
Thanks & Regards,
Urs