fix(db): disable SQLite mmap to prevent DB size inflating RSS#22553
fix(db): disable SQLite mmap to prevent DB size inflating RSS#22553zhumengzhu wants to merge 1 commit intoanomalyco:devfrom
Conversation
Bun enables SQLite memory-mapped I/O by default, mapping the entire DB file into the process address space. A 1.1 GB database adds ~1.8 GB to RSS regardless of how much data is actually accessed. Add PRAGMA mmap_size = 0 to the existing PRAGMA initialization block. Ref anomalyco#22428 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Related PR Found:
Why it's related: This is the exact PR mentioned in the current PR's description. PR #22553 is explicitly stated to supersede #22428 as it implements the same fix (adding |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Closing in favor of #22428 which proposes the identical fix with more detailed analysis (macOS ARM64 footprint measurements). Please consider merging that one. |
Issue for this PR
Ref #22428 (same fix, that PR is still open — this supersedes it).
Type of change
What does this PR do?
Bun enables SQLite memory-mapped I/O by default, mapping the entire DB file
into the process address space. A 1.1 GB database adds ~1.8 GB to RSS
regardless of how much data is actually accessed. One line added to the
existing PRAGMA initialization block in
src/storage/db.ts:Same fix as proposed by @jiangliang79 in #22428.
How did you verify your code works?
mmap_sizePRAGMA was not previously set in the codebaseScreenshots / recordings
N/A
Checklist