[Mono-bugs] [Bug 53078][Nor] Changed - Thread not disposed if Start not called

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 20 Jan 2004 08:38:06 -0500 (EST)


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 derek.mcumber@datamtnsol.com.

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

--- shadow/53078	2004-01-20 08:27:13.000000000 -0500
+++ shadow/53078.tmp.19251	2004-01-20 08:38:06.000000000 -0500
@@ -85,6 +85,39 @@
 I created a version of corlib.dll that prints Console.WriteLine
 statements in ~Thread() and have verified they do not run until
 the main thread is shut down.
 
 Derek
 
+
+------- Additional Comments From derek.mcumber@datamtnsol.com  2004-01-20 08:38 -------
+
+I made a first attempt at explicitly calling the thread finalizers
+patch and wanted to get your input:
+
+1.  declare 'mono_run_finalizer' in gc-internal.h and gc.c that is a
+non-static wrapper around 'run_finalizer'
+
+2.  include gc-internal.h into threads.c
+
+3.  in 'Start_Wrapper' add this line before 'return (0);'
+
+    mono_run_finalize(thread,0);
+
+This generates the following output in the previous test case:
+
+** Message: : (3520) Start wrapper terminating
+** Message: : thread_cleanup: handle_remove
+** Message: : thread ID 3520
+** Message: : thread_cleanup: calling mono_thread_cleanup
+Finalize run on 03D71558 System.Threading.Thread
+Calling finalizer for thread: 3520
+** Message: : Closing thread 03D71558, handle 00000760
+Leaving finalizer for thread: 3520
+
+Unfortunately, it still holds onto the memory and shows 50Meg in use
+at the end of the test code.
+
+The thought process is: the start_wrapper will finish only when the
+ThreadFunc has finished executing and has returned, doesn't seem to
+hurt anything, but not sure why the resources and memory aren't freed up.
+