Skip to content

Comments

[Fix] reduce memory consumption and close pdf stream after usage#164

Open
niermja wants to merge 2 commits intoLayout-Parser:mainfrom
niermja:jakobnrmnn/fix_memory_consumption
Open

[Fix] reduce memory consumption and close pdf stream after usage#164
niermja wants to merge 2 commits intoLayout-Parser:mainfrom
niermja:jakobnrmnn/fix_memory_consumption

Conversation

@niermja
Copy link

@niermja niermja commented Dec 11, 2022

Flushes the pages and pdf afterwards to reduce the memory/ram consumption.

Opens the pdf stream as a context manager so that the file is closed afterwads.

IgorTavcar added a commit to IgorTavcar/layout-parser that referenced this pull request Feb 21, 2026
Wraps PDF processing in a context manager so the file handle is properly
closed. Adds page.flush_cache() after each page extraction to free memory.
Fixes the original PR's issue of calling flush after the context manager
already closed the stream.

From: Layout-Parser#164 (niermja)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant