xmem: host memory fills the space below 4 GiB, so the title's 32-bit placeholder is refused at startup (fix on a branch) #790
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#790
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@NuraadGit on GitHub · 2026-11-24 10:59 UTC · original
What happens
At startup, Grand Theft Auto VI asks
XMemVirtualAllocfor a 185 MB placeholder with the 32-bit address flag (size=193986560 kind=0x42000 flags=0x7;ADDRESS_32BIT= 4, soaddress_rangegives0..4 GiB). If the host's own memory has already filled the space below 4 GiB,VirtualAlloc2fails withERROR_NOT_ENOUGH_MEMORY. The title then stops at its own assertion,0x80000003at+0x19f4f58(a check right after window setup), about 3 s after the D3D12 device is made.Windows allocates bottom up, so the host's early memory lands below 4 GiB first. That includes driver allocations, heap segments, the executable read in
run, and cache data.maindoesn't log the refusal (only the title's assertion shows), which makes this hard to spot.Evidence (RTX 2080, Windows 11, 32 GB)
A temporary probe in the refusal path walked
0..4 GiBat the moment of failure:That leaves 22 MB free below 4 GiB, with a largest hole of 14 MB. How often it happens depends on how much the host allocates early:
VICTORY_D3D12_DEBUG=1) it failed every time on this machine, through the same assertion. That's probably why GPU-based validation was unusable here.Fix
Branch: NuraadGit:xmem/guard-32bit-window, commit
ab749fdonmainffe310e, +181 lines in two files.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 is left to the host.XMemVirtualAllocthat finds no room releases the smallest guard that fits it (else the largest) and retries the same call. It then guards whatever is still free of that hole.low_guards::tests::a_released_guard_is_guarded_again_around_what_took_it.Result on the same machine and build: 5 of 5 startups passed, with 3.7 GB below 4 GiB kept for the title. Before the fix it failed 2 of 3.
AI-assisted (Claude Code): the probe, fix, test and runs were automated. The hardware, title copy and runs are the user's.
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 11:11 UTC · original
Verified and merged downstream in https://github.com/LAKSHYA-cmd-tech/VIctory/pull/11.
un\ to preserve address space below 4 GiB for GTA VI's 185 MB 32-bit placeholder.
@Marvisak on GitHub · 2026-11-25 03:53 UTC · original · edited 2026-11-25 12:44 UTC
Automated triage for the maintainers. Confirmed by reading
main(940d32f):XMemVirtualAllocincrates/victory-hle/src/modules/xmem.rslimits a request with the 32-bit flag to0..4 GiB(address_range). Nothing keeps the host's own early allocations out of that range, and the refusal is not logged. A large 32-bit placeholder can therefore fail whenever the host has already used most of the low 4 GiB, as the probe above shows. None of the changes merged since the first triage touch this.Open PR #1009 (keep the space below 4 GiB for the title's 32-bit memory) carries this fix. The comment from WHOISJARDAS adds a second trigger that makes it fail every time: Bottom-up ASLR turned off system-wide (RX 9070 XT, 4 of 4 starts stopped at
+0x19f4f58). #1009's guards fixed that case too (3 of 3 starts). Until it lands, turning Bottom-up ASLR back on, or forcing it forvictory.exe, works around it.Generated by Claude Code
@WHOISJARDAS on GitHub · 2026-11-25 12:05 UTC · original
Another trigger that makes this deterministic: Windows Security, Exploit protection, Randomize memory allocations (Bottom-up ASLR) turned Off system-wide (
Get-ProcessMitigation -SystemshowsBottomUp: OFF; the default is On). With it off, every host allocation starts at the lowest free address.AMD Radeon RX 9070 XT (driver 32.0.32029.2010), Windows 11 26200, title build
b99f876b: the title stopped at+0x19f4f58on 4 of 4 starts. A probe in the refusal path found 3 MB free below 4 GiB, largest hole 64 KiB, 1,635 regions. 2.3 GB of it was the AMD driver's shader cache files (%LOCALAPPDATA%\AMD\DxcCache\*.parc, one of 1.5 GB) mapped there, plus 1.7 GB of private memory.Two checks:
PROC_THREAD_ATTRIBUTE_MITIGATION_POLICYwithBOTTOM_UP_ASLR_ALWAYS_ON | HIGH_ENTROPY_ASLR_ALWAYS_ON, no system change) reached the menus at 30 fps.guards=2 mb=3797..3805.So #1009 covers this case too. For anyone hitting the int3 without it, turning Bottom-up ASLR back on (or forcing it for
victory.exeunder "Program settings") is a workaround.AI-assisted (Claude Code). Hashes, offsets, sizes and the runtime's own log text only.