[Mono-bugs] [Bug 77165][Wis] New - Different performance of MONO GC

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jan 5 15:20:50 EST 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vindec1978 at libero.it.


--- shadow/77165	2006-01-05 15:20:50.000000000 -0500
+++ shadow/77165.tmp.26487	2006-01-05 15:20:50.000000000 -0500
@@ -0,0 +1,80 @@
+Bug#: 77165
+Product: Mono: Runtime
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: GC
+AssignedTo: lupus at ximian.com                            
+ReportedBy: vindec1978 at libero.it               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Different performance of MONO GC 
+Hi all, I am doing my master thesis on Mono and its performance with
+respect to .Net.
+For this reason, I am performing several tests which include running
+code compiled with both .Net and Mono (vesion using either
+the .Net or the Mono virtual machines.
+Among the features of Mono I am testing there is the it garbage
+collector works.
+To this end, I wrote a simple test (whose code follows) that is giving
+me some (apparently) strange results. The test works by repeatedly
+allocating, using and deallocating big chunks of memory as array of
+If I run this test under Linux I get an OutOfMemory exception after
+approximately 400 seconds. If I run the same test under the same
+version of Mono but on Windows, it correctly terminates after about
+435 seconds. Finally, if I run the test under .Net, it takes about
+2500 seconds to end. As far as I have seen, it seems that the garbage
+collector under Linux version of Mono is not working at all, is it
+possible? Have you got any clues to explain also why the .Net
+execution if so much slower (approximately 6 times) than the Mono
+version? I already tried to explicitly call the garbage collector
+using the GC.Collect() function, but I didn't get any substantial 
+I also try to run the same code but replacing the array with ArrayList 
+and in this case I have recived a fatal error if run the test on windows 
+and a "killed" write on terminal if I run the test on Linux.
+Thanks in advance for you help!
+using System;
+class MainClass
+       public static void Main(string[] args)
+       {
+               DateTime startTime;
+               DateTime stopTime;
+               TimeSpan elapsedTime;
+               long elapsedMilliseconds;
+               const int temp = 600;
+               const int numpersecond=30000000;
+               startTime = DateTime.Now;
+               for(int tmp = 0 ; tmp<temp ; tmp++){
+                       int [] array = new int[numpersecond];
+                       for(int i = 1;i<=numpersecond;i++){
+                               array[i-1] = tmp+i;
+                       }
+               }
+               stopTime = DateTime.Now;
+               elapsedTime = stopTime.Subtract(startTime);
+                       elapsedMilliseconds = 
+               Console.WriteLine("First allocation milliseconds : 
+       }

More information about the mono-bugs mailing list