[Mono-devel-list] Issue to allocate more than 1Gb of memory with mono

Joannes Vermorel vermorel at clipper.ens.fr
Thu Mar 17 10:55:35 EST 2005


I am running mono on a bi-AMD64 machine with 8Gb of memory under linux
redhat (64bit OS). I do not succeed in allocating more than 1Gb of memory
with mono (see my little program here below).

Can someone help me about this issue. I have several tasks that requires
to handle more than 1Gb of memory.

Thanks,
Joannès


----------------------------------------
$ mono --version
Mono JIT compiler version 1.1.3, (C) 2002-2004 Novell, Inc and
Contributors. www.go-mono.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV      : normal
        Globalization: none


----------------------------------------
$ mono MemoryChecker.exe
Pointer size(in bytes): 8
Max Mb block allocated: 1039
System.OutOfMemoryException: Out of memory in <0x67f4d03b> (wrapper
managed-to-native) System.Object:__icall_wrapper_mono_array_new_specific
(intptr,int) in <0x0000f> (wrapper managed-to-native)
System.Object:__icall_wrapper_mono_array_new_specific (intptr,int) in
<0x000c3> MemoryChecker.MemoryChecker:Main (string[])


----------------------------------------
class MemoryChecker
{
	public const int MB = 1000000;

	[STAThread]
	static void Main(string[] args)
	{
		Console.WriteLine("Pointer size(in bytes): {0}",
IntPtr.Size);

		byte[][] bigArray = new byte[10000][];

		int index = 0;
		while(true)
		{
			try
			{
				bigArray[index++] = new byte[MB];
			}
			catch(Exception e)
			{
				Console.WriteLine("Max Mb block allocated:
{0}", index);
				Console.WriteLine(e);
				break;
			}

		}
	}
}






More information about the Mono-devel-list mailing list