Re: [Mono-gc-list] Mono memory problems!
"Jonathan Gagnon" <[email protected]> Tue, 24 Jul 2007 08:58:49 -0400
| Newsgroups | gmane.comp.gnome.mono.devel,gmane.comp.gnome.mono.garbage-collection |
|---|---|
| Message-ID | <01d801c7cdf2$64958a10$1b36a8c0@PROG159> |
I'm pretty sure that this will fix bug #81727 that I filed a few months ago, although I don't have time to test it for the moment. Jonathan Gagnon = -----Message d'origine----- De : [email protected] [mailto:[email protected]] De la part de Miguel de Icaza Envoy=E9 : Wednesday, July 18, 2007 8:17 PM =C0 : David Wolinsky Cc : Andreas F=E4rber; Peer-to-peer networking group discussions; [email protected]; mono-devel Objet : Re: [Mono-dev] [Mono-gc-list] Mono memory problems! Hello folks, Thanks for tracking this problem down. Thanks for pointing out the comment in the source code; I went and re-read the documentation and I clearly did not understand it the first time over, because the leak was documented to happen only in the .NET 1.0 and 1.1 scenarios, not on the 2.0 scenario. So the fix that takes ownership is correct. I tidied up the patch a little bit as well. The fix is now on svn, thanks again for tracking this down. > In fact, I was able to fix the problem. > = > For some reason in WaitHandle.cs, the line... > safe_wait_handle =3D new SafeWaitHandle (value, false); should be... > safe_wait_handle =3D new SafeWaitHandle (value, true); (at least it = > makes sense according to other docs I read)... > = > second... in SafeWaitHandle.cs, the line ... > NativeEventCalls.CloseEvent_internal = > (DangerousGetHandle()); should be... > NativeEventCalls.CloseEvent_internal (handle); > = > The second one is kind of silly because Release gets called only after = > refcount =3D=3D 0, but calling DangerousGetHandle throws an exception if = > refcount =3D=3D 0. > = > I think there is still a problem of the array of wapi handles not = > being shrunk down, but that complexity is beyond me. > = > Regards, > David > = > Andreas F=E4rber wrote: > > > > Am 18.07.2007 um 19:54 schrieb David Wolinsky: > > > >> That case leaks as well. > >> > >> Regards, > >> David > >> > >> Miguel de Icaza wrote: > >>>> re =3D new AutoResetEvent(false); > >>>> re.Close(); > >>> > >>> That depends on the finalizer to run to release memory from the = > >>> unmanaged side, since AutoResetEvent implements IDisposable you = > >>> should use it like this: > >>> > >>> using (re =3D AutoResetEvent (false)) { = > >>> ... > > > > Doesn't Close() call Dispose()? At least for the Stream classes it = > > should. > > > > Andreas > > > = > _______________________________________________ > Mono-devel-list mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/mono-devel-list _______________________________________________ Mono-devel-list mailing list [email protected] http://lists.ximian.com/mailman/listinfo/mono-devel-list