[ https://issues.apache.org/jira/browse/PDFBOX-5731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17795623#comment-17795623 ]
Andreas Lehmkühler commented on PDFBOX-5731: -------------------------------------------- I didn't get your point. The following test demonstrates how the cache works {code} @Test void checkCache() { COSName nameBlubb1 = COSName.getPDFName("blubb"); COSName nameBlubb2 = COSName.getPDFName("blubb"); // due to the underlying cache nameBlubb1 and nameBlubb2 share the same instance assertTrue(nameBlubb1 == nameBlubb2); assertEquals(nameBlubb1, nameBlubb2); // clear the cache COSName.clearResources(); // blubb1 and blubb2 still share the same instances and therefore are still identical assertTrue(nameBlubb1 == nameBlubb2); assertEquals(nameBlubb1, nameBlubb2); // get another COSName value for "blubb" COSName nameBlubb3 = COSName.getPDFName("blubb"); // nameBlubb3 is another instance of COSName for the value "blubb" assertFalse(nameBlubb1 == nameBlubb3); // both instances are still equal as the underlying strings have equal values assertEquals(nameBlubb1, nameBlubb3); } {code} IMHO everything is fine > org.apache.pdfbox.cos.COSName#nameMap There is a memory leak problem. > --------------------------------------------------------------------- > > Key: PDFBOX-5731 > URL: https://issues.apache.org/jira/browse/PDFBOX-5731 > Project: PDFBox > Issue Type: Bug > Affects Versions: 2.0.30, 3.0.1 PDFBox > Reporter: liu > Priority: Major > Attachments: image-2023-12-08-16-02-12-293.png, screenshot-1.png, > screenshot-2.png, screenshot-3.png > > > !image-2023-12-08-16-02-12-293.png! > !screenshot-1.png! -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org