Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ public void close() throws IOException
}
closed = true;

// Release large data structures immediately so the GC can reclaim memory
// even if callers hold a reference to this COSDocument instance.
objectPool.clear();
xrefTable.clear();
trailer = null;

// rethrow first exception to keep method contract
if (firstException != null)
{
Expand Down