xmem: report allocations the host refuses #538
No reviewers
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!538
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/538/head"
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?
@coderanonymus on GitHub · 2026-11-24 04:39 UTC · original
coderanonymus:xmem-report-refusals→main· +40 −10 · 1 files · 1 commits · merged 2026-11-25 00:08 UTCRelated to #289 (and the commit-limit reports of #23 / #51).
Why
If the host refuses
XMemVirtualAllocorXMemAllocDefault, the title gets a null and nothing is logged. A title that builds on that base then faults at null plus an offset, and the crash looks like a title bug.#289 looks like this case. The faulting
memsetwrites to0x217800, with length0x2173a0.0x2173a0rounded up to 2 KiB is exactly0x217800. So the destination is most likely a null base plus one aligned block, not a real pointer and not an APU device address. Which allocation returned the null can't be told from the report. With this change, the log would show it.What
XMemVirtualAllocreturning null:crashes.logreport that the physical-page commit has written since #51 (request size, system commit, the paging-file advice).XMemAllocDefaultwith the host heap out of memory: a warning with the size.commit_refused(len, what, error), now shared by both commit paths.commit_limit_messagetakeswhat("physical pages" or "virtual memory"). Its test now checks both wordings.field_reassign_with_defaulton the movedPERFORMANCE_INFORMATIONsetup is fixed.The OS error is read right after
VirtualAlloc2, before any logging can change it.Verification
cargo clippy -p victory-hle --tests --target x86_64-pc-windows-msvc: no warnings (one fewer thanmain).rustfmt: no diffs inxmem.rs.commit_limit_report_includes_request_and_system_commit) was type-checked but not executed.No game data used.
🤖 Generated with Claude Code
@geiyiliyabumo on GitHub · 2026-11-24 11:47 UTC · original
Independent verification & code review on Windows 11 Pro (build 26100, Rust
1.98.1), cleanly merged ontomain(ffe310e):cargo xtask policy: PASS (154 files ok)cargo clippy -p victory-hle --all-targets --locked -- -D warnings: PASScargo clippy -p victory-hle --all-targets --features diagnostics --locked -- -D warnings: PASScargo test -p victory-hle --locked: 94 passed + 1 integration test (no_dll_planting), 0 failed (including updatedcommit_limit_report_includes_request_and_system_commit)Diff review (
crates/victory-hle/src/modules/xmem.rs): clean, minimal, and very useful diagnostics for OOM/commit-limit failures.XMemVirtualAlloc, callingcommit_refused(K32GetPerformanceInfo+log_crashfile I/O) ortracing::warn!before returningNULLcan overwrite the thread's Win32 last-error code; restoringSetLastErrorfromerror.raw_os_error()before returningatwould preserveGetLastError()for title callers that inspect it after a failed allocation.AI-assisted; synthetic tests only, no game files.