[
https://issues.apache.org/jira/browse/PDFBOX-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14947100#comment-14947100
]
Tilman Hausherr commented on PDFBOX-3008:
-----------------------------------------
Closing "source" solves this problem. The PreflightDocument constructor does
not pass "source" to its PDDocument, so it is no longer used after parsing.
Preflight code uses the (different) dataSource (formerly named
"originalDocument") object to check stream lengths. The "main" PDFBox stuff
doesn't have this problem because opening and closing is done in PDDocument and
not in the parser.
> Memory leak in preflight
> ------------------------
>
> Key: PDFBOX-3008
> URL: https://issues.apache.org/jira/browse/PDFBOX-3008
> Project: PDFBox
> Issue Type: Bug
> Components: Preflight
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Fix For: 2.0.0
>
>
> PreflightParser has this:
> {code}
> public PreflightParser(DataSource dataSource) throws IOException
> {
> // TODO move file handling outside of the parser
> super(new
> RandomAccessBufferedFileInputStream(dataSource.getInputStream()));
> this.setLenient(false);
> this.originalDocument = dataSource;
> }
> {code}
> The TODO message looks like a design issue, but it is much worse: the
> RandomAccessBufferedFileInputStream is never closed, which results in the
> temp file not being deleted. The file parameter constructor has the same
> problem, i.e. that the RandomAccessBufferedFileInputStream object is not
> closed (no temp file there).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]