xmem: keep the space below 4 GiB for the title's 32-bit memory (port of VIctory#1009) #39
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!39
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-39"
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?
@WHOISJARDAS on GitHub · 2026-11-25 12:34 UTC · original
WHOISJARDAS:xmem/keep-low-4gib→main· +217 −2 · 2 files · 1 commits · openOn this machine (RX 9070 XT, Ryzen 7 9800X3D, Windows 11 26200) this fork's
4cbe9d7cannot start the title: it stops at the title's own assertion,0x80000003at+0x19f4f58, about 1 s in. This is Marvisak/VIctory#790: the title's 185 MB 32-bit placeholder (XMemVirtualAllocsize=193986560 kind=0x42000 flags=0x7) finds no room below 4 GiB, because the host's memory got there first. Here 2.3 GB of it was the AMD driver's shader cache files (%LOCALAPPDATA%\AMD\DxcCache\*.parc) mapped below 4 GiB, and Exploit protection's Bottom-up ASLR is off system-wide, so it happens on every start.This is a port of Marvisak/VIctory#1009 (NuraadGit, with MichaelSmithAI's bounded retry), the same change as Zettrox/ztrx#108:
xmem::low_guards::install()at the start ofrunreserves the free space below 4 GiB but the lowest 256 MB;XMemVirtualAllocreleases guards one at a time and retries, guarding again what stays free;warn(nothing was logged before);low_guards::tests::*(2).Tested
RX 9070 XT (driver 32.0.32029.2010), Series X profile, this README's settings:
4cbe9d7stopped at+0x19f4f58at start; with this, it starts and reaches the world (space below 4 GiB kept for the title guards=2 mb=3722).cargo test -p victory-hle --lib low_guards: 2 passedAI use: Claude Code (Claude Opus 5.5) ported the change and ran the checks; the hardware and runs are mine.
🤖 Generated with Claude Code
@gut0to on GitHub · 2026-11-27 14:49 UTC · original · reviewed
AI-assisted static review (ChatGPT); I inspected the retry tests but did not run them.
@ -1737,0 +1880,4 @@}}// SAFETY: sets this thread's last-error value.unsafe { SetLastError(error) };@gut0to on GitHub · 2026-11-27 14:49 UTC · original
Could the refused-retry test also assert last-error preservation? Its allocation closure currently returns null without setting an error, so the tests cover guard restoration but not that
retryrestores the finalVirtualAllocerror after the address queries and guard recreation. An injected closure can set a known error such asERROR_NOT_ENOUGH_MEMORY, then assertGetLastError()returns it after retry; the caller relies on this value when reporting exhaustion.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.