report apu heap allocations that fail #1720

Manually merged
github merged 1 commit from gh-pr/1720/head into gh-pr/1720/base 2026-11-26 04:42:39 +00:00
Owner

@⁠imjustprism on GitHub · 2026-11-24 21:17 UTC · original
imjustprism:hle/apu-alloc-refusal-report → main · +112 −20 · 2 files · 1 commits · merged 2026-11-25 21:51 UTC

when the host allocator refuses an apu heap allocation, ApuAlloc returns E_OUTOFMEMORY and nothing is written anywhere. the title in #289 does not check that result and crashes a moment later on a write near null, so the crash log points at the title instead of at the cause. the refusal now goes to crashes.log with the size and the system commit, the same way the commit-limit report in xmem does, and 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.

checked live: running the title in a job object with a 7.1 GB per-process commit cap reproduces #289, and crashes.log then starts with the refused allocation (about 401 MiB) and the commit numbers. only the report text has a unit test, the host allocator cannot be made to return null in one. clippy both ways, cargo test --workspace (343 passed) and xtask policy on windows 11.

#538 does the same for XMemVirtualAlloc and XMemAllocDefault and touches the same part of xmem.rs, so the two will conflict. #528 and #237 also touch ApuAlloc.

refs #289

**@⁠imjustprism** on GitHub · 2026-11-24 21:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1720) `imjustprism:hle/apu-alloc-refusal-report` → `main` · +112 −20 · 2 files · 1 commits · merged 2026-11-25 21:51 UTC when the host allocator refuses an apu heap allocation, ApuAlloc returns E_OUTOFMEMORY and nothing is written anywhere. the title in #289 does not check that result and crashes a moment later on a write near null, so the crash log points at the title instead of at the cause. the refusal now goes to crashes.log with the size and the system commit, the same way the commit-limit report in xmem does, and 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. checked live: running the title in a job object with a 7.1 GB per-process commit cap reproduces #289, and crashes.log then starts with the refused allocation (about 401 MiB) and the commit numbers. only the report text has a unit test, the host allocator cannot be made to return null in one. clippy both ways, cargo test --workspace (343 passed) and xtask policy on windows 11. #538 does the same for XMemVirtualAlloc and XMemAllocDefault and touches the same part of xmem.rs, so the two will conflict. #528 and #237 also touch ApuAlloc. refs #289
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:38 +00:00
github manually merged commit bef186b082 into gh-pr/1720/base 2026-11-26 04:42:39 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:35 UTC · original · edited 2026-11-25 07:19 UTC

Automated triage for the maintainers.

Merge candidate. When the host allocator or the device-address range refuses an APU heap block, heap_alloc (audio.rs) now returns a HeapRefusal, and the callers (ApuAlloc, AcpHalAllocateShapeContexts) report it after dropping their locks. A host refusal goes to crashes.log through the new xmem::report_allocator_refusal, which shares its text with the existing commit-limit report. The HRESULT the title sees does not change. The lock order is fine: the HEAP guard is released on return, and CONTEXTS is dropped before report().

Update after your reply: confirmed, the branch now merges cleanly with main, so the #538 conflict is gone. CI passes.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1720#issuecomment-7152063823) · edited 2026-11-25 07:19 UTC <!-- victory-triage v1 head=bef186b082fd296efdff626fed784f535d058b62 verdict=merge-candidate at=2026-11-25T07:19:06Z --> Automated triage for the maintainers. **Merge candidate.** When the host allocator or the device-address range refuses an APU heap block, `heap_alloc` (`audio.rs`) now returns a `HeapRefusal`, and the callers (`ApuAlloc`, `AcpHalAllocateShapeContexts`) report it after dropping their locks. A host refusal goes to crashes.log through the new `xmem::report_allocator_refusal`, which shares its text with the existing commit-limit report. The HRESULT the title sees does not change. The lock order is fine: the HEAP guard is released on return, and CONTEXTS is dropped before `report()`. Update after your reply: confirmed, the branch now merges cleanly with `main`, so the #538 conflict is gone. CI passes. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠imjustprism on GitHub · 2026-11-25 04:14 UTC · original

the description is out of date on one point: #538 is merged and this branch is rebased over it, so the xmem.rs conflict it mentions is gone. it merges clean into main at 940d32f and ci is green.

**@⁠imjustprism** on GitHub · 2026-11-25 04:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1720#issuecomment-7152663917) the description is out of date on one point: #538 is merged and this branch is rebased over it, so the xmem.rs conflict it mentions is gone. it merges clean into main at 940d32f and ci is green.
Author
Owner

@⁠StExpeditus on GitHub · 2026-11-25 09:30 UTC · original

Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at bef186b. cargo test --workspace --locked --no-fail-fast -> 694 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.

**@⁠StExpeditus** on GitHub · 2026-11-25 09:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1720#issuecomment-7158423800) **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `bef186b`. `cargo test --workspace --locked --no-fail-fast` -> 694 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.
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/Marvisak--VIctory!1720
No description provided.