Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.8, 2.0.9
-
None
-
Windows 7 x64, Java 8 SE
Description
While creating some large PDF documents by PDFBox 2.0.8 and 2.0.9, I met an OutOfMemoryError on FlateFilter.encode().
While creating some small PDF documents, there are no problems.
I checked the source code of org.apache.pdfbox.filter.FlateFilter.java, and I found that calling of Deflater.end() method is missing.
When DeflaterOutputStream object is created by the 'new DeflaterOutputStream(encoded,deflater)' constructor method (i.e. 'custom deflater' is given),
DeflaterOutputStream.close() API does not call 'deflater.end()' method automatically.
Deflater.end() method may be called by the finalizer at GC, of cource, but the timing of GC is undecidable by user. So 'deflater.end()' method should be called explicitly. Otherwise it may cause an OutOfMemoryError.