[Mono-bugs] [Bug 35119][Wis] New - Objects with finalizers don't work

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
5 Dec 2002 03:20:29 -0000


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 tum@veridicus.com.

http://bugzilla.ximian.com/show_bug.cgi?id=35119

--- shadow/35119	Wed Dec  4 22:20:29 2002
+++ shadow/35119.tmp.2469	Wed Dec  4 22:20:29 2002
@@ -0,0 +1,90 @@
+Bug#: 35119
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tum@veridicus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Objects with finalizers don't work
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+The mono runtime crashes (siliently) when using objects with finalizers.  
+Finalizers aren't always called.
+
+Steps to reproduce the problem:
+
+Compile and run the following file:
+
+---begin--testfinalize.cs---
+
+using System;
+using System.IO;
+using System.Threading;
+
+public class Test
+{
+	public Test()
+	{
+		// If this line is commented out
+		// the finalizer won't even run
+
+		Console.WriteLine("Constructing");
+	}
+
+	~Test()
+	{
+		Console.WriteLine("Finalizing");
+	}
+
+	public static void Main()
+	{	
+		// This for loop should keep going
+		// The mono runtime exits after a few seconds.
+	
+		for (;;)
+		{
+			new Test();
+		}
+	}
+}
+
+---end--testfinalize.cs---
+
+Actual Results:
+
+If the Console.WriteLine statement in the constructor is commented out 
+the program exits almost immediately with no error reported.
+
+If the Console.WriteLine statement in the constructor is not commented 
+out the program prints "Constructing" a few times then exists with no 
+error reported.
+
+If the finalizer is commented out the program runs for ever.
+
+Expected Results:
+
+The program should keep running forever, printing "Constructing" 
+and "Finalizing" lots.
+
+How often does this happen? 
+
+All the time.
+
+Additional Information:
+
+Mono was built with the a current copy from the CVS.
+
+This finalization problem may be what is causing monitor/locks to leak 
+handles. See this bug: http://bugzilla.ximian.com/show_bug.cgi?id=34963.