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

Chris Seaton chris at chrisseaton.com
Wed May 16 11:58:54 EDT 2007


The problem is intermittent. I can work on my program all day and  
then suddenly it just starts failing. Stick a Console.WriteLine in  
and it works again. Then it stops again and I take it out and it  
works again!

Chris

On 16 May 2007, at 16:54, Ted Milker wrote:

> 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