XMem: VICTORY_TITLE_MEMORY=own tells the title its own memory, not the process commit (#4547) #4611

Closed
github-bot wants to merge 14 commits from github-bot/gh-4610 into main AGit
Owner

@⁠davemathews12 on GitHub · 2026-11-30 23:46 UTC · original
davemathews12:fix/title-memory-own → main · +1031 −853 · 33 files · 14 commits · closed without merging

Fixes # (none: helps #4548)

What it changes

Adds VICTORY_TITLE_MEMORY=own, off by default. With it, the title is told how much memory it uses, instead of how much the whole process has committed.

Why: GlobalMemoryStatusEx and XMemGetWorkingSetStatistics (xmem.rs, title_memory()) answer "used" with the process's PagefileUsage. That includes the layer's own memory: host copies of title memory, translated shaders and the card's driver. The limit is the console's budget, so a few minutes in, the title reads 0 MB available, load 100. The code already says so in two comments ("in a long run nothing may read as available"; "A title that budgets its streaming from these two figures believes it is far over its limit").

#4548 shows it happening. On Series S the limit is 7,776 MB, the process had 29,750 MB committed, and the title's own status said available_mb=0 load=100. The game's crash context says the title itself held about 1.27 GB. Then came a null read (+0x3de915c, 3/3 runs) as the safehouse task prestreamed its next step.

What "own" counts (procmem::title_own):

  • private pages at console addresses, from the process-memory line's walk (at most 5 s old);
  • the physical-page sections the title made (XMemAllocatePhysicalPages), at their reserved size. Each physical page counts once, however many views show it, which is why the views at console addresses are not added;
  • its XMemAlloc blocks.

Until the first walk has run, or with VICTORY_PROCESS_MEMORY=0, the old figure is kept.

Why it's off by default: telling the title it has room changes what it streams. That needs runs before it becomes the default.

How it was tested

  • GPU and profile: none. I have no Windows machine, so this has not been run in game.
  • cargo clippy --tests for x86_64-pc-windows-msvc (victory-hle, victory-gpu): no errors, and the warnings are the same as on main. This was cross-checked from Linux, so nothing was built, linked or run on Windows.
  • New tests: the_title_is_told_its_own_memory_when_asked (with #4548's figures, the process's commit gives 0 MB / load 100, and the title's own gives 6,476 MB / load 16) and the_titles_own_memory_is_its_three_parts. They compile for the Windows target but were not run.
  • cargo xtask policy --staged passes.

Asking for a test: @⁠AlbaDev1, you offered to test #4548. Could you run the same save with VICTORY_TITLE_MEMORY=own and say whether picking up the paint bucket still crashes? Your log's repeating the title asks how much memory it uses lines should then show used_mb at the title's own size (its page pools are a few GB of it), under the limit rather than the process's 20-30 GB.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches (XMemGetWorkingSetStatistics, GlobalMemoryStatusEx, title_memory, "working set"). Nothing changes what the title is told it uses. #1477 (closed) changed the limit, not the used figure.

🤖 Generated with Claude Code

**@⁠davemathews12** on GitHub · 2026-11-30 23:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4610) `davemathews12:fix/title-memory-own` → `main` · +1031 −853 · 33 files · 14 commits · closed without merging Fixes # (none: helps #4548) ## What it changes Adds `VICTORY_TITLE_MEMORY=own`, off by default. With it, the title is told how much memory **it** uses, instead of how much the whole process has committed. Why: `GlobalMemoryStatusEx` and `XMemGetWorkingSetStatistics` (`xmem.rs`, `title_memory()`) answer "used" with the process's `PagefileUsage`. That includes the layer's own memory: host copies of title memory, translated shaders and the card's driver. The limit is the console's budget, so a few minutes in, the title reads **0 MB available, load 100**. The code already says so in two comments ("in a long run nothing may read as available"; "A title that budgets its streaming from these two figures believes it is far over its limit"). #4548 shows it happening. On Series S the limit is 7,776 MB, the process had 29,750 MB committed, and the title's own status said `available_mb=0 load=100`. The game's crash context says the title itself held about 1.27 GB. Then came a null read (`+0x3de915c`, 3/3 runs) as the safehouse task prestreamed its next step. What "own" counts (`procmem::title_own`): - private pages at console addresses, from the process-memory line's walk (at most 5 s old); - the physical-page sections the title made (`XMemAllocatePhysicalPages`), at their reserved size. Each physical page counts once, however many views show it, which is why the views at console addresses are not added; - its `XMemAlloc` blocks. Until the first walk has run, or with `VICTORY_PROCESS_MEMORY=0`, the old figure is kept. Why it's off by default: telling the title it has room changes what it streams. That needs runs before it becomes the default. ## How it was tested - GPU and profile: none. I have no Windows machine, so **this has not been run in game**. - `cargo clippy --tests` for `x86_64-pc-windows-msvc` (`victory-hle`, `victory-gpu`): no errors, and the warnings are the same as on `main`. This was cross-checked from Linux, so nothing was built, linked or run on Windows. - New tests: `the_title_is_told_its_own_memory_when_asked` (with #4548's figures, the process's commit gives 0 MB / load 100, and the title's own gives 6,476 MB / load 16) and `the_titles_own_memory_is_its_three_parts`. They compile for the Windows target but were not run. - `cargo xtask policy --staged` passes. **Asking for a test:** @⁠AlbaDev1, you offered to test #4548. Could you run the same save with `VICTORY_TITLE_MEMORY=own` and say whether picking up the paint bucket still crashes? Your log's repeating `the title asks how much memory it uses` lines should then show `used_mb` at the title's own size (its page pools are a few GB of it), under the limit rather than the process's 20-30 GB. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches (`XMemGetWorkingSetStatistics`, `GlobalMemoryStatusEx`, `title_memory`, "working set"). Nothing changes what the title is told it uses. #1477 (closed) changed the limit, not the used figure. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`slots_showing` took the slot's `Made` key with `?`, but `Made` has keys
for the title's `count` slots only while `kept` also has the dynamic
ones: a host texture shown by a dynamic slot was no longer reported, so
it was no longer blocked and could be chosen (freeing nothing, as the
dynamic slot holds a reference, while the title made a second copy).
Those slots are reported again with key 0, as before the key was carried;
they are never put back to waiting, only counted as blocking. Test:
`a_dynamic_slot_showing_a_texture_still_blocks_its_eviction`.

`SLOT_LOOKING` is now cleared by a drop guard, so a look that panics does
not stop every later look.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b23c0c4038)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GlobalMemoryStatusEx and XMemGetWorkingSetStatistics answered "used" with
the whole process's commit: the layer's host copies, translated shaders
and the card's driver too. Against a Series S limit of 7,776 MB, a
process of 29,750 MB left the title 0 MB available and a load of 100 a
few minutes in (#4547, before a null read in the safehouse task's
prestream).

With VICTORY_TITLE_MEMORY=own, "used" is what the title holds itself:
private pages at console addresses (from the process-memory line's walk,
at most five seconds old), the physical-page sections it made (reserved
size, each page once however many views show it) and its XMemAlloc
blocks. Until the first walk, or with VICTORY_PROCESS_MEMORY=0, the old
figure is kept. Off by default until runs show what the title does with
the room.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 23:48:13 +00:00
github-bot changed title from XMem: VICTORY_TITLE_MEMORY=own tells the title its own memory, not the process commit (#4547) to [pr-fix][memory] XMem: VICTORY_TITLE_MEMORY=own tells the title its own memory, not the process commit (#4547) 2026-12-01 00:35:21 +00:00
github-bot changed title from [pr-fix][memory] XMem: VICTORY_TITLE_MEMORY=own tells the title its own memory, not the process commit (#4547) to XMem: VICTORY_TITLE_MEMORY=own tells the title its own memory, not the process commit (#4547) 2026-12-01 00:40:41 +00:00
Author
Owner

@⁠tyr0nsur on GitHub · 2026-12-01 13:38 UTC · original

Ran the unchanged 9b20e9f1 on Windows with Rust 1.98.1. Both of the added accounting tests pass, along with four existing tests:

  • cargo test --locked -p victory-hle --lib -- modules::xmem::tests::the_title_is_told_its_own_memory_when_asked modules::xmem::tests::title_memory --test-threads=1: 2 passed.
  • cargo test --locked -p victory-gpu --lib -- procmem::tests --test-threads=1: 4 passed, including a real process memory walk.

#4909 supplies a Series X case for the same accounting symptom: 36,186 MiB process commit against a 13,824 MiB title limit, while local GPU usage was under the DXGI budget. The status was queried as Breakpad collected data. This supports the accounting rationale and leaves the crash cause open. These are native tests and log analysis. The save comparison with VICTORY_TITLE_MEMORY=own is still outstanding.

**@⁠tyr0nsur** on GitHub · 2026-12-01 13:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4610#issuecomment-7312943835) Ran the unchanged `9b20e9f1` on Windows with Rust 1.98.1. Both of the added accounting tests pass, along with four existing tests: - `cargo test --locked -p victory-hle --lib -- modules::xmem::tests::the_title_is_told_its_own_memory_when_asked modules::xmem::tests::title_memory --test-threads=1`: 2 passed. - `cargo test --locked -p victory-gpu --lib -- procmem::tests --test-threads=1`: 4 passed, including a real process memory walk. #4909 supplies a Series X case for the same accounting symptom: 36,186 MiB process commit against a 13,824 MiB title limit, while local GPU usage was under the DXGI budget. The status was queried as Breakpad collected data. This supports the accounting rationale and leaves the crash cause open. These are native tests and log analysis. The save comparison with `VICTORY_TITLE_MEMORY=own` is still outstanding.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:36 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4610#issuecomment-7321210673) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
github-bot closed this pull request 2026-12-01 18:42:58 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4611
No description provided.