You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2013/12/22 19:52:50 UTC

[jira] [Updated] (PDFBOX-1777) memory leak in org.apache.pdfbox.cos.COSDocument

     [ https://issues.apache.org/jira/browse/PDFBOX-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler updated PDFBOX-1777:
---------------------------------------

    Fix Version/s: 2.0.0

> memory leak in org.apache.pdfbox.cos.COSDocument
> ------------------------------------------------
>
>                 Key: PDFBOX-1777
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1777
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 1.8.2
>         Environment: Windows 7, Netbeans 7.4
>            Reporter: Robert Scharpf
>            Priority: Minor
>              Labels: patch
>             Fix For: 2.0.0
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> org.apache.pdfbox.cos.COSDocument.close() does not close the streams and causing therefore a growing memory leak. Supposed fix:
>  public void close() throws IOException {
> //        if (!closed) {
> //            scratchFile.close();
> //            if (tmpFile != null) {
> //                tmpFile.delete();
> //            }
> //            closed = true;
> //        }
>         // begin Robert Scharpf
>         closed = true;
>         if (scratchFile != null) {
>             try {
>                 scratchFile.close();
>             } catch (Exception e) {
>             }
>         }
>         scratchFile = null;
>         if (tmpFile != null) {
>             try {
>                 tmpFile.delete();
>             } catch (Exception e) {
>             }
>         }
>         tmpFile = null;
>         List<COSObject> list = getObjectsByType(COSName.OBJ_STM);
>         if (list != null) {
>             for (COSObject objStream : list) {
>                 COSStream stream = (COSStream) objStream.getObject();
>                 stream.close();
>             }
>         }
>         // end Robert Scharpf
>     }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)