[Mono-list] My program randomly doesn't work with Mono

Jonathan Gagnon jonathan.gagnon at croesus.com
Wed May 16 12:10:30 EDT 2007


It actually seems to have something to do with the OS, since I am unable to
reproduce the bug on Windows running Mono 1.2.3.1.  I only get the crash
when I run on Fedora Core 3.

Any ideas why?

Here's the exception I get, in case it could help :

Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS
Stacktrace:

  at (wrapper managed-to-native)
System.Object.__icall_wrapper_mono_array_new_specific (intptr,int) <0x00004>
  at (wrapper managed-to-native)
System.Object.__icall_wrapper_mono_array_new_specific (intptr,int)
<0xffffffff>
  at System.Collections.Hashtable..ctor
(int,single,System.Collections.IHashCodeProvider,System.Collections.ICompare
r) [0x00095] in
/root/RPM/mono-1.2.3.1/mcs/class/corlib/System.Collections/Hashtable.cs:154
  at System.Collections.Hashtable..ctor (int,single) [0x00000] in
/root/RPM/mono-1.2.3.1/mcs/class/corlib/System.Collections/Hashtable.cs:164
  at System.Collections.Hashtable..ctor () [0x00000] in
/root/RPM/mono-1.2.3.1/mcs/class/corlib/System.Collections/Hashtable.cs:133
  at System.Runtime.Remoting.Contexts.Context..cctor () <0x00019>
  at (wrapper runtime-invoke) System.Object.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono [0x8147e11]
        [0xffffe600]
        /lib/tls/i686/libc.so.6(abort+0xe4) [0x5563ee50]
        mono [0x8107944]
        mono [0x8101cd5]
        mono [0x8101e92]
        mono [0x8102109]
        mono [0x8102230]
        mono [0x8104585]
        mono [0x8104634]
        mono [0x81048be]
        mono(mono_array_new_specific+0xb3) [0x808b1cb]
        [0x55e8dbea]
        [0x55e8e0cb]
        [0x55e8ddd3]
        [0x55e8dab5]
        [0x55e8eae2]
        [0x55e8daf6]
        mono(mono_runtime_class_init+0x259) [0x808a2c9]
        mono [0x8133b69]
        mono [0x809ea7e]
        mono [0x809f99f]
        mono [0x80b6b45]
        mono [0x80f87aa]
        mono [0x810b5a9]
        /lib/tls/i686/libpthread.so.0 [0x555e8080]
        /lib/tls/i686/libc.so.6(__clone+0x5e) [0x556ce23e]


Jonathan

-----Message d'origine-----
De : mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] De la part de Ted Milker
Envoyé : Wednesday, May 16, 2007 11:55 AM
À : mono-list at lists.ximian.com
Objet : Re: [Mono-list] My program randomly doesn't work with Mono

Just an FYI but none of these crash on FreeBSD 6.2 running mono 1.2.3.1

Jonathan Gagnon wrote:
> Hi,
>
> I too have different behaviors if I put a Console.WriteLine in my code.
> Consider the following example :
>
> static void Main(string[] args)
> {
>     int num = 5000000;
>     Hashtable table = new Hashtable();
>     for (int i = 0; i < num; ++i)
>     {
>         Object obj = new Object();
>         table.Add(obj, obj);
>     }
> }
>
> That crashes somewhere inside the for loop.  But if I add a WriteLine 
> at the beginning like this :
>
> static void Main(string[] args)
> {
>     int num = 5000000;
>     Console.WriteLine("WriteLine");
>     Hashtable table = new Hashtable();
>     for (int i = 0; i < num; ++i)
>     {
>         Object obj = new Object();
>         table.Add(obj, obj);
>     }
> }
>
> Everything works fine.  Then if I add another WriteLine at the end 
> followed by a Thread.Sleep, it crashes again, but this time inside the
Thread.Sleep :
>
> static void Main(string[] args)
> {
>     int num = 5000000;
>     Console.WriteLine("WriteLine");
>     Hashtable table = new Hashtable();
>     for (int i = 0; i < num; ++i)
>     {
>         Object obj = new Object();
>         table.Add(obj, obj);
>     }
>     Console.WriteLine("WriteLine");
>     Thread.Sleep(10000);
> }
>
> Any modifications to that code may lead to different behaviors.  
> Sometimes I seem to end up being stuck in a infinite loop (with 2.8 
> gig of allocated virtual memory).  It seems like the size of the 
> executable has an impact on the result...
>   

_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list