title: Mono throws OutOfMemoryException on Ubuntu but not OSX or Windows
body: <p>I have installed Mono on an Ubuntu server and "Hello World" is working, but a simplified application that does some array handling and runs without problem under Mono on OSX or Windows is giving:</p>
  
  <pre><code>System.OutOfMemoryException: Out of memory.
    at (wrapper alloc) object:AllocVector (intptr,intptr)
  </code></pre>
  
  <p>It should not require more than a few MB of memory. The server has 4GB of RAM.</p>
  
  <p>Running again under alloc profile gives a different exception:</p>
  
  <pre><code>System.OverflowException: Number overflow.
    at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)
  </code></pre>
  
  <p>The problem is inconsistent, sometimes the code runs once but then not a second time. Sometimes it doesn't work for the first time. Sometimes it fails in a different method but for the same reason.</p>
  
  <p>The program and full output can be downloaded at <a href="http://dev.intelorca.co.uk/2014/gacj_allocproblem.zip" rel="nofollow">http://dev.intelorca.co.uk/2014/gacj_allocproblem.zip</a>
  It would be good to see if anyone else has problems running the program under mono and can provide any insight on what the problem is. Any pointers to configuring Mono to run better on Ubuntu would also be helpful.</p>
  
  <p>The program should output "Cambridge Surprise Major" 128 times.</p>