xmem: name both owners when allocations come to share pages (VICTORY_TRACE_OWNERS) #111
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/111"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T16:44:14Z.
What this changes
Refs #15 ("Needed: finding which allocations in xmem_posix share pages").
VICTORY_TRACE_OWNERS=1logs a warning naming both owners at the moment two allocations come to share title memory:XMemMapPhysicalPages,…Scatter,map_alias/ CopyPageMappings,back_with_pool) lands over an existing view.XMemAllocatePhysicalPageshands out page numbers past what the title keeps (number >> 4in 21 bits), so truncated numbers would land on other allocations.VirtualFree(MEM_DECOMMIT)on a range that still has pool views. Since #108,MEM_RELEASEgives the views back, so it no longer fires for a normal release.For each owner the log gives the call that made it, its base and length, the pool id and page index, a sequence number, and the title's return address (
image+off) when on a title thread.Off by default, documented under "Bring-up diagnostics". Turned off, the cost is one
LazyLock<bool>read per call: every write to the owner bookkeeping is behind the switch.How it was tested
cfg(test)counter. The tests compare pool ids rather than addresses, so parallel tests can't make them flaky; C2 is checked through a pure function.cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory, arm64cargo test --workspacecargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with--all-features; clippy for macOS reports nothing new in the files touchedcargo xtask policyChecklist
VICTORY_*variable and documentedImported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T17:17:02Z.
Merged in
182c14f. It's off unlessVICTORY_TRACE_OWNERSis set, it's documented, and each case fires in a test. Thanks!