Prev: XSL transforms
Next: Interop.SpeechLib.dll exception
From: Arne Vajhøj on 13 Jul 2008 22:12 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 13 Jul 2008 23:21
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. |