Two types of memory issues

View: New views
2 Messages — Rating Filter:   Alert me  

Two types of memory issues

by jornare :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all!

I'm creating an app which is constantly creating worker-threads (as many as possible) using lots of CPU and heaps of memory allocations.

I have a AMD64bit server with 32GB RAM and 8 cores which it runs on. The program is compiled in .Visual Studio Express on Win64, copied to the server running mono 2.0.1  (C#)

After running a few hours I seem to constantly be running into the same memory issues, which I believe is with the garbage collector or the configuration of it. When it crashes it usually has a

Error 1)
"Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS"
This error usually seems to be associated with the StringBuilder class, and I have managed to overcome a few of the instances where it crashes by avoiding to use StringBuilder.

So, how do i Increase MAXINCHR and/or MAX_HEAP_SECTS? -And will this be a finite solution?

Error 2)
mmap(...PROT_NONE...) failed
Stacktrace:
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_object_new_f                 ast (intptr) <0x00048>
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_object_new_f                 ast (intptr) <0xffffffff>
  at ......

followed by


Native stacktrace:

        mono [0x428742]
        /usr/app/glibc/current/lib/libpthread.so.0 [0x7fb65b81d4b0]
        /usr/app/glibc/current/lib/libc.so.6(gsignal+0x3b) [0x7fb65b279ffb]
        /usr/app/glibc/current/lib/libc.so.6(abort+0x110) [0x7fb65b27b4e0]


Any ideas on this one?

Thanx,

jornare

Re: Two types of memory issues

by Basile Starynkevitch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


jornare wrote:
Error 1)
"Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS"
This error usually seems to be associated with the StringBuilder class, and I have managed to overcome a few of the instances where it crashes by avoiding to use StringBuilder.

So, how do i Increase MAXINCHR and/or MAX_HEAP_SECTS? -And will this be a finite solution?
You need to rebuild the Boehm's collector used in MONO. There is some configure options dealing with that.

I forgot the details, and I am not a Mono expert.

Perhaps future Mono releases (and even the current Mono trunk) provide a generational garbage collector which helps with that issue. So, you might try the Mono trunk, with its experimental GC enabled.
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***