[Mono-bugs] [Bug 78241][Maj] Changed - CreateThread failure/out of wapi handles slots

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu May 4 11:09:16 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 informatique.internet at fiducial.fr.

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

--- shadow/78241	2006-05-04 11:06:36.000000000 -0400
+++ shadow/78241.tmp.18995	2006-05-04 11:09:16.000000000 -0400
@@ -376,6 +376,44 @@
 
 ------- Additional Comments From robertj at gmx.net  2006-05-04 11:06 -------
 I just found out that threads created as a result of
 calling BeginInvoke have an enormous high handle ref
 count (400-500). These are also the handles that leak.
 
+
+------- Additional Comments From informatique.internet at fiducial.fr  2006-05-04 11:09 -------
+Very dirty patch for CloseHandle which doesn't completely resolve the
+bug, but there's much less leak with it...
+
+Index: io-layer/handles.c
+===================================================================
+--- io-layer/handles.c  (révision 60249)
++++ io-layer/handles.c  (copie de travail)
+@@ -1160,8 +1160,26 @@
+  */
+ gboolean CloseHandle(gpointer handle)
+ {
+-       _wapi_handle_unref (handle);
+
++       guint32 idx = GPOINTER_TO_UINT (handle);
++       gint32 nbref=_WAPI_PRIVATE_HANDLES(idx).ref;
++       g_message("CloseHandle type :%s:
+nbref=%d",_wapi_handle_typename[_WAPI_PRIVATE_HANDLES (idx).type],nbref);
++
++        if (_WAPI_PRIVATE_HANDLES (idx).type == WAPI_HANDLE_THREAD ||
+_WAPI_PRIVATE_HANDLES (idx).type == WAPI_HANDLE_PROCESS)
++        {
++               do{
++                       if (nbref>0)
++                       _wapi_handle_unref (handle);
++                       nbref--;
++               }
++               while(nbref>0);
++       }
++       else
++       {
++               if (nbref>0)
++                       _wapi_handle_unref (handle);
++       }
++
+        return(TRUE);
+ }


More information about the mono-bugs mailing list