bp74 / Zstandard.Net

A Zstandard wrapper for .Net
Other
137 stars 27 forks source link

Unmanaged resource leak #15

Closed Brain2000 closed 5 years ago

EamonNerbonne commented 5 years ago

@bp74 is this mergable?

Brain2000 commented 5 years ago

I hope so. I merged all the changes into my fork, added this, then made the pull request. It's only my second pull requests, so perhaps I did it incorrectly or there is a better way to do it?

EamonNerbonne commented 5 years ago

I took a peak at what GZipStream does; and that is implemented by DeflateStream, and that calls the following code on dispose: https://github.com/dotnet/corefx/blob/b8bc4ff80c5f7baa681e8a569d367356957ba78a/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs#L585

In other words, if it's being finalized, there's no flushing, but if it's being disposed, there is flushing.

I think I'd consider that to be the expected behavior, if by nothing other than example.