[Mono-bugs] [Bug 78628][Nor] Changed - mono leaks mach ports

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jun 13 20:35:14 EDT 2006


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 allan at imeem.com.

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

--- shadow/78628	2006-06-13 18:13:53.000000000 -0400
+++ shadow/78628.tmp.22698	2006-06-13 20:35:14.000000000 -0400
@@ -177,6 +177,32 @@
 missing those calls).
 
 ------- Additional Comments From allan at imeem.com  2006-06-13 18:13 -------
 Created an attachment (id=17173)
 Patch against libgc 6.6 source that fixes memory leaks adds missing calls to mach_port_deallocate(). Configure mono with "--with-gc=boehm" after installing the patched libgc.
 
+
+------- Additional Comments From allan at imeem.com  2006-06-13 20:35 -------
+More discoveries:
+
+I'm been playing with the sample code to see what kind of behaviour I could observe. I 
+have a slightly different set of test code:
+
+http://blargle.com/~allan/leaky2.tar.bz2
+
+The embedding code calls mono_gc_collect() after every thread chunk, while the managed 
+code calls GC.Collect() after each thread chunk. The port count for the embedded code 
+doesn't change when it calls mono_gc_collect(), but the port count will slowly rise over 
+time. The managed sample seems to leak ports whenever GC.Collect() is called.
+
+If you remove the call to sleep() from the embedded example, the process seems to leak 
+ports more quickly and in larger chunks.
+
+I'm wondering if this behaviour is indicative of something being done by the garbage 
+collection thread that is different than what is happening when mono_gc_collect() is called. 
+The evidence would support this if the following is true:
+   1. GC.Collect() either signals the GC thread to collect and blocks until it is finished, or if 
+GC.Collect() works similarly to the GC collection thread
+    2. mono_gc_collect() does not rely on the garbage collection thread.
+    3. removing the sleep() call from the embedding examples changes the behaviour of the 
+sample code in a way that encourages the garbage collection thread to run more often and 
+do more of whatever behaviour that causes port leaks.


More information about the mono-bugs mailing list