[Mono-dev] [Mono-gc-list] Mono memory problems!

David Wolinsky davidiw at ufl.edu
Wed Jul 18 16:30:54 EDT 2007


In fact, I was able to fix the problem.

For some reason in WaitHandle.cs, the line...
safe_wait_handle = new SafeWaitHandle (value, false);
should be...
safe_wait_handle = 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 == 0, but calling DangerousGetHandle throws an exception if 
refcount == 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ärber wrote:
>
> Am 18.07.2007 um 19:54 schrieb David Wolinsky:
>
>> That case leaks as well.
>>
>> Regards,
>> David
>>
>> Miguel de Icaza wrote:
>>>>         re = 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 = AutoResetEvent (false)) {   
>>>         ...
>
> Doesn't Close() call Dispose()? At least for the Stream classes it 
> should.
>
> Andreas
>




More information about the Mono-devel-list mailing list