Unbounded growth of LOOSE host copies during open-world play (D3D12 0x80070057 crash) #3646

Open
opened 2026-11-30 02:42:19 +00:00 by github-bot · 2 comments
Owner

@⁠Zendothony on GitHub · 2026-11-30 02:38 UTC · original

Unbounded growth of LOOSE host copies during open-world play (VRAM/RAM exhaustion, D3D12 0x80070057 crash)

Summary

During extended open-world play (GTA 6, no mission/cutscene involved), the "host copies of title memory" count reported in memory()/the process memory: log line grows continuously and never comes back down, eventually exhausting system RAM and/or exceeding the card's VRAM budget. The session ends with:

ERROR victory_gpu::host: a host command list did not close (El parámetro no es correcto. (0x80070057)): a command recorded into it was invalid

preceded by lines such as:

memory now: committed 29705 MB, the card's own 10237 MB in use of a budget of 7083 MB

This reproduces across multiple recent releases/builds and regardless of console profile (Series S and Series X both affected), with no custom env vars set beyond the F1 menu's own defaults. It is not tied to a specific mission — it happens whenever a session runs long enough (roughly 30–55 minutes under Series S / Performance / 540p / Frame Gen 2x / Preset K; as little as ~8 minutes under Ultra Performance / 360p, which seems to accelerate it).

Where it points in the source

crates/victory-gpu/src/shadow.rs holds the central cache:

static LOOSE: std::sync::RwLock<BTreeMap<(u64, u64), Arc<Shadow>>> = std::sync::RwLock::new(BTreeMap::new());

There's already a sweep meant to keep it bounded, pub(crate) fn let_go_idle() (~line 4930), whose own doc comment describes this exact symptom as previously observed:

"They were never freed, and the world's streaming keeps asking for new ones: 648 windows (2.8 GB) when the cutscene began, 974 (4.3 GB) eight minutes later (run 24)."

let_go_idle() is invoked once a second from sweep() in crates/victory-gpu/src/host.rs (~line 790), alongside crate::texture::let_go_idle() and crate::resource::let_go_idle(), so call frequency isn't in question. Its eligibility filter requires (among other things) Arc::strong_count(s) == 1, crate::host::references(&s.buffer) == 1, and crate::host::long_ago(s.used, idle_ms, IDLE_FRAMES), where the idle threshold comes from crate::host::ram_idle_ms(crate::host::available_physical_ram()).

On a host with ullTotalPhys <= 32 GiB (residency::limited_host_ram() returns true, since the check is <=), ram_idle_ms already takes the "not keeping freed" branch and uses the aggressive tier (2–10 s depending on free RAM), not the 5-minute "plenty of RAM" tier. So on 32 GB systems the sweep should already be reclaiming aggressively — and yet the counters keep climbing for the whole session.

That suggests one of:

  1. Entries are legitimately re-touched (new overlapping/nearby windows during open-world streaming reset s.used before the idle threshold elapses), so they never age past the filter even though the working set itself is unbounded — in which case the real fix is probably a hard cap (max bytes/entries) that forces eviction of the oldest entries regardless of idle time, rather than (or in addition to) a pure idle-time filter.
  2. Some insertion path creates Shadow entries that can never satisfy the filter (e.g. a reference held open-endedly elsewhere, so Arc::strong_count or references(&s.buffer) never drop to 1).

I haven't been able to instrument live counters inside a running session to distinguish 1 vs 2 — that would need debug logging added to let_go_idle() itself (e.g. counting how many LOOSE entries pass vs fail each individual condition in the filter, sampled periodically) to see whether entries are failing on strong_count, on references, or on the idle-time check.

Repro conditions

  • Build: multiple recent releases (leak reproduces identically across at least 3 different builds/versions).
  • Console profile: both series-s and series-x.
  • GPU: RTX 4060 Laptop (8 GB VRAM), 32 GB system RAM.
  • Settings: F1-menu defaults (VICTORY_SOFT_VIEWS=copies, VICTORY_MENU_FG_TYPE=dlss, VICTORY_MENU_FRAMEGEN=2, VICTORY_DLSS_PRESET=k); reproduces both at VICTORY_MENU_DLSS=performance/VICTORY_MENU_S_RES=540 (~30–55 min to crash) and at ultraperformance/360 (~8 min to crash).
  • No third-party injectors/wrappers running (confirmed launching victory.exe directly, nothing else).

What would help

  • A debug counter breakdown of why LOOSE entries fail let_go_idle()'s filter during a long open-world session (strong_count vs references vs idle-time), to confirm whether this is a true leak (dangling extra reference) vs. unbounded legitimate working-set growth that needs a hard byte/count cap instead of a pure idle-time eviction policy.
  • If it's (2) from above, a hard ceiling on LOOSE total bytes (evict oldest-by-s.used first, independent of the idle-time check) seems like the safer short-term mitigation, similar to how crate::pool/vram_keep_below already caps VRAM usage by percentage rather than purely by idle time.

Happy to provide full session logs (they contain the process memory:/host copies of title memory N (BYTES MB) progression every second for ~30-55 min sessions) if useful.

**@⁠Zendothony** on GitHub · 2026-11-30 02:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3646) ## Unbounded growth of `LOOSE` host copies during open-world play (VRAM/RAM exhaustion, D3D12 0x80070057 crash) **Summary** During extended open-world play (GTA 6, no mission/cutscene involved), the "host copies of title memory" count reported in `memory()`/the `process memory:` log line grows continuously and never comes back down, eventually exhausting system RAM and/or exceeding the card's VRAM budget. The session ends with: ``` ERROR victory_gpu::host: a host command list did not close (El parámetro no es correcto. (0x80070057)): a command recorded into it was invalid ``` preceded by lines such as: ``` memory now: committed 29705 MB, the card's own 10237 MB in use of a budget of 7083 MB ``` This reproduces across multiple recent releases/builds and regardless of console profile (Series S and Series X both affected), with no custom env vars set beyond the F1 menu's own defaults. It is not tied to a specific mission — it happens whenever a session runs long enough (roughly 30–55 minutes under Series S / Performance / 540p / Frame Gen 2x / Preset K; as little as ~8 minutes under Ultra Performance / 360p, which seems to accelerate it). **Where it points in the source** `crates/victory-gpu/src/shadow.rs` holds the central cache: ```rust static LOOSE: std::sync::RwLock<BTreeMap<(u64, u64), Arc<Shadow>>> = std::sync::RwLock::new(BTreeMap::new()); ``` There's already a sweep meant to keep it bounded, `pub(crate) fn let_go_idle()` (~line 4930), whose own doc comment describes this exact symptom as previously observed: > "They were never freed, and the world's streaming keeps asking for new ones: 648 windows (2.8 GB) when the cutscene began, 974 (4.3 GB) eight minutes later (run 24)." `let_go_idle()` is invoked once a second from `sweep()` in `crates/victory-gpu/src/host.rs` (~line 790), alongside `crate::texture::let_go_idle()` and `crate::resource::let_go_idle()`, so call frequency isn't in question. Its eligibility filter requires (among other things) `Arc::strong_count(s) == 1`, `crate::host::references(&s.buffer) == 1`, and `crate::host::long_ago(s.used, idle_ms, IDLE_FRAMES)`, where the idle threshold comes from `crate::host::ram_idle_ms(crate::host::available_physical_ram())`. On a host with `ullTotalPhys <= 32 GiB` (`residency::limited_host_ram()` returns `true`, since the check is `<=`), `ram_idle_ms` already takes the "not keeping freed" branch and uses the aggressive tier (2–10 s depending on free RAM), not the 5-minute "plenty of RAM" tier. So on 32 GB systems the sweep should already be reclaiming aggressively — and yet the counters keep climbing for the whole session. That suggests one of: 1. Entries are legitimately re-touched (new overlapping/nearby windows during open-world streaming reset `s.used` before the idle threshold elapses), so they never age past the filter even though the working set itself is unbounded — in which case the real fix is probably a hard cap (max bytes/entries) that forces eviction of the *oldest* entries regardless of idle time, rather than (or in addition to) a pure idle-time filter. 2. Some insertion path creates `Shadow` entries that can never satisfy the filter (e.g. a reference held open-endedly elsewhere, so `Arc::strong_count` or `references(&s.buffer)` never drop to 1). I haven't been able to instrument live counters inside a running session to distinguish 1 vs 2 — that would need debug logging added to `let_go_idle()` itself (e.g. counting how many `LOOSE` entries pass vs fail each individual condition in the filter, sampled periodically) to see whether entries are failing on strong_count, on references, or on the idle-time check. **Repro conditions** - Build: multiple recent releases (leak reproduces identically across at least 3 different builds/versions). - Console profile: both `series-s` and `series-x`. - GPU: RTX 4060 Laptop (8 GB VRAM), 32 GB system RAM. - Settings: F1-menu defaults (`VICTORY_SOFT_VIEWS=copies`, `VICTORY_MENU_FG_TYPE=dlss`, `VICTORY_MENU_FRAMEGEN=2`, `VICTORY_DLSS_PRESET=k`); reproduces both at `VICTORY_MENU_DLSS=performance`/`VICTORY_MENU_S_RES=540` (~30–55 min to crash) and at `ultraperformance`/`360` (~8 min to crash). - No third-party injectors/wrappers running (confirmed launching `victory.exe` directly, nothing else). **What would help** - A debug counter breakdown of *why* `LOOSE` entries fail `let_go_idle()`'s filter during a long open-world session (strong_count vs references vs idle-time), to confirm whether this is a true leak (dangling extra reference) vs. unbounded legitimate working-set growth that needs a hard byte/count cap instead of a pure idle-time eviction policy. - If it's (2) from above, a hard ceiling on `LOOSE` total bytes (evict oldest-by-`s.used` first, independent of the idle-time check) seems like the safer short-term mitigation, similar to how `crate::pool`/`vram_keep_below` already caps VRAM usage by percentage rather than purely by idle time. Happy to provide full session logs (they contain the `process memory:`/`host copies of title memory N (BYTES MB)` progression every second for ~30-55 min sessions) if useful.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 02:42:19 +00:00
Author
Owner

@⁠Trillazill on GitHub · 2026-11-30 08:38 UTC · original

Measurements for this, from two short runs on the diagnostics build (--profile diag --features diagnostics) at 41adb551 (with or without #3754's VICTORY_ROOM_BY_BLOCKS, which is off unless set), RTX 4080, windowed, same save. Each run was the menu, then a few minutes driving. The numbers come from the copystat memory lines; no logs are attached.

What holds the windows (default switches)

About a minute after the world loaded:

  • 5,060 host copies of title memory, 7.4 GB. Of them, ~900–1,000 are windows outside buffers, 5.5 GB.
  • Almost every window is held: 1,006 are shown by descriptor slots (6.1 GB) and the same 1,006 are held by lists or the pass over the heap. None is idle in windows outside buffers by use. let_go_idle cannot let any of them go, and that is right: they are in use.
  • They are not leaking. 1,050 windows (6.6 GB) had already been let go and made again since the start, and the count stays flat (~870–1,000) while driving.
  • 719 windows were asked for without a length. Each is 6 MiB (unsized_window: the 4 MiB cell plus reach's 2 MiB), 4.3 GB together, which is the whole count.
  • The 5.5 GB of windows lie over 4.4 GB of title memory: about 1.1 GB is the same memory in two windows. That is the 2 MiB reach of one cell's window overlapping the next cell's own window.
  • Of the windows alive, only ~2.0 GB lies between the lowest and highest address asked for in each.

So the growth reported here is not copies nothing names. It is windows far larger than what is read, held by slots that are in use.

The same with VICTORY_WINDOW_GROW=1

at the same point default VICTORY_WINDOW_GROW=1
windows outside buffers 5.5 GB 4.0 GB
memory in more than one window 1.1 GB 0.57 GB
between lowest and highest ask 2.0 GB 2.0 GB
windows let go and made again so far ~1,050 ~5,900 (5,016 grown)
process private 33.4 GB 33.4 GB
process CPU time in the frame account 349 ms 455 ms

Growing does cut the windows by ~1.6 GB and halves the overlap. But in these runs the process's private bytes did not go down: host textures were ~850 MB higher in the second run (a different spot in the world), and ~11–12 GB of the private bytes are unnamed in both. The windows are made again about five times as often, which costs CPU. One run each is too little to call it; it needs the same route twice per setting.

Also seen in both runs

~85–90 mesh pipelines failed with 0x8007000e (not enough memory) in each run. The first one came as the world loaded, while the PC still had GBs free, so this may be the driver's own limit rather than the system's. It is separate from this issue, but it could explain missing objects on machines that hit it.

What could be done

  • The overlap: an ask without a length whose next cell already has a window could take that window for the part past its own cell, instead of copying the next cell's first 2 MiB again. That would save up to ~1.1 GB here with no extra copies.
  • VICTORY_WINDOW_GROW as a default needs a measured route first, given the five-fold remakes.

I haven't written either yet. Happy to, if the maintainers think the first is the right direction.

**@⁠Trillazill** on GitHub · 2026-11-30 08:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3646#issuecomment-7273157069) Measurements for this, from two short runs on the diagnostics build (`--profile diag --features diagnostics`) at 41adb551 (with or without #3754's `VICTORY_ROOM_BY_BLOCKS`, which is off unless set), RTX 4080, windowed, same save. Each run was the menu, then a few minutes driving. The numbers come from the `copystat` memory lines; no logs are attached. ## What holds the windows (default switches) About a minute after the world loaded: - 5,060 host copies of title memory, 7.4 GB. Of them, ~900–1,000 are windows outside buffers, 5.5 GB. - Almost every window is held: 1,006 are shown by descriptor slots (6.1 GB) and the same 1,006 are held by lists or the pass over the heap. None is idle in `windows outside buffers by use`. `let_go_idle` cannot let any of them go, and that is right: they are in use. - They are not leaking. 1,050 windows (6.6 GB) had already been let go and made again since the start, and the count stays flat (~870–1,000) while driving. - 719 windows were asked for without a length. Each is 6 MiB (`unsized_window`: the 4 MiB cell plus `reach`'s 2 MiB), 4.3 GB together, which is the whole count. - The 5.5 GB of windows lie over 4.4 GB of title memory: about **1.1 GB is the same memory in two windows**. That is the 2 MiB reach of one cell's window overlapping the next cell's own window. - Of the windows alive, only ~2.0 GB lies between the lowest and highest address asked for in each. So the growth reported here is not copies nothing names. It is windows far larger than what is read, held by slots that are in use. ## The same with `VICTORY_WINDOW_GROW=1` | at the same point | default | `VICTORY_WINDOW_GROW=1` | |---|---|---| | windows outside buffers | 5.5 GB | 4.0 GB | | memory in more than one window | 1.1 GB | 0.57 GB | | between lowest and highest ask | 2.0 GB | 2.0 GB | | windows let go and made again so far | ~1,050 | ~5,900 (5,016 grown) | | process private | 33.4 GB | 33.4 GB | | process CPU time in the frame account | 349 ms | 455 ms | Growing does cut the windows by ~1.6 GB and halves the overlap. But in these runs the process's private bytes did not go down: host textures were ~850 MB higher in the second run (a different spot in the world), and ~11–12 GB of the private bytes are unnamed in both. The windows are made again about five times as often, which costs CPU. One run each is too little to call it; it needs the same route twice per setting. ## Also seen in both runs ~85–90 mesh pipelines failed with `0x8007000e` (not enough memory) in each run. The first one came as the world loaded, while the PC still had GBs free, so this may be the driver's own limit rather than the system's. It is separate from this issue, but it could explain missing objects on machines that hit it. ## What could be done - The overlap: an ask without a length whose next cell already has a window could take that window for the part past its own cell, instead of copying the next cell's first 2 MiB again. That would save up to ~1.1 GB here with no extra copies. - `VICTORY_WINDOW_GROW` as a default needs a measured route first, given the five-fold remakes. I haven't written either yet. Happy to, if the maintainers think the first is the right direction.
Author
Owner

@⁠Trillazill on GitHub · 2026-11-30 09:52 UTC · original

Follow-up with a line that says what holds the PC's memory now (#3869, diagnostics only). Same PC (RTX 4080, 32 GB RAM), Series X, default switches, a few minutes into the world:

process private 33.1–33.4 GB
PC memory the card uses 8.5–9.6 GB
shared buffers alive 953–1,115, 6.4–7.4 GB
upload buffers alive 0.9–1.0 GB

The shared buffers are the host copies of title memory: at the same moment, 1,064 windows outside buffers came to 6,496 MB. So most of what this issue sees grow after the world loads is the windows.

Three things about them:

  1. Windows that go to the card keep their shared buffer too (CardCpu::Shared, the CPU side the refresh goes through). 402 windows (2.4 GB) held both a card copy and a shared one.

  2. The overlap is larger in this run: 6,496 MB of windows over 4,922 MB of title memory, so 1.6 GB is the same memory held twice. That is the 2 MiB reach of a window asked for without a length lying over the next cell's own window.

  3. Ruled out in the same session:

    • Texture room at 75 % instead of 90 %: the card had 1.3 GB free instead of being at its budget, and the PC memory it used stayed at 7.8–9.4 GB.
    • VICTORY_LIST_LAZY=1 saved 20 MB at the menu.

    Neither textures pushed out of a full card nor host lists are where this memory goes.

So the levers for the RAM reports are the windows themselves: their size (VICTORY_WINDOW_GROW cut 1.6 GB here earlier, at the cost of five times the remakes), their overlap, and whether a window on the card needs its shared copy for as long as it lives.

**@⁠Trillazill** on GitHub · 2026-11-30 09:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3646#issuecomment-7274798239) Follow-up with a line that says what holds the PC's memory now (#3869, diagnostics only). Same PC (RTX 4080, 32 GB RAM), Series X, default switches, a few minutes into the world: | | | |---|---| | process private | 33.1–33.4 GB | | PC memory the card uses | 8.5–9.6 GB | | **shared buffers alive** | **953–1,115, 6.4–7.4 GB** | | upload buffers alive | 0.9–1.0 GB | The shared buffers are the host copies of title memory: at the same moment, 1,064 windows outside buffers came to 6,496 MB. So most of what this issue sees grow after the world loads is the windows. Three things about them: 1. **Windows that go to the card keep their shared buffer too** (`CardCpu::Shared`, the CPU side the refresh goes through). 402 windows (2.4 GB) held both a card copy and a shared one. 2. **The overlap is larger in this run:** 6,496 MB of windows over 4,922 MB of title memory, so 1.6 GB is the same memory held twice. That is the 2 MiB `reach` of a window asked for without a length lying over the next cell's own window. 3. **Ruled out in the same session:** - Texture room at 75 % instead of 90 %: the card had 1.3 GB free instead of being at its budget, and the PC memory it used stayed at 7.8–9.4 GB. - `VICTORY_LIST_LAZY=1` saved 20 MB at the menu. Neither textures pushed out of a full card nor host lists are where this memory goes. So the levers for the RAM reports are the windows themselves: their size (`VICTORY_WINDOW_GROW` cut 1.6 GB here earlier, at the cost of five times the remakes), their overlap, and whether a window on the card needs its shared copy for as long as it lives.
This discussion has been locked. Commenting is limited to contributors.
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#3646
No description provided.