[Mono-list] Problem with big arrays

Rodrigo Kumpera kumpera at gmail.com
Mon Aug 3 11:00:22 EDT 2009


BigArray support is not finished and very experimental.
You can contribute into finishing it, thou.

On Mon, Aug 3, 2009 at 9:15 AM, Yury Serdyuk <Yury at serdyuk.botik.ru> wrote:

> Hi !
>
> I have successfully configured and built Mono 2.4.2.3
> with enabling big arrays.
> Then I have tried a simple program like
>
> using System;
>
> public class MemoryTest {
>
>  public static void Main ( String[] args )   {
>
>  UInt64  n = (UInt64) ( Math.Pow ( 2, Convert.ToInt32 ( args [ 0 ] ) ) );
>
>  Console.WriteLine ( "Number of (long) elements = " + n );
>  Console.WriteLine ( "Total memory to use = " + ( n * sizeof ( long ) ) );
>
>  long[] ar = new long [ n ];
>
>  Console.WriteLine ( "Memory allocation done ..." );
>  Console.WriteLine ( "Array length = " + ar.Length.ToString() );
>
>  long size = Convert.ToInt64 ( ar.Length );
>
>  Console.WriteLine ( "size = " + size );
>
>  for ( long i = 0; i < size; i++ )
>  ar [ i ] = 0;
>
>  }
>
> }
>
> on the machine with 16 GB memory:
>
> > $ cat /proc/meminfo
> > MemTotal:     16441536 kB
> > MemFree:      15773996 kB
> > Buffers:           576 kB
> > Cached:         179904 kB
> > SwapCached:     207316 kB
> > Active:          85280 kB
> > Inactive:       310584 kB
> > SwapTotal:    78150736 kB
> > SwapFree:     77942284 kB
>
> > ]$ uname -a
> > Linux n3147.icyb 2.6.22.18-node3-lustre1.6.6 #3 SMP Wed Nov 12
> > 15:09:34 EET 2008 x86_64 x86_64 x86_64 GNU/Linux
>
>
> For input  like
>  >$ mono MemoryTest.exe 28
>
> i.e., for 2 GB array it works fine:
>
> > $ mono MemoryTest.exe 28
> > Number of (long) elements = 268435456
> > Total memory to use = 2147483648
> > Memory allocation done ...
> > Array length = 268435456
> > size = 268435456
>
> but for 4Gb array I got SIGSEGV:
>
> > ]$ mono MemoryTest.exe 29
> > Number of (long) elements = 536870912
> > Total memory to use = 4294967296
> > Memory allocation done ...
> > Array length = 536870912
> > size = 536870912
> > Stacktrace:
> >
> >
> > Native stacktrace:
> >
> >         mono [0x47e7a0]
> >         mono [0x4adb7d]
> >         /lib64/libpthread.so.0 [0x2b641fec6e60]
> >         mono [0x4bf5d8]
> >         mono(mono_g_hash_table_lookup+0x3a) [0x56d94a]
> >         mono(mono_type_get_object+0xa2) [0x4bb192]
> >         mono(mono_class_vtable+0x4dc) [0x4ca27c]
> >         mono(mono_array_new+0x31) [0x4ce131]
> >         mono [0x47c79f]
> >         mono [0x47da9f]
> >         mono [0x47d7e3]
> >         mono [0x4adbf8]
> >         [0x400104cc]
> >
> > Debug info from gdb:
> >
> >
> > =================================================================
> > Got a SIGSEGV while executing native code. This usually indicates
> > a fatal error in the mono runtime or one of the native libraries
> > used by your application.
> > =================================================================
> >
> > Aborted
>
> Is it a Mono bug or there are some special rules to deal with big arrays ?
>
> Thanks.
>
> Yury.
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090803/b78c5479/attachment-0001.html 


More information about the Mono-list mailing list