Freed copies are not kept 300 s once the process nears the PC's RAM (#234) #271
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!271
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-271"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@SpositoDouglas on GitHub · 2026-11-26 13:58 UTC · original
SpositoDouglas:ram/keep-freed-commit→main· +49 −2 · 1 files · 1 commits · openFixes #234 (the second option there, with one change to the threshold).
The problem
ram_idle_mskeeps freed copies (loose window copies, texture staging, the mapped pipeline library) for 300 s whenever the PC has 12 GiB of free RAM. It does not look at the process's own size. WithVICTORY_RESIDENCYoff (the default), nothing else does either. On a 32 GB PC with the renderer patches, the process passes the size of RAM within 4 minutes and Windows starts reading pages back from the page file (#146, #189).The change
ram_idle_mskeeps the 300 s only while the process's private bytes are under 70 % of the smaller of the PC's RAM and its commit limit. Past that, the existing idle times by free RAM apply (10 s, 5 s, 2 s). 70 % isram_band's Watch share. The numbers come fromram_sample(). If the query fails, nothing changes.#234 suggested the commit limit alone. On this PC that is 80 GB (32 GB of RAM and a 48 GB page file), so the mark would be 56 GB, far past where paging starts. With the smaller of the two it is about 22 GB here. On the README's 64 GB PC it is about 45 GB, so the README's 30 GB keeps its copies as before.
Related: #206 turns on
VICTORY_RESIDENCY=1inplay.ps1. With it,limited_host_ram()already stops the 300 s on PCs with 32 GB or less. This change also covers runs without residency and PCs above 32 GB that grow past 70 % of their RAM.Measurements
PC: RX 9060 XT 16 GB (RDNA 4), AMD driver 32.0.32029.2010, Ryzen 7 5800XT, 32 GB RAM, 48 GB page file, Windows 11 26300.
Method:
c9c932cagainstc9c932cwith this change, both--profile diag --features diagnostics.play.ps1settings (not-Safe), plusVICTORY_PORT_CONSTANTS/DESCRIPTORS/CBV/GUARD/JOURNAL=1.VICTORY_SHADER_OPT=59. Without it this card hits theamdxc64.dll+0x861b9fcompiler crash within 10 s to 2.5 min (#8, #44, #60).c9c932cIn the first 3 minutes the two are the same (20.4 against 19.8 GB), as expected: the mark is passed at about 2 minutes. Page reads vary a lot between samples; the first 3 minutes had more of them with the change.
Frame rates are not comparable: the scenes differed (median 5,156 against 4,079 draws a frame).
Limits:
amdxc64.dll+0x861b9f), at 14 min 50 s and 13 min 46 s. The table covers the time both were running.Testing
cargo test -p victory-gpu --lib -- ram_idle freed_copies: 3 passed. The new test covers the 70 % mark of the smaller number, the 32 GB + 80 GB and 64 GB cases, one or both numbers unknown, and no overflow.cargo clippy -p victory-gpu --lib: no new warning (the one inwatch.rswas there before).Written with Claude Code (Claude Opus 5.5); tested by me on the PC above.
🤖 Generated with Claude Code
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-26 13:58 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@SpositoDouglas on GitHub · 2026-11-26 14:21 UTC · original
A third run for comparison:
c9c932c(without this change) withVICTORY_RESIDENCY=1, everything else as in the description (same PC, same save,play.ps1settings, renderer patches 1, 2, 5, 6 and 7,VICTORY_SHADER_OPT=59).c9c932cc9c932c+VICTORY_RESIDENCY=1On this 32 GB PC, residency saves about twice what this change does. With it on,
limited_host_ram()already stops the 300 s here, so this change adds nothing in that case. It still applies to runs without residency (the default today) and to PCs above 32 GB.So if
VICTORY_RESIDENCY=1becomes the default for 32 GB PCs (as #206 does inplay.ps1), that is the bigger win for them, and this PR is the smaller fix for the rest. Your call whether it is still worth having.Same limits as before: one run each, the scenes differed (so the frame row means "no worse", not a gain), and the pipeline cache was a little warmer for the third run.
@PostKeysNdDoOne on GitHub · 2026-11-26 18:14 UTC · original
<html>Tested
VICTORY_KEEP_FREED=0on a 32 GB host — resultsRan the experiment you suggested on a 31 GB usable / RX 7900 GRE / Series X dump machine, two sessions with everything else identical (
VICTORY_RAM_CAP_GB=28, same dump, same build):What it shows: disabling the idle retention does shave ~700 MiB off peak private memory, but it doesn't reduce system pressure — it hits the 28 GiB cap faster and the texture re-upload churn is at least as dense, if not worse. So on this machine the retention isn't the main lever: the ~10–15 GB gap between the working set and 32 GB of RAM is.
Caveats: one machine, one dump, two sessions. No 64 GB comparison, no
VICTORY_MEMORY_MAP=1breakdown. The capped pools (spare scratch 1 GiB, send 768 MiB, snapshots 512 MiB, idle lists 256 MiB, staging 8×64 MiB) and the title's own allocations look like the bulk, consistent with the audit's "no single unbounded leak" finding.Conclusion for the PR/issue: the
</html>ram_idle_msclamp you proposed is worth having for correctness, but based on this measurement it won't close the gap on a 32 GB host — the honest recommendation for 32 GB remains "64 GB recommended" until the working set shrinks. Happy to runVICTORY_MEMORY_MAP=1and post the breakdown if that's useful.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.