HLE: a refused audio heap allocation is told in the crash log (port of Marvisak#1720) #670

Manually merged
github merged 1 commit from github-bot/gh-670 into main 2026-11-29 08:22:33 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 03:15 UTC · original
kibagami-nc:fix/apu-heap-refusals-logged → main · +112 −20 · 2 files · 1 commits · merged 2026-11-29 08:16 UTC

The problem

When the host allocator refuses an APU (audio) heap allocation, ApuAlloc returns E_OUTOFMEMORY and nothing is written anywhere. A title that does not check the result crashes a moment later on a write near null. The crash log then points at the title instead of at the cause, which is the system running out of commit. That is the case on PCs with little RAM or a small paging file.

The change

  • The refusal goes to crashes.log. The entry gives the size asked for and the system's commit (in use and limit), the way xmem's commit-limit report already does, with a hint at Windows' paging file size.
  • A request no device-address range fits gets a warning.
  • No locks are held. Both are reported by the caller after its locks are dropped.
  • The title sees nothing new. This tree's log line for audio memory of 32 MiB or more stays.

This is a port of imjustprism's fix (Marvisak/VIctory#1720, refs Marvisak/VIctory#289). Upstream reproduced the crash by running the title in a job object with a 7.1 GB commit cap: crashes.log then starts with the refused allocation (about 401 MiB) and the commit numbers.

The two conflicts were small:

  • in audio.rs, this tree's log line for big audio allocations is kept with the new Ok return;
  • in xmem.rs, this tree's tests sit beside the new one.

It also merges cleanly with #538, which changes another part of xmem.rs.

Tests

  • New xmem::tests::allocator_refusal_report_names_apu_heap_and_system_commit: the report's text, with and without the system's commit numbers. The host allocator cannot be made to return null in a test.
  • cargo test -p victory-hle --locked --lib: 189 passed, 3 ignored, plus 1.
  • cargo clippy -p victory-hle --all-targets -- -D warnings, with and without --all-features: no warnings. To get there, clippy needed the four fixes of #665 applied, since main stops it in victory-gpu first.

No game files, dumps or extracted data are included.

**@⁠kibagami-nc** on GitHub · 2026-11-28 03:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/670) `kibagami-nc:fix/apu-heap-refusals-logged` → `main` · +112 −20 · 2 files · 1 commits · merged 2026-11-29 08:16 UTC ## The problem When the host allocator refuses an APU (audio) heap allocation, `ApuAlloc` returns `E_OUTOFMEMORY` and nothing is written anywhere. A title that does not check the result crashes a moment later on a write near null. The crash log then points at the title instead of at the cause, which is the system running out of commit. That is the case on PCs with little RAM or a small paging file. ## The change - **The refusal goes to `crashes.log`.** The entry gives the size asked for and the system's commit (in use and limit), the way xmem's commit-limit report already does, with a hint at Windows' paging file size. - **A request no device-address range fits gets a warning.** - **No locks are held.** Both are reported by the caller after its locks are dropped. - **The title sees nothing new.** This tree's log line for audio memory of 32 MiB or more stays. This is a port of imjustprism's fix ([Marvisak/VIctory#1720](https://github.com/Marvisak/VIctory/pull/1720), refs Marvisak/VIctory#289). Upstream reproduced the crash by running the title in a job object with a 7.1 GB commit cap: `crashes.log` then starts with the refused allocation (about 401 MiB) and the commit numbers. The two conflicts were small: - in `audio.rs`, this tree's log line for big audio allocations is kept with the new `Ok` return; - in `xmem.rs`, this tree's tests sit beside the new one. It also merges cleanly with #538, which changes another part of `xmem.rs`. ## Tests - New `xmem::tests::allocator_refusal_report_names_apu_heap_and_system_commit`: the report's text, with and without the system's commit numbers. The host allocator cannot be made to return null in a test. - `cargo test -p victory-hle --locked --lib`: 189 passed, 3 ignored, plus 1. - `cargo clippy -p victory-hle --all-targets -- -D warnings`, with and without `--all-features`: no warnings. To get there, clippy needed the four fixes of #665 applied, since `main` stops it in `victory-gpu` first. No game files, dumps or extracted data are included.
When the host allocator refuses an APU heap allocation, ApuAlloc returns
E_OUTOFMEMORY and nothing is written anywhere. A title that does not check
the result crashes a moment later on a write near null, and the crash log
points at the title instead of at the cause.

The refusal now goes to crashes.log with the size asked for and the
system's commit (in use and limit), the way xmem's commit-limit report
does, with a hint at Windows' paging file size; a request that no device
address range fits gets a warning. Both are reported by the caller after
its locks are dropped. What the title sees does not change. (The log
line this tree has for audio memory of 32 MiB or more stays.)

Port of imjustprism's fix (Marvisak/VIctory#1720, refs
Marvisak/VIctory#289), with its test of the report's text
(allocator_refusal_report_names_apu_heap_and_system_commit). The host
allocator cannot be made to return null in a test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:19:07 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 05:36 UTC · original · approved these changes

LGTM — verified on Windows:

  • cargo test -p victory-hle --lib audio (8/8) and xmem (23/23, including allocator_refusal_report_names_apu_heap_and_system_commit) passed
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (294 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 05:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/670#pullrequestreview-6096072503) · **approved these changes** LGTM — verified on Windows: - `cargo test -p victory-hle --lib audio` (8/8) and `xmem` (23/23, including `allocator_refusal_report_names_apu_heap_and_system_commit`) passed - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`294 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github manually merged commit 41527608e9 into main 2026-11-29 08:22:33 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!670
No description provided.