Skip to content

Trim process heap after document analysis - #5335

Open
medisean wants to merge 1 commit into
opendatalab:masterfrom
medisean:agent/add-find-offset
Open

Trim process heap after document analysis#5335
medisean wants to merge 1 commit into
opendatalab:masterfrom
medisean:agent/add-find-offset

Conversation

@medisean

Copy link
Copy Markdown

Summary

  • Return unused glibc heap pages to the operating system after memory cleanup.
  • Run the existing cleanup path after synchronous and asynchronous VLM document analysis.
  • Add regression tests for the optional allocator hook and its configuration.

Root cause

Python garbage collection and device-cache cleanup do not necessarily return freed native heap pages to the operating system, so long-running API processes can show increasing RSS across documents.

Validation

  • python -m pytest -q tests/unittest/test_model_utils.py — 4 passed
  • python -m compileall -q mineru/utils/model_utils.py mineru/backend/vlm/vlm_analyze.py tests/unittest/test_model_utils.py
  • Ruff E/F/W checks for the new test file
  • git diff --check

Fixes #5313

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@medisean
medisean marked this pull request as ready for review July 28, 2026 03:08
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 28, 2026
@medisean
medisean force-pushed the agent/add-find-offset branch from 2b11e73 to 212eb5a Compare July 28, 2026 03:15
@medisean
medisean force-pushed the agent/add-find-offset branch from 212eb5a to 0b065d6 Compare July 28, 2026 03:16
@medisean

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jul 28, 2026
@minbaby

minbaby commented Aug 3, 2026

Copy link
Copy Markdown

这个 PR 好像没有 Reviewers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MinerU API - RSS grows unbounded across documents until OOM

2 participants