You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "valerybokov (via GitHub)" <gi...@apache.org> on 2025/09/27 15:05:06 UTC
[PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
valerybokov opened a new pull request, #274:
URL: https://github.com/apache/pdfbox/pull/274
1 I think we should close this stream especially if we got it by this way (CMapParser.getExternalCMap):
InputStream is = getClass().getResourceAsStream(name);
2 Possible optimisation for future:
We often use ByteArrayInputStream as parameter of the constructor RandomAccessReadBuffer(InputStream). The ByteArrayInputStream is the array wrapper. There is no need to create List<ByteBuffer> for this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
Posted by "lehmi (via GitHub)" <gi...@apache.org>.
lehmi commented on PR #274:
URL: https://github.com/apache/pdfbox/pull/274#issuecomment-3342895140
Done, see https://issues.apache.org/jira/browse/PDFBOX-6079
@valerybokov Thanks for the pointer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
Posted by "valerybokov (via GitHub)" <gi...@apache.org>.
valerybokov closed pull request #274: fix memory leak for RandomAccessReadBuffer(InputStream)
URL: https://github.com/apache/pdfbox/pull/274
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
Posted by "lehmi (via GitHub)" <gi...@apache.org>.
lehmi commented on PR #274:
URL: https://github.com/apache/pdfbox/pull/274#issuecomment-3342700500
I'll have a look. It seems there are other occurrences as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
Posted by "valerybokov (via GitHub)" <gi...@apache.org>.
valerybokov commented on PR #274:
URL: https://github.com/apache/pdfbox/pull/274#issuecomment-3343038001
Your idea is based on current solution when RandomAccessReadBuffer reads all the data inside its constructor. That is why you able to create a new instance of the RandomAccessReadBuffer and close the stream immediately.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
Posted by "valerybokov (via GitHub)" <gi...@apache.org>.
valerybokov commented on PR #274:
URL: https://github.com/apache/pdfbox/pull/274#issuecomment-3341859327
> The caller of the constructor should close the resource as we don't know if the input stream maybe reused
>
> Saying that, we should close the stream in getExternalCMap
This is one of the possible solutions. Yes, it can be closed outside. Will you rewrite it or me?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] fix memory leak for RandomAccessReadBuffer(InputStream) [pdfbox]
Posted by "lehmi (via GitHub)" <gi...@apache.org>.
lehmi commented on PR #274:
URL: https://github.com/apache/pdfbox/pull/274#issuecomment-3341848594
The caller of the constructor should close the resource as we don't know if the input stream maybe reused
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org