Yoan Alvarez created PDFBOX-3555:
------------------------------------

             Summary: FlateFilter.decode cause native memory leaks
                 Key: PDFBOX-3555
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3555
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 2.0.3
         Environment: Debian wheezy 7.11 / oracle JDK 8 - 64 bit / pdfbox 2.0.3
            Reporter: Yoan Alvarez


The 
[FlateFilter.decode|https://github.com/apache/pdfbox/blob/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java#L45]
 method calls the private method 
[FlateFilter.decompress|https://github.com/apache/pdfbox/blob/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java#L89]
 which instanciates a 
[java.util.zip.Inflater|https://docs.oracle.com/javase/8/docs/api/java/util/zip/Inflater.html].

But this method never calls the 
[Inflater.end|https://docs.oracle.com/javase/8/docs/api/java/util/zip/Inflater.html#end--]
 method so I think the native memory allocated by the Inflater is never 
released.

By consequence, the java process memory size keeps growing over time.

The simplest way we found to fix this is to call the 
[Inflater.end|https://docs.oracle.com/javase/8/docs/api/java/util/zip/Inflater.html#end--]
 when the inflater has done its job and is not used anymore at the end of 
[FlateFilter.decompress|https://github.com/apache/pdfbox/blob/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java#L136].

With this fix, the java process memory size remains stable over time.

Just ask me if more details are needed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to