feat: replace fixed 80% RAM reserve with bounded-reserve formula#103
Merged
Conversation
Contributor
Author
|
Add |
8 tasks
Andyyyy64
approved these changes
Jun 14, 2026
Andyyyy64
left a comment
Owner
There was a problem hiding this comment.
Reviewed this locally. This is the right first step for #51: replace the fixed 80% RAM rule with a bounded reserve, while leaving current available RAM for the follow-up.
Minor note: estimate_usable_ram has the negative-return guard, but the tests do not cover a total RAM value below the 4 GiB minimum reserve. I do not think that needs to block this PR. The guard is simple, and the normal machine sizes are covered.
I am going to merge this, then answer the Part 2 questions on #51 separately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Replace the hardcoded
total_ram * 0.80heuristic with a bounded-reserve function:total - clamp(total * 0.15, 4 GiB, 32 GiB).estimate_usable_ram(total: int) -> inttohardware/memory.pywith inline constantsWhy
The flat 20% reserve wastes too much on large machines (e.g. 200 GB reserved on a 1 TB box) and doesn't reserve enough on small ones. The bounded formula scales the reserve with machine size while capping it at 32 GiB.
Part 1 of #51
Testing
pytest) — 321 passedNotes
Part 2 (available-RAM awareness,
--planning/--strict-nowflags, dual fit tracking) will follow in a separate PR that closes #51.