GeezerVison is showing github.com — fix(db): disable SQLite mmap to prevent DB size inflating RSS by zhumengzhu · Pull Request #22553 · anomalyco/opencode
Conversation
zhumengzhu
commented
Apr 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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:
db.run("PRAGMA mmap_size = 0")
Same fix as proposed by @jiangliang79 in #22428.
How did you verify your code works?
- Full test suite passes (1890 pass, pre-existing 1 fail unrelated to this change)
- Confirmed
mmap_size PRAGMA was not previously set in the codebase
Screenshots / recordings
N/A
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 <[email protected]>
|
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number> or Closes #<number> to this PR description
See CONTRIBUTING.md for details.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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 PRAGMA mmap_size = 0 to prevent SQLite memory-mapped I/O from inflating RSS). The current PR is the updated version that should be merged instead of #22428.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing in favor of #22428 which proposes the identical fix with more detailed analysis (macOS ARM64 footprint measurements). Please consider merging that one.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.