xmem: reserve low address space for 32-bit allocations #44

Open
github-bot wants to merge 1 commit from github-bot/gh-44 into main AGit
Owner

@⁠jrdev95 on GitHub · 2026-12-04 14:56 UTC · original
jrdev95:fix/xmem-low-address-space → main · +140 −3 · 2 files · 1 commits · open

Problem

At startup, the title requests a 185 MiB XMemVirtualAlloc reservation below 4 GiB (size=193986560, kind=0x42000, flags=0x7). The request can fail with ERROR_NOT_ENOUGH_MEMORY when host or GPU driver allocations fragment that address range. This can happen even when the system has enough RAM and page file capacity, because the allocation needs one contiguous block in a constrained address range.

Fix

  • Reserve currently free address space below 4 GiB early in run, before loading the game image, creating the GPU device, or opening shader caches.
  • Leave the first 256 MiB of free low address space available to the host.
  • If a constrained 32-bit XMemVirtualAlloc request fails, release guarded ranges one at a time and retry the allocation. Re-guard any parts that remain free afterward.

This reserves virtual address space only; it does not commit RAM or page file capacity.

**@⁠jrdev95** on GitHub · 2026-12-04 14:56 UTC · [original](https://github.com/bymsec/victory-rx580/pull/44) `jrdev95:fix/xmem-low-address-space` → `main` · +140 −3 · 2 files · 1 commits · open ## Problem At startup, the title requests a 185 MiB `XMemVirtualAlloc` reservation below 4 GiB (`size=193986560`, `kind=0x42000`, `flags=0x7`). The request can fail with `ERROR_NOT_ENOUGH_MEMORY` when host or GPU driver allocations fragment that address range. This can happen even when the system has enough RAM and page file capacity, because the allocation needs one contiguous block in a constrained address range. ## Fix - Reserve currently free address space below 4 GiB early in `run`, before loading the game image, creating the GPU device, or opening shader caches. - Leave the first 256 MiB of free low address space available to the host. - If a constrained 32-bit `XMemVirtualAlloc` request fails, release guarded ranges one at a time and retry the allocation. Re-guard any parts that remain free afterward. This reserves virtual address space only; it does not commit RAM or page file capacity.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 19:49:19 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/44/head:github-bot/gh-44'
git switch 'github-bot/gh-44'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-44'
git switch 'github-bot/gh-44'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-44'
git switch 'github-bot/gh-44'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-44'
git switch 'main'
git merge --squash 'github-bot/gh-44'
git switch 'main'
git merge --ff-only 'github-bot/gh-44'
git switch 'main'
git merge 'github-bot/gh-44'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.