xmem: keep the space below 4 GiB for the title's 32-bit memory (port of VIctory#1009) #108
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/108"
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?
Imported from Zettrox/ztrx. Originally posted by WHOISJARDAS on 2026-11-25T12:05:19Z.
A port of Marvisak/VIctory#1009 by NuraadGit (with MichaelSmithAI's bounded retry), which fixes Marvisak/VIctory#790 upstream and is not in this tree yet. On this machine,
maincannot start the title at all.What was wrong
At startup the title asks
XMemVirtualAllocfor a 185 MB placeholder with the 32-bit address flag (size=193986560 kind=0x42000 flags=0x7), soaddress_rangelimits it to0..4 GiB. Windows places the host's own memory bottom up, so the drivers' mapped shader caches, heap segments and the image read inruncan fill that space first.VirtualAlloc2then fails withERROR_NOT_ENOUGH_MEMORY, nothing is logged, and the title stops at its own assertion:0x80000003at+0x19f4f58, about 1 s after start, right after the D3D12 device is made.A temporary probe in the refusal path (not part of this PR) mapped
0..4 GiBat the failure:%LOCALAPPDATA%\AMD\DxcCache\*.parc, one of 1.5 GB)New detail: on this machine Windows Security, Exploit protection, Randomize memory allocations (Bottom-up ASLR) is Off system-wide (
Get-ProcessMitigation -SystemshowsBottomUp: OFF; the Windows default is On). With it off, every host allocation starts at the lowest free address, so the failure is deterministic. Starting the same unpatched build with bottom-up and high-entropy ASLR forced on for that one process (PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY, no system change) started the title normally. The guards fix it either way.What this changes
Same as Marvisak/VIctory#1009:
xmem::low_guards::install()runs at the start ofrunwhen executing, before the image read, the device and the caches. It reserves the free space below 4 GiB except the lowest 256 MB, which stays with the host.XMemVirtualAllocreleases guards one at a time (smallest that fits first, each tried once) and retries, then guards again whatever stays free in that guard. The normal path is unchanged.low_guards::tests::a_released_guard_is_guarded_again_around_what_took_itanda_refused_retry_leaves_the_guards_in_place.Differences from Marvisak/VIctory#1009: the doc comment doesn't name the game, and a 32-bit request still refused after the retry logs one
warn(this tree logs no refusal at all, which is why this took a probe to find).Tested
AMD Radeon RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26200, bottom-up ASLR off, diag build, Series X profile, Rust 1.98.1:
main(90b529f)+0x19f4f58space below 4 GiB kept for the title guards=2 mb=3797..3805no room below 4 GiBcargo test --workspace --locked: 498 passed, 0 failed, 7 ignored, including the twolow_guardstestscargo clippy --workspace --all-targets --locked -- -D warningsand the--all-featuresrun: cleancargo xtask policy: okNot tested
NVIDIA and Intel cards; a machine with bottom-up ASLR on (there the failure needs a large driver cache, as in the RTX 2080 and RTX 3060 Ti reports on Marvisak/VIctory#790 and Marvisak/VIctory#1009); Linux/Wine.
AI use
Claude Code (Claude Opus 5.5) found the refusal with a probe, ported and adapted the upstream change and ran the checks. The hardware, the title copy and the runs are mine.
🤖 Generated with Claude Code
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.