[Mono-bugs] [Bug 81573][Nor] New - Out of memory error when using ThreadPool.QueueUserWorkItem
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue May 8 23:15:16 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by hanibal_li3 at hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=81573
--- shadow/81573 2007-05-08 23:15:16.000000000 -0400
+++ shadow/81573.tmp.17602 2007-05-08 23:15:16.000000000 -0400
@@ -0,0 +1,107 @@
+Bug#: 81573
+Product: Mono: Class Libraries
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: hanibal_li3 at hotmail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Out of memory error when using ThreadPool.QueueUserWorkItem
+
+Description of Problem:
+The Application runs normally using .net framework. it crashes using Mono.
+the application uses QueueUserWorkItem function to create 56 threads that
+do a simple counting.
+
+Steps to reproduce the problem:
+compile the following code:
+/////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+using System;
+using System.Text;
+using System.Threading;
+
+namespace ThreadPool1
+{
+ class MainClass
+ {
+
+ static void Main(string[] args)
+ {
+ for(int i = 1; i < 56; i++)
+ {
+ try
+ {
+ ThreadPool.QueueUserWorkItem(new
+WaitCallback(StartMethod));
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ Console.WriteLine(ex.StackTrace);
+ Console.ReadLine();
+ }
+ Thread.Sleep(100);
+ }
+
+ Console.ReadLine();
+
+ }
+
+ static void StartMethod(Object stateInfo)
+ {
+ DisplayNumbers(DateTime.Now.Millisecond.ToString
+());
+ Console.WriteLine("Thread Finished");
+ }
+
+ static void DisplayNumbers(string GivenThreadName)
+ {
+ Console.WriteLine("Starting thread: " +
+GivenThreadName);
+
+ for (int i = 1; i <= 800; i++)
+ {
+ if (i % 100 == 0)
+ {
+ Console.WriteLine("thread: " +
+GivenThreadName + " Count " + i);
+ Thread.Sleep(1000);
+ }
+ }
+ }
+
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+
+
+
+
+
+Actual Results:
+
+-Out of memory error + exception
+
+Expected Results:
+Finish execution normally
+
+How often does this happen?
+
+-All the time
+
+Additional Information:
+Compiled using Mono 1.2.3
+OS: Windows XP and Server 2003
+CPU: Intel Pentium Core Duo
More information about the mono-bugs
mailing list