Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1777

memory leak in org.apache.pdfbox.cos.COSDocument

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.8.4, 2.0.0
    • Component/s: Parsing
    • Labels:
    • Environment:
      Windows 7, Netbeans 7.4

      Description

      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
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lehmi Andreas Lehmkühler
                Reporter:
                robert.scharpf@hp.com Robert Scharpf
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified