[Mono-list] OutOfMemory & Segmentation fault for Hashtable

Yury Serdyuk Yury at serdyuk.botik.ru
Tue Jan 25 07:16:32 EST 2011


Hi !

I would like to allocate a hashtable for more than 200 mln entries.
My test program is:

> using System;
> using System.Collections;
> public class HashTest {
>  public static void Main ( String[] args ) {
>   int N = Convert.ToInt32 ( args [ 0 ] ) * 1000000;
>   Console.WriteLine ( "N = " + N );
>   Hashtable hash = new Hashtable ( N );
>   long m = GC.GetTotalMemory(false);
>   Console.WriteLine ( "Total memory = " + m );
>  }
> }

A hashtable for 200 mln elements is allocated successfully and occupied 
nearly 5,5 Gb
(on machine with 32Gb memory):

> >mono HashTest.exe 200
> N = 200000000
> Total memory = 5333598208

But for N = 202 mln I have got

> >mono HashTest.exe 202
> N = 202000000
>
> Unhandled Exception: System.OutOfMemoryException: Out of memory
>   at (wrapper managed-to-native) 
> object:__icall_wrapper_mono_array_new_specific (intptr,int)
>   at System.Collections.Hashtable..ctor (Int32 capacity, Single 
> loadFactor, IHashCodeProvider hcp, IComparer comparer) [0x00000] in 
> <filename unknown>:0
>   at System.Collections.Hashtable..ctor (Int32 capacity, Single 
> loadFactor) [0x00000] in <filename unknown>:0
>   at System.Collections.Hashtable..ctor (Int32 capacity) [0x00000] in 
> <filename unknown>:0
>   at HashTest.Main (System.String[] args) [0x00000] in <filename 
> unknown>:0

I have used for the above tests Mono 2.8.2.

For Mono 2.10, I have

a )

> > mono HashTest.exe 202
> N = 202000000
>
> Unhandled Exception: OutOfMemoryException

b) with --enable-big-arrays

> $ mono HashTest.exe 202
> N = 202000000
> Stacktrace:
>
> Segmentation fault

Can I post a corresponding entry on the bugzilla?

Yury.


More information about the Mono-list mailing list