You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2025/04/20 11:56:00 UTC
[jira] [Comment Edited] (PDFBOX-5943) Extend interface ResourceCache to support the removal of cached objects
[ https://issues.apache.org/jira/browse/PDFBOX-5943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17945957#comment-17945957 ]
Tilman Hausherr edited comment on PDFBOX-5943 at 4/20/25 11:55 AM:
-------------------------------------------------------------------
Something weird is happening, either in this issue or in the other one. I get a few differences in text extraction. For example, the star wars file from PDFBOX-4549 loses its space. The last "good" revision is 1925090, the "bad" one is 1925104.
was (Author: tilman):
Something weird is happening, either in this issue or in the other one. I get a few differences in text extraction. For example, the star wars file from PDFBOX-4549 loses its space.
> Extend interface ResourceCache to support the removal of cached objects
> -----------------------------------------------------------------------
>
> Key: PDFBOX-5943
> URL: https://issues.apache.org/jira/browse/PDFBOX-5943
> Project: PDFBox
> Issue Type: Improvement
> Components: Parsing
> Affects Versions: 3.0.4 PDFBox, 4.0.0
> Reporter: Andreas Lehmkühler
> Assignee: Andreas Lehmkühler
> Priority: Major
> Fix For: 3.0.5 PDFBox, 4.0.0
>
>
> The interface {{org.apache.pdfbox.pdmodel.ResourceCache}} defines an api to be used to cache the resources of a pdf while processing it. While is consists of methods to add and get objects to/from the cache there aren't any to remove them from the cache.
> The resource cache is bound to the PDDocument so that the resources of a pdf are collected during processing until the pdf is closed.
> PDFBox has no chance to release those resources which are no longer needed. The class which implemented the interface has no chance to know when a resources is no longer needed and it is save to remove it from the cache.
> The current default implementation uses SoftReferences and relies on the garbage collector when it comes to release resources from the cache. This works as long as enough memory is available and/or the object generating code isn't faster than the garbage collector.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org