Mono throws OutOfMemoryException on Ubuntu but not

2019-08-27 17:53发布

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:

System.OutOfMemoryException: Out of memory.
  at (wrapper alloc) object:AllocVector (intptr,intptr)

It should not require more than a few MB of memory. The server has 4GB of RAM.

Running again under alloc profile gives a different exception:

System.OverflowException: Number overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)

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.

The program and full output can be downloaded at http://dev.intelorca.co.uk/2014/gacj_allocproblem.zip 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.

The program should output "Cambridge Surprise Major" 128 times.

1条回答
叼着烟拽天下
2楼-- · 2019-08-27 18:04

The problem was due to a bug in Mono's just-in-time compiler with the amd64 architecture. This has been fixed as of 3 Jan 2015.

Bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=25631
Fix: https://github.com/mono/mono/commit/9e03c10d8fefea9210ca015cf484e819623c0a1a

查看更多
登录 后发表回答