Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native memory leak when writing TIFFs (DEFLATE) #14

Merged
merged 2 commits into from
Sep 23, 2015
Merged

Native memory leak when writing TIFFs (DEFLATE) #14

merged 2 commits into from
Sep 23, 2015

Conversation

PissedCapslock
Copy link
Contributor

When writing a TIFF using DEFLATE as compression algorithm, a java.util.zip.Deflate instance is created. This instance uses native resources, which are only released when Deflate#end() is called, or when the finalize method is invoked.

In order to avoid relying on GC to clean up the native resources through the finalizer, the TIFFDeflater class should call end() when it is disposed. In order to do this, I had to add a dispose method to the TIFFCompressor class and call it from the TIFFImageWriter.

The TIFFImageWriter already has a dispose method, which will now call the dispose method of the TIFFCompressor. As a result, everybody who is using the TIFFImageWriter class correctly (calling dispose when finished) will benefit from this fix.

Inside the TIFFImageWriter class, there was a bogusWriter created, on which the dispose call was lacking. I added this call as well.

@stain stain merged commit a661e7d into jai-imageio:master Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants