[Mono-list] Problems with arrays over 4gb on 64 bit Itanium

tiggger prokopp at gmail.com
Wed Dec 10 02:38:57 EST 2008


Hi,

I am running into an odd problem on a 64bit Itanium system. I compiled mono
from tarball (v1.9.1) and ran into some memory problems which I pinned down
with a test program. When I try to create an array that is bigger than 4gb
in size, e.g. a large double[,], I get an out of memory exception although
the system has far more memory. I tested if I am actually running in 64bit
by checking the pointer size in the program and it is 8 bytes.

Any help is welcome, thanks.

Cheers,
Christian


p.s. The test program:

static void Main(string[] args)
       {
           Console.WriteLine("SizeOf IntPtr is: {0}", IntPtr.Size);

           int iRows = 35750;
           int iCols = 15000;
           long bytes = 0;

           try
           {
               while (iRows < 37000)
               {
                   bytes = (long)iRows * (long)iCols * (long)sizeof(double);
                   double[,] Dbl = new double[iRows, iCols];
                   Dbl[0, 0] = 0;
                   Console.WriteLine(Convert.ToString(bytes / (1024 * 1024))
+ "MB allocated or double[" + iRows + "," + iCols + "]");
                   iRows += 250;
                   GC.Collect(2);
               }
           }
           catch (OutOfMemoryException e)
           {
               Console.WriteLine("Unable to allocate: " +
Convert.ToString(bytes / (1024 * 1024)) + "MB or double[" + iRows + "," +
iCols + "]");
               Console.WriteLine(e.Message);
           } 
-- 
View this message in context: http://www.nabble.com/Problems-with-arrays-over-4gb-on-64-bit-Itanium-tp20930391p20930391.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list