xmem: physical page numbers are never reused; after ~124 GiB of total allocations they overflow the title's 21-bit field #233

Open
opened 2026-11-26 12:15:59 +00:00 by github-bot · 0 comments
Owner

@⁠kekonn on GitHub · 2026-11-26 12:12 UTC · original

crates/victory-hle/src/modules/xmem.rs:695: table.next_page += n * FRAMES only ever increases. XMemFreePhysicalPages (~719-731) removes entries but never makes their numbers available again. The doc at ~713-716 says the title stores number >> 4 in 21 bits (128 GiB of pages at most).

Once the total of all XMemAllocatePhysicalPages calls over the run passes about 124 GiB, the title's truncated numbers are unknown to us (XMemMapPhysicalPages returns null, ~1226) or alias live low-numbered pages, which means the wrong memory gets mapped.

When: the default path, but only with repeated allocate/free cycles. The title allocates about 6.1 GiB at once, and nothing shows it churning, so this is latent.

Sketch: when next_page + n*FRAMES would pass 1 << 25, search from 0x10_0000 for a run of n numbers not in table.pages. Normal behaviour is unchanged. The minimal version is a one-time warning when the limit is crossed (~5 lines).

(Checked, and not worth changing: stale LOW_RESERVATIONS entries only matter with VICTORY_PORT_CONSTANTS=1, where they cannot be observed; stale Physical.holes entries only cost a fast path.)

Upstream: no open PR changes this.


Generated by Claude Code

**@⁠kekonn** on GitHub · 2026-11-26 12:12 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/233) `crates/victory-hle/src/modules/xmem.rs:695`: `table.next_page += n * FRAMES` only ever increases. `XMemFreePhysicalPages` (~719-731) removes entries but never makes their numbers available again. The doc at ~713-716 says the title stores `number >> 4` in 21 bits (128 GiB of pages at most). Once the total of all `XMemAllocatePhysicalPages` calls over the run passes about 124 GiB, the title's truncated numbers are unknown to us (`XMemMapPhysicalPages` returns null, ~1226) or alias live low-numbered pages, which means the wrong memory gets mapped. **When:** the default path, but only with repeated allocate/free cycles. The title allocates about 6.1 GiB at once, and nothing shows it churning, so this is latent. **Sketch:** when `next_page + n*FRAMES` would pass `1 << 25`, search from `0x10_0000` for a run of `n` numbers not in `table.pages`. Normal behaviour is unchanged. The minimal version is a one-time warning when the limit is crossed (~5 lines). (Checked, and not worth changing: stale `LOW_RESERVATIONS` entries only matter with `VICTORY_PORT_CONSTANTS=1`, where they cannot be observed; stale `Physical.holes` entries only cost a fast path.) **Upstream:** no open PR changes this. --- _Generated by [Claude Code](https://claude.ai/code)_
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 12:15:59 +00:00
This discussion has been locked. Commenting is limited to contributors.
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/avatarmanz--VIctory-7900XTX#233
No description provided.