XMem: keep allocation errors and report system commit #4318
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4318
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4317"
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?
@tyr0nsur on GitHub · 2026-11-30 18:50 UTC · original
tyr0nsur:codex/report-xmem-commit-headroom→main· +101 −36 · 1 files · 1 commits · openRelated to #4292.
What it changes
The report showed Win32 error 8 while the title's window still had a large free gap. The tester could start with the same profile after increasing the Windows paging file. A play log with the system commit figures next to the failed allocation would help distinguish this pattern from a refusal caused by limited address space.
Capture the result of each
VirtualAllocorVirtualAlloc2attempt before probing the window, trimming spare buffers or logging. If a retry fails, use its error. Return the final failure code to the title. For memory refusals, log the system commit in use and its limit when Windows supplies the figures. Preserve the existing crash-log path forERROR_COMMITMENT_LIMITand the existing retry and placement choices.How it was tested
e1251c31, a zero-byte commit set Win32 error 87, and the logging path returned 88 after a synthetic log sink changed the thread's error. With this patch the regression keeps 87.cargo test -p victory-hle --locked --lib --quiet -- --test-threads=1passed (470 passed, 13 ignored). The staged asset-policy check passed.Checked for overlap
Developed with Codex and reviewed with Claude Opus 5.5.
@babuakhil on GitHub · 2026-11-30 19:42 UTC · original
Checked on Windows 11 (Rust 1.98.1, pinned), on
main(e1251c31), which this is based on. Not tested in the game.The lost error is real without the synthetic sink. A throwaway test (not part of this PR) made the same refused zero-byte commit through
XMemVirtualAllocand readGetLastError()right after, with three subscribers:maintracing_subscriber::fmt()writing to stderrERROR_INVALID_HANDLE)So with ordinary logging,
mainalready hands the title the logger's error instead of Windows' refusal, and theSetLastErrorat the end fixes that. That's the part that matters for a title deciding what to do after a null. I also checked that no path out ofXMemVirtualAllocskips it: the only early return hands back the title's own placeholder, not a failure.cargo test -p victory-hle --lib modules::xmem: 50 passed and 1 failed, two runs out of two. The failure isa_read_by_range_waits_only_for_a_remapping_that_meets_it, which fails the same way onmain(49 passed, 1 failed, two runs out of two) and passes alone on both, so it's the timing test you mentioned, not this change. Clippy's only note inxmem.rs, theunwrap_or_defaultmatch inport_on, is onmaintoo (line 1933 there, 1956 here).2633ccb9d1tob992a995b5View 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.