From: Arne Vajhøj on
Jeroen Mostert wrote:
> Moe Sisko wrote:
>> Just wondering if anyone knows if calling Dispose() on
>> System.IO.MemoryStream does anything useful.
>>
> Yes, it calls Stream.Dispose(), which in turn will dispose an event
> created as a result of calling asynchronous methods (.BeginRead(),
> .BeginWrite()) if they were not all finished before the stream was
> finalized.
>
> So you better call .Dispose(), or you might leak a single event handle
> in very unlikely circumstances!

It uses unmanaged resources ?

Arne
From: Jeroen Mostert on
Arne Vajh�j wrote:
> Jeroen Mostert wrote:
>> Moe Sisko wrote:
>>> Just wondering if anyone knows if calling Dispose() on
>>> System.IO.MemoryStream does anything useful.
>>>
>> Yes, it calls Stream.Dispose(), which in turn will dispose an event
>> created as a result of calling asynchronous methods (.BeginRead(),
>> .BeginWrite()) if they were not all finished before the stream was
>> finalized.
>>
>> So you better call .Dispose(), or you might leak a single event handle
>> in very unlikely circumstances!
>
> It uses unmanaged resources ?
>
Indirectly, yes. But only in the circumstances described above.

--
J.
First  |  Prev  | 
Pages: 1 2
Prev: XSL transforms
Next: Interop.SpeechLib.dll exception