startup: correct the title-memory leak note on the wrap() failure path #2793

Merged
lambirou merged 1 commit from upstream-pr/2801 into main 2026-11-26 10:58:49 +00:00
lambirou commented 2026-11-26 10:52:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-26T10:52:58Z.


Change

The wrap-failure path in create_committed says the title's allocator "has no free hook here". That is wrong: the same file documents __XMemAllocationHooks__ as {alloc, free, ...} and already uses its alloc entry for every slot 127 title-memory block.

The block still leaks on that path. This patch only makes the comment accurate: the free entry exists, but its signature and the attributes it expects have not been verified against the title, and calling it unverified on an out-of-memory path would risk a crash instead of E_OUTOFMEMORY. The comment now says what is known and what a follow-up must confirm.

Refs #2379.

Verification

Comment-only change; no code path is altered. No build or test result is claimed for behavior.

Evidence and follow-up

Follow-up for whoever takes it: confirm the free entry's calling convention and attribute encoding against the title (for example by observing a successful alloc/free pair in a diagnostic run), then call it with the same attributes title_resource_memory computed, and add a source-built fixture that provides a fake __XMemAllocationHooks__ table and checks both calls receive the same attributes.

AI-assisted.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture. (No fixture: comment-only.)
  • I updated README/docs when a capability or build requirement changed. (The comment is the documentation.)
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5508668339 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2801). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-26T10:52:58Z. --- ## Change The wrap-failure path in `create_committed` says the title's allocator "has no free hook here". That is wrong: the same file documents `__XMemAllocationHooks__` as `{alloc, free, ...}` and already uses its alloc entry for every slot 127 title-memory block. The block still leaks on that path. This patch only makes the comment accurate: the free entry exists, but its signature and the attributes it expects have not been verified against the title, and calling it unverified on an out-of-memory path would risk a crash instead of `E_OUTOFMEMORY`. The comment now says what is known and what a follow-up must confirm. Refs #2379. ## Verification Comment-only change; no code path is altered. No build or test result is claimed for behavior. ## Evidence and follow-up Follow-up for whoever takes it: confirm the free entry's calling convention and attribute encoding against the title (for example by observing a successful alloc/free pair in a diagnostic run), then call it with the same attributes `title_resource_memory` computed, and add a source-built fixture that provides a fake `__XMemAllocationHooks__` table and checks both calls receive the same attributes. AI-assisted. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [ ] I considered a negative control or failure case for a new fixture. (No fixture: comment-only.) - [x] I updated README/docs when a capability or build requirement changed. (The comment is the documentation.) - [x] I did not include game files, dumps, distribution links or secrets.
tedin7 commented 2026-11-26 10:57:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:57:52Z.

Review: COMMENTED


Review of head a579ab00 (comment-only change).

  • The diff touches only comment lines in create_committed() in src/startup_stubs/d3d12_xs_device.cpp (about line 6356). The code (resource->Release(); return E_OUTOFMEMORY;) is unchanged.
  • The new note says the title-memory block still leaks on the wrap() failure path and that the free-hook signature is unverified. This is more accurate than the old comment, which only said the allocator had no free hook.
  • Sibling callsites: no code path changes, so nothing to extend.
  • Checked: git diff --check clean; GitHub CI "Build and test on Windows" and the Linux Python checks pass.

Win2025 WARP receipt (Windows Server 2025, Build 26100, MSVC 14.44.35207) at a579ab002577aa195fc1ca80fe0c2ae285336f42. This is a comment-only change, so the check is that it still builds:

  • Debug (--preset dev): cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim OK, 26.96s
  • Release /O2 (--preset release): same targets OK, 48.54s
  • No tests were run, because no behavior changes (the pipeline found 0 downstream tests).
  • Real-GPU run not available (RunPod stopped).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6072916027 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2801#pullrequestreview-6072916027). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:57:52Z. **Review:** COMMENTED --- Review of head a579ab00 (comment-only change). - The diff touches only comment lines in `create_committed()` in `src/startup_stubs/d3d12_xs_device.cpp` (about line 6356). The code (`resource->Release(); return E_OUTOFMEMORY;`) is unchanged. - The new note says the title-memory block still leaks on the `wrap()` failure path and that the free-hook signature is unverified. This is more accurate than the old comment, which only said the allocator had no free hook. - Sibling callsites: no code path changes, so nothing to extend. - Checked: `git diff --check` clean; GitHub CI "Build and test on Windows" and the Linux Python checks pass. Win2025 WARP receipt (Windows Server 2025, Build 26100, MSVC 14.44.35207) at `a579ab002577aa195fc1ca80fe0c2ae285336f42`. This is a comment-only change, so the check is that it still builds: - Debug (`--preset dev`): `cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim` OK, 26.96s - Release /O2 (`--preset release`): same targets OK, 48.54s - No tests were run, because no behavior changes (the pipeline found 0 downstream tests). - Real-GPU run not available (RunPod stopped). AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 11:02:53 +00:00
tedin7 commented 2026-11-26 11:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:58:03Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit a579ab002577aa195fc1ca80fe0c2ae285336f42:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim -- -j 2): 26.96s (configure 1.92s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim -- -j 2): 48.54s (configure 2.31s)
  • sccache: 1/7 hits; wall 84.3s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190078930 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2801#issuecomment-7190078930). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:58:03Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `a579ab002577aa195fc1ca80fe0c2ae285336f42`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim -- -j 2`): `26.96s` (configure `1.92s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim -- -j 2`): `48.54s` (configure `2.31s`) - `sccache`: 1/7 hits; wall `84.3s` AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 11:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:58:35Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit a579ab002577aa195fc1ca80fe0c2ae285336f42:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_shim d3d12_xs_shim_check -- -j 2): 1.31s (configure 0.00s)
    • Test (ctest --preset dev -R '^d3d12_xs_shim_' --parallel 3 --no-tests=error --output-on-failure): 5/6 passed (0.29s: d3d12_xs_shim_deserialize 0.02s, d3d12_xs_shim_exports 0.04s, d3d12_xs_shim_serialize 0.04s, d3d12_xs_shim_iids 0.02s, d3d12_xs_shim_heap_indexing 0.02s, d3d12_xs_shim_warp_root 0.11s); skipped (capability, not a pass): d3d12_xs_shim_heap_indexing
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_shim d3d12_xs_shim_check -- -j 2): 0.98s (configure 0.00s)
    • Test (ctest --preset release -R '^d3d12_xs_shim_' --parallel 3 --no-tests=error --output-on-failure): 5/6 passed (0.30s: d3d12_xs_shim_serialize 0.02s, d3d12_xs_shim_exports 0.03s, d3d12_xs_shim_deserialize 0.02s, d3d12_xs_shim_iids 0.02s, d3d12_xs_shim_heap_indexing 0.02s, d3d12_xs_shim_warp_root 0.11s); skipped (capability, not a pass): d3d12_xs_shim_heap_indexing
  • sccache: 2/2 hits; wall 7.0s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190091101 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2801#issuecomment-7190091101). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:58:35Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `a579ab002577aa195fc1ca80fe0c2ae285336f42`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_shim d3d12_xs_shim_check -- -j 2`): `1.31s` (configure `0.00s`) - Test (`ctest --preset dev -R '^d3d12_xs_shim_' --parallel 3 --no-tests=error --output-on-failure`): **5/6 passed** (`0.29s`: `d3d12_xs_shim_deserialize` `0.02s`, `d3d12_xs_shim_exports` `0.04s`, `d3d12_xs_shim_serialize` `0.04s`, `d3d12_xs_shim_iids` `0.02s`, `d3d12_xs_shim_heap_indexing` `0.02s`, `d3d12_xs_shim_warp_root` `0.11s`); skipped (capability, not a pass): `d3d12_xs_shim_heap_indexing` - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_shim d3d12_xs_shim_check -- -j 2`): `0.98s` (configure `0.00s`) - Test (`ctest --preset release -R '^d3d12_xs_shim_' --parallel 3 --no-tests=error --output-on-failure`): **5/6 passed** (`0.30s`: `d3d12_xs_shim_serialize` `0.02s`, `d3d12_xs_shim_exports` `0.03s`, `d3d12_xs_shim_deserialize` `0.02s`, `d3d12_xs_shim_iids` `0.02s`, `d3d12_xs_shim_heap_indexing` `0.02s`, `d3d12_xs_shim_warp_root` `0.11s`); skipped (capability, not a pass): `d3d12_xs_shim_heap_indexing` - `sccache`: 2/2 hits; wall `7.0s` AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
R0Y00/Xbox2Windows!2793
No description provided.