User startup crash: xmem: keep a stretch below 4 GiB for the title's 32-bit graphics heap #43

Open
staticman256 wants to merge 1 commit from upstream-pr/43 into main
staticman256 commented 2026-12-04 10:47:30 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by staticman256 on 2026-12-04T10:47:30Z.


xmem: keep a stretch below 4 GiB for the title's 32-bit graphics heap

In plain terms

On some PCs the game dies half a second after launch, before the first frame, with
nothing on screen to say why. On the machine this was traced on (RX 9070 XT, Windows 11)
that happened on most starts of v0.2.0, v0.4.0 and v0.5.0. The one user who reported it
was technical enough to collect logs, build branches and run an A/B. Most people who hit
it will see a launcher that "does nothing" and move on, so the number of affected users
is likely larger than the number of reports.

The fix is small (2 files), has an off switch, and changes nothing on machines that
never had the problem.

What was wrong

At its start the title asks once for a 185 MB region that must be one free piece of
address space below 4 GiB (XMemVirtualAlloc, kind 0x42000, flags 0x7). The request
arrives late: after the driver, its shader cache files and the packed shader cache are
mapped. On an affected machine those land below 4 GiB and leave no piece that big. The
request is refused (os error 8, though 24 GB of RAM was free), NULL is returned, and
the title stops on its own assert (0x80000003 at victory-image+0x19f4f58). There was
no retry.

What is changed

  • A 256 MB placeholder below 4 GiB is held first thing in a run, before the title image,
    the driver and the shader cache are loaded. The title's 32-bit heap is split off its
    front and the rest is released.
  • VICTORY_LOW_WINDOW_MB sets the size; 0 gives the old behaviour.
  • A refused 32-bit request now logs what holds the space below 4 GiB (free total,
    biggest free piece, the ten biggest allocations with file names). Until now a report of
    this kind could not be diagnosed from a log.

Evidence

Affected machine, both binaries built there with the same toolchain, launched
alternately:

build refused started
upstream v0.5.0 6 / 6 0 / 6
this branch 0 / 6 5 / 6 (the sixth: an unrelated 0xc0000005)
this branch, VICTORY_LOW_WINDOW_MB=0 4 / 4 0 / 4

With the branch, runs of 25 minutes (23,112 frames) and 6.5 minutes were played. The new
log line at a refusal showed 4 MB free below 4 GiB in about 700 allocations, the biggest
being two 1 GiB private blocks, the AMD driver's .parc shader cache maps (512, 192, 128
and 64 MB), shaders-pack.bin (238 MB) and amdxc64.dll (136 MB).

On a machine that never failed (also RX 9070 XT) the stretch was held at 0x2580000, the
heap was placed in it, and play was unchanged; with =0 none of the new lines appeared.

Not covered

  • Why ordinary allocations land below 4 GiB on the affected machine and not on others was
    not established, nor who owns the two 1 GiB blocks.
  • Without the fix the failure comes in streaks: one earlier batch of four =0 starts was
    granted near the top of the range (0xf2…).
  • The 0xc0000005 (reserved, never committed) and a single stack overflow seen on that
    machine occur with and without this change and are not addressed.
  • The cases where the early hold itself is refused, or the request does not fit it, were
    not exercised; both fall back to the old path.

Claude Fable 5.2/Medium

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:issue:5645010085 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/43). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T10:47:30Z. --- ## xmem: keep a stretch below 4 GiB for the title's 32-bit graphics heap ### In plain terms On some PCs the game dies half a second after launch, before the first frame, with nothing on screen to say why. On the machine this was traced on (RX 9070 XT, Windows 11) that happened on most starts of v0.2.0, v0.4.0 and v0.5.0. The one user who reported it was technical enough to collect logs, build branches and run an A/B. Most people who hit it will see a launcher that "does nothing" and move on, so the number of affected users is likely larger than the number of reports. The fix is small (2 files), has an off switch, and changes nothing on machines that never had the problem. ### What was wrong At its start the title asks once for a 185 MB region that must be one free piece of address space below 4 GiB (`XMemVirtualAlloc`, kind 0x42000, flags 0x7). The request arrives late: after the driver, its shader cache files and the packed shader cache are mapped. On an affected machine those land below 4 GiB and leave no piece that big. The request is refused (`os error 8`, though 24 GB of RAM was free), NULL is returned, and the title stops on its own assert (`0x80000003` at `victory-image+0x19f4f58`). There was no retry. ### What is changed - A 256 MB placeholder below 4 GiB is held first thing in a run, before the title image, the driver and the shader cache are loaded. The title's 32-bit heap is split off its front and the rest is released. - `VICTORY_LOW_WINDOW_MB` sets the size; `0` gives the old behaviour. - A refused 32-bit request now logs what holds the space below 4 GiB (free total, biggest free piece, the ten biggest allocations with file names). Until now a report of this kind could not be diagnosed from a log. ### Evidence Affected machine, both binaries built there with the same toolchain, launched alternately: | build | refused | started | |---|---:|---:| | upstream v0.5.0 | 6 / 6 | 0 / 6 | | this branch | 0 / 6 | 5 / 6 (the sixth: an unrelated `0xc0000005`) | | this branch, `VICTORY_LOW_WINDOW_MB=0` | 4 / 4 | 0 / 4 | With the branch, runs of 25 minutes (23,112 frames) and 6.5 minutes were played. The new log line at a refusal showed 4 MB free below 4 GiB in about 700 allocations, the biggest being two 1 GiB private blocks, the AMD driver's `.parc` shader cache maps (512, 192, 128 and 64 MB), `shaders-pack.bin` (238 MB) and `amdxc64.dll` (136 MB). On a machine that never failed (also RX 9070 XT) the stretch was held at 0x2580000, the heap was placed in it, and play was unchanged; with `=0` none of the new lines appeared. ### Not covered - Why ordinary allocations land below 4 GiB on the affected machine and not on others was not established, nor who owns the two 1 GiB blocks. - Without the fix the failure comes in streaks: one earlier batch of four `=0` starts was granted near the top of the range (0xf2…). - The `0xc0000005` (`reserved, never committed`) and a single stack overflow seen on that machine occur with and without this change and are not addressed. - The cases where the early hold itself is refused, or the request does not fit it, were not exercised; both fall back to the old path. --- Claude Fable 5.2/Medium
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/43:upstream-pr/43'
git switch 'upstream-pr/43'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/43'
git switch 'upstream-pr/43'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/43'
git switch 'upstream-pr/43'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/43'
git switch 'main'
git merge --squash 'upstream-pr/43'
git switch 'main'
git merge --ff-only 'upstream-pr/43'
git switch 'main'
git merge 'upstream-pr/43'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ReTerryDavis/ReVIctory!43
No description provided.