[Mono-bugs] [Bug 82134][Maj] Changed - AutoResetEvent causes memory leak when compiled with gmcs

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 18 17:31:50 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 davidiw at ufl.edu.

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

--- shadow/82134	2007-07-18 12:14:31.000000000 -0400
+++ shadow/82134.tmp.559	2007-07-18 17:31:50.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 82134
 Product: Mono: Compilers
 Version: 1.2
-OS: 
+OS: unknown
 OS Details: 2.6 Linux
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Major
 Component: C#
 AssignedTo: rharinath at novell.com                            
 ReportedBy: davidiw at ufl.edu               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -46,6 +46,58 @@
 Expected Results:
 gmcs should not explode
 
 
 How often does this happen? 
 Every time
+
+------- Additional Comments From davidiw at ufl.edu  2007-07-18 17:31 -------
+Fix developed independently at these two threads...
+http://lists.ximian.com/pipermail/mono-devel-list/2007-July/024155.html
+http://lists.ximian.com/pipermail/mono-devel-list/2007-July/024156.html
+
+I borrowed the fix from Cedric as I think his version is safer and
+already in patch format...
+
+Thanks Cedric for assisting!
+
+Index: class/corlib/System.Threading/WaitHandle.cs
+===================================================================
+--- class/corlib/System.Threading/WaitHandle.cs (révision 82236)
++++ class/corlib/System.Threading/WaitHandle.cs (copie de travail)
+@@ -221,12 +221,7 @@
+                        [SecurityPermission
+(SecurityAction.LinkDemand, UnmanagedCode = true)]
+                        [SecurityPermission
+(SecurityAction.InheritanceDemand, UnmanagedCode = true)]
+                        set {
+-                               //
+-                               // Notice, from the 2.x documentation:
+-                               //    Assigning a new value to the
+Handle property, will not release
+-                               //    the previous handle, this could
+lead to a leak
+-                               //
+-                               safe_wait_handle = new SafeWaitHandle
+(value, false);
++                               safe_wait_handle = new SafeWaitHandle
+(value, true);
+                        }
+                }
+
+Index: class/corlib/System.Runtime.InteropServices/SafeHandle.cs
+===================================================================
+--- class/corlib/System.Runtime.InteropServices/SafeHandle.cs  
+(révision 82236)
++++ class/corlib/System.Runtime.InteropServices/SafeHandle.cs   (copie
+de travail)
+@@ -124,7 +124,7 @@
+                [ReliabilityContract (Consistency.WillNotCorruptState,
+Cer.Success)]
+                public IntPtr DangerousGetHandle ()
+                {
+-                       if (refcount == 0){
++                       if (refcount == 0 && handle ==
+invalid_handle_value) {
+                                throw new ObjectDisposedException
+(GetType ().FullName);
+                        }


More information about the mono-bugs mailing list