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 2025/01/31 07:20:00 UTC
[jira] [Created] (PDFBOX-5943) Extend interface ResourceCache to support the removal of cached objects
Andreas Lehmkühler created PDFBOX-5943:
------------------------------------------
Summary: 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
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