[Mono-list] Unable to create more than 1000 objects.

Dragony cschmid at rapidshare.com
Sun Dec 11 20:16:17 EST 2011


Hi.

I am running mono under linux Debian, newest version. I wonder if mono is
unable to use my 64 gb of ram equally. I need around 500 million objects,
each has around 100 bytes. I thought time has come where OOP can be used for
making my life easier, but seems not so :(

I managed to create 500 million empty objects, but as soon as I add
attributes, the number of objects I can create decreases drastically. I have
written a short program to show you what I mean.

PS: I tried sgen GC, this works a little bit better, which means it works
for the test program, but to create 500 million small objects its slow as
hell.....

using System;

class Test {
  static Unit[] units = new Unit[10000];
  static public void Main () {
    for (int i = 0; i < 10000; i++) units[i] = new Unit();
  }
}
  
class Unit {
// dummy array/crashes after/memory consumption when crashing
//  1 million = 955 units = 3822 mb
//  2 million = 905 units = 7243 mb
//  3 million = 887 units = 10645 mb
//  4 million = 856 units = 13699 mb
//  5 million = 510 units = 10200 mb
//  6 million = 515 units = 12361 mb
// 10 million = 508 units = 20321 mb
// 15 million = 508 units = 30481 mb
// 20 million = 508 units = 40641 mb
// 25 million = 508 units = 50802 mb
// 30 million = 508 units = 60960 mb

  int[] dummy = new int[1000000]; // Change this number to test. Above are
tested examples on a 64GB machine.
  static int units = 0;

  public Unit() {
    Console.WriteLine("Now having " + ++units + " units. " +
(GC.GetTotalMemory(false) / 1000000).ToString() + " MB");
  }
}

/* Above examples tested with:
Mono JIT compiler version 2.10.5 (Debian 2.10.5-1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors.
www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
*/



--
View this message in context: http://mono.1490590.n4.nabble.com/Unable-to-create-more-than-1000-objects-tp4184397p4184397.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list