gpu: reclaim empty Paged pages (ring-heap malloc growth) (#639) #640

Open
jamal-fv wants to merge 160 commits from upstream-pr/640 into main
jamal-fv commented 2026-11-28 21:05:07 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by jamal-fv on 2026-11-28T21:05:07Z.


Summary

  • Refs #639 (console-budget footprint).
  • Reclaim empty Paged pages (ring-heap MALLOC growth) — prior commit.
  • Anonymous VM / 87k regions: gapless multi-pool spans used Stitch (mach_vm_remap per 64 KiB piece → one untagged VM region each). Prefer wrap_title_memory when the title VA is already mapped (pieces=0); keep Stitch for unmapped VAs and gaps. VICTORY_TRACE_MEMORY buffer lines report stitch piece counts vs title wraps.
  • Report: reports/world-vm-growth.md.

Test plan

  • cargo test -p victory-gpu --lib mapped_gapless
  • cargo test -p victory-gpu --lib mirror_tests (47 passed)
  • cargo test -p victory-metal stitch_of_n_pages_makes_about_n_vm_regions
  • World footprint before/after — blocked: headless tip dies at 0xc000001d image+0x55ff714 (~75 s, frame 0), same RVA as pre-fix attempt; never reaches world / TRACE_MEMORY span lines.

How it was tested

  • Unit: mapped gapless title VA wraps (0 stitch pieces); fake VA still stitches; Stitch of N pages ≈ N VM regions.
  • Headless attempt: run-native.sh --headless --seconds 420 with VICTORY_METAL_TEXTURE_BUDGET_MB=4348 VICTORY_TEXTURE_DROP_TOP_MIP=1 VICTORY_TRACE_MEMORY=5 under game.lock — abort before world.
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5544563358 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/640). Originally posted by [jamal-fv](https://github.com/jamal-fv) on 2026-11-28T21:05:07Z. --- ## Summary - **Refs #639** (console-budget footprint). - Reclaim empty `Paged` pages (ring-heap MALLOC growth) — prior commit. - **Anonymous VM / 87k regions:** gapless multi-pool spans used `Stitch` (`mach_vm_remap` per 64 KiB piece → one untagged VM region each). Prefer `wrap_title_memory` when the title VA is already mapped (`pieces=0`); keep Stitch for unmapped VAs and gaps. `VICTORY_TRACE_MEMORY` buffer lines report stitch piece counts vs title wraps. - Report: `reports/world-vm-growth.md`. ## Test plan - [x] `cargo test -p victory-gpu --lib mapped_gapless` - [x] `cargo test -p victory-gpu --lib mirror_tests` (47 passed) - [x] `cargo test -p victory-metal stitch_of_n_pages_makes_about_n_vm_regions` - [ ] World `footprint` before/after — **blocked**: headless tip dies at `0xc000001d` image+0x55ff714 (~75 s, frame 0), same RVA as pre-fix attempt; never reaches world / `TRACE_MEMORY` span lines. ## How it was tested - Unit: mapped gapless title VA wraps (0 stitch pieces); fake VA still stitches; Stitch of N pages ≈ N VM regions. - Headless attempt: `run-native.sh --headless --seconds 420` with `VICTORY_METAL_TEXTURE_BUDGET_MB=4348` `VICTORY_TEXTURE_DROP_TOP_MIP=1` `VICTORY_TRACE_MEMORY=5` under `game.lock` — abort before world.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/640:upstream-pr/640'
git switch 'upstream-pr/640'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/640'
git switch 'upstream-pr/640'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/640'
git switch 'upstream-pr/640'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/640'
git switch 'main'
git merge --squash 'upstream-pr/640'
git switch 'main'
git merge --ff-only 'upstream-pr/640'
git switch 'main'
git merge 'upstream-pr/640'
git push origin 'main'
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
LakshanSivakumar/Native-Victory-macOS!640
No description provided.