Skip to content

Fix PDDocument memory leak by implementing proper resource cleanup#3

Merged
abedurftig merged 1 commit intomainfrom
bug/smartfiles-h74-close-pdfdocument-resources
Jan 16, 2026
Merged

Fix PDDocument memory leak by implementing proper resource cleanup#3
abedurftig merged 1 commit intomainfrom
bug/smartfiles-h74-close-pdfdocument-resources

Conversation

@abedurftig
Copy link
Owner

Summary

  • Made PdfImageRenderer implement Closeable with close() method that releases PDDocument resources
  • DocumentView now closes the previous renderer when switching documents
  • DocumentView.clear() now closes the current renderer
  • Removed the unbounded renderer cache in favor of tracking only the current renderer

Issue

Fixes smartfiles-h74

Test plan

  • All 51 existing tests pass
  • Manual testing: open multiple PDFs in sequence and verify memory is released

🤖 Generated with Claude Code

- Made PdfImageRenderer implement Closeable with close() method
- DocumentView now closes the previous renderer when switching documents
- DocumentView.clear() now closes the current renderer
- Removed the unbounded renderer cache in favor of single current renderer

Fixes: smartfiles-h74

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@abedurftig abedurftig merged commit bea7755 into main Jan 16, 2026
1 check passed
@abedurftig abedurftig deleted the bug/smartfiles-h74-close-pdfdocument-resources branch January 16, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants