Metal runs out of GPU memory on 16 GB Macs, then the game crashes #8

Open
opened 2026-11-26 07:35:22 +00:00 by LakshanSivakumar · 17 comments
LakshanSivakumar commented 2026-11-26 07:35:22 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T07:35:22Z.


Reported in #7 (M4 MacBook Air, 16 GB, macOS 27.2.1, commit 15433a9).

What happens

  • About 22 s into the run, Metal command buffers fail with Insufficient Memory (kIOGPUCommandBufferCallbackErrorOutOfMemory).
  • Just before that, 167 "a descriptor was not mirrored … is not in a mapped pool" lines appear, many of them for 10 to 30 MB resources.
  • About 8 s later, the game crashes with an access violation (0xc0000005) at image+0x55e56f8.
  • The game's own crash report sees about 13.5 GB total memory and about 10 MB free.

Likely cause
The game sizes its pools for the Xbox's memory budget. On a 16 GB Mac, with macOS and other apps also running, the GPU allocations don't fit. We haven't seen this on machines with more RAM.

Ideas

  • Cap or lazily back GPU pool allocations so the working set fits unified memory (check MTLDevice.recommendedMaxWorkingSetSize).
  • Report memory to the game in a way that makes it pick smaller budgets.
  • When a descriptor can't be mirrored, fail loudly, so the first symptom isn't a crash later on.

Start here: crates/victory-gpu/src/native/glue.rs (mirroring) and the native host's pool mapping.

Testers with 8, 16 and 24 GB Macs: a log from a run on current main helps a lot.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6621812441 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T07:35:22Z. --- Reported in #7 (M4 MacBook Air, 16 GB, macOS 27.2.1, commit 15433a9). **What happens** - About 22 s into the run, Metal command buffers fail with `Insufficient Memory (kIOGPUCommandBufferCallbackErrorOutOfMemory)`. - Just before that, 167 "a descriptor was not mirrored … is not in a mapped pool" lines appear, many of them for 10 to 30 MB resources. - About 8 s later, the game crashes with an access violation (0xc0000005) at `image+0x55e56f8`. - The game's own crash report sees about 13.5 GB total memory and about 10 MB free. **Likely cause** The game sizes its pools for the Xbox's memory budget. On a 16 GB Mac, with macOS and other apps also running, the GPU allocations don't fit. We haven't seen this on machines with more RAM. **Ideas** - Cap or lazily back GPU pool allocations so the working set fits unified memory (check `MTLDevice.recommendedMaxWorkingSetSize`). - Report memory to the game in a way that makes it pick smaller budgets. - When a descriptor can't be mirrored, fail loudly, so the first symptom isn't a crash later on. **Start here:** `crates/victory-gpu/src/native/glue.rs` (mirroring) and the native host's pool mapping. Testers with 8, 16 and 24 GB Macs: a log from a run on current `main` helps a lot.
claytonblythe commented 2026-11-26 08:57:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by claytonblythe on 2026-11-26T08:57:08Z.


Opened https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/12 to automatically default tools/macos/run-native.sh to --console series-s (7.6 GiB instead of Series X's 13.5 GiB) on Macs with <= 16 GB RAM, matching the 13.5 GB crash report figure here (with --console series-x available as an override).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7187223504 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7187223504). Originally posted by [claytonblythe](https://github.com/claytonblythe) on 2026-11-26T08:57:08Z. --- Opened https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/12 to automatically default `tools/macos/run-native.sh` to `--console series-s` (7.6 GiB instead of Series X's 13.5 GiB) on Macs with `<= 16 GB` RAM, matching the 13.5 GB crash report figure here (with `--console series-x` available as an override).
LakshanSivakumar commented 2026-11-26 10:53:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T10:53:08Z.


Status update: #12 has been merged to main, so tools/macos/run-native.sh now automatically defaults to --console series-s (7.6 GiB budget instead of Series X's 13.5 GiB) on Macs with <= 16 GB RAM.

Keeping this issue open until a 16 GB Mac tester confirms whether --console series-s avoids kIOGPUCommandBufferCallbackErrorOutOfMemory (and whether GPU pool capping / lazy backing is still needed).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7189967664 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7189967664). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T10:53:08Z. --- Status update: #12 has been merged to `main`, so `tools/macos/run-native.sh` now automatically defaults to `--console series-s` (7.6 GiB budget instead of Series X's 13.5 GiB) on Macs with `<= 16 GB` RAM. Keeping this issue open until a 16 GB Mac tester confirms whether `--console series-s` avoids `kIOGPUCommandBufferCallbackErrorOutOfMemory` (and whether GPU pool capping / lazy backing is still needed).
LakshanSivakumar commented 2026-11-26 13:28:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T13:28:37Z.


Update from two new 16 GB tester reports (#66 on M1 Pro, #68 on M4): both ran with --console series-s and got past the earlier 22 s menu OOM into prologue loading / intro audio (frames 1664–2048+), but both still hit 20 kIOGPUCommandBufferCallbackErrorOutOfMemory errors once prologue/world assets load.

So --console series-s helps get through setup/menus, and GPU pool capping / lazy backing is still needed for 16 GB Macs past that point.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7193403802 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7193403802). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T13:28:37Z. --- Update from two new 16 GB tester reports (#66 on M1 Pro, #68 on M4): both ran with `--console series-s` and got past the earlier 22 s menu OOM into prologue loading / intro audio (frames 1664–2048+), but **both still hit 20 `kIOGPUCommandBufferCallbackErrorOutOfMemory` errors** once prologue/world assets load. So `--console series-s` helps get through setup/menus, and GPU pool capping / lazy backing is still needed for 16 GB Macs past that point.
LakshanSivakumar commented 2026-11-26 15:56:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T15:56:49Z.


Status: 16 GB Macs on --console series-s get past the menus but still hit kIOGPUCommandBufferCallbackErrorOutOfMemory once prologue assets load (reports #7, #66, #68, now closed as duplicates of this). PR #76 (residency per encoder, #79) may reduce the pressure; GPU pool capping or lazy backing is still needed. Needed: #76 updated, then a retest on 16 GB.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7196966607 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7196966607). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T15:56:49Z. --- Status: 16 GB Macs on --console series-s get past the menus but still hit kIOGPUCommandBufferCallbackErrorOutOfMemory once prologue assets load (reports #7, #66, #68, now closed as duplicates of this). PR #76 (residency per encoder, #79) may reduce the pressure; GPU pool capping or lazy backing is still needed. Needed: #76 updated, then a retest on 16 GB.
LakshanSivakumar commented 2026-11-26 22:52:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T22:52:59Z.


Update: the heap residency set is on main (3009640b), and since 0133b82e released textures leave it. It's on by default on 32 GB and up. 16–24 GB testers: please try VICTORY_METAL_RESIDENCY_SETS=heap on current main and report the heap_set_mb lines and any command-buffer errors.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7205065930 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7205065930). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T22:52:59Z. --- Update: the heap residency set is on main (3009640b), and since 0133b82e released textures leave it. It's on by default on 32 GB and up. 16–24 GB testers: please try `VICTORY_METAL_RESIDENCY_SETS=heap` on current main and report the `heap_set_mb` lines and any command-buffer errors.
electrifie commented 2026-11-27 08:24:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by electrifie on 2026-11-27T08:24:20Z.


16 GB Series S run out of GPU memory at the first load after the menus: memory timeline and texture uploads

Setup: Mac mini M4, 16 GB, macOS 27.0.1. Metal Shader Converter 4.0.3. Commit 2a3b03d plus PR #260 (without #260 the window stays black on this commit). Series S (the 16 GB default), windowed, default residency (useResource per encoder). The log reports title_memory_mib=7776 recommended_working_set_mib=12124. Game files are on an external USB drive. Most other apps were closed.

What happens: boot movie, start screen and setup screens run at 18–30 fps. At the first load after them, frames stop and Metal fails command buffers with kIOGPUCommandBufferCallbackErrorOutOfMemory. The failing buffers are ordinary work (fills, a few compute dispatches, render passes of 9–10 draws); no one command stands out. There is no unhandled exception: the game sits on or near the stalled frame until the run is stopped.

Two runs:

Run Frames stop First OOM OOM errors Peak footprint Peak compressed Swap
150 s, plain frame 2886, ~120 s +124.9 s 10 14.3 GB 11.0 GB 1.9 → 3.8 GB
150 s, VICTORY_TRACE_TEXTURE_SYNC=1 VICTORY_TRACE_GPU_FAILS=1 frame ~1600, ~63 s +68.6 s 110 17.4 GB 14.3 GB 1.0 → 6.0 GB

The second run reached the load earlier, apparently because of a warm shader cache.

Memory over time (traced run). Footprint is top's MEM (Activity Monitor's Memory column), sampled every 2 s:

t Phase Game footprint System free Pressure
0–9 s boot 0.7 → 2.5 GB 83 → 59% normal
9–22 s boot wait (only clears plus the present pass) 2.5 → 3.4 GB ~58% normal
29–56 s movie and setup screens 5.8 → 6.7 GB 10–12% warn
59 s load starts 7.4 GB 10% warn
63 s frames stall at ~1600 8.9 GB 7% warn
68 s first OOM at 68.6 s 12.3 GB, 8.2 GB compressed 5% warn
73 s 14.3 GB 10% warn
106–148 s a frame every few seconds (1664 → 1764) 16.4 → 17.4 GB, 13–14 GB of it compressed swings from 2% to 76% 8 samples critical, the rest warn or normal

Host texture uploads, same run (texture sync in the last 1.0 s, summed):

Window New host textures MiB read and uploaded Footprint
0–42 s ~1,000 7.4 GB, almost all re-reads of ~150 textures (the movie's planes?) 0.7 → 5.9 GB
42–56 s +15,000, small (38 MiB) ~0.4 GB 5.9 → 6.7 GB
56–72 s (the load) +13,000 ~7 GB 6.7 → 14.3 GB
72–148 s +8,500 ~4 GB 14.3 → 17.4 GB

During the load the host makes about 13,000 new textures and uploads about 7 GB while the footprint grows about 7.6 GB. That fits host texture copies as the cause (the roadmap's suspect, #110).

Caveats:

  • The sync line does not split first uploads from re-reads, so 7 GB is an upper bound on new copies.
  • The footprint cannot separate title memory from host textures, so title memory growing at the same time is not ruled out.

A per-second count of live host texture bytes in the log would settle it. A sampler for footprint, pressure and swap per run (a small shell script next to run-native.sh) is available as a PR if useful.

Logs and memory.tsv from both runs are attached.

issue-8-attachments.zip

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7213501206 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7213501206). Originally posted by [electrifie](https://github.com/electrifie) on 2026-11-27T08:24:20Z. --- ### 16 GB Series S run out of GPU memory at the first load after the menus: memory timeline and texture uploads **Setup:** Mac mini M4, 16 GB, macOS 27.0.1. Metal Shader Converter 4.0.3. Commit `2a3b03d` plus PR #260 (without #260 the window stays black on this commit). Series S (the 16 GB default), windowed, default residency (`useResource per encoder`). The log reports `title_memory_mib=7776 recommended_working_set_mib=12124`. Game files are on an external USB drive. Most other apps were closed. **What happens:** boot movie, start screen and setup screens run at 18–30 fps. At the first load after them, frames stop and Metal fails command buffers with `kIOGPUCommandBufferCallbackErrorOutOfMemory`. The failing buffers are ordinary work (fills, a few compute dispatches, render passes of 9–10 draws); no one command stands out. There is no unhandled exception: the game sits on or near the stalled frame until the run is stopped. Two runs: | Run | Frames stop | First OOM | OOM errors | Peak footprint | Peak compressed | Swap | |---|---|---|---|---|---|---| | 150 s, plain | frame 2886, ~120 s | +124.9 s | 10 | 14.3 GB | 11.0 GB | 1.9 → 3.8 GB | | 150 s, `VICTORY_TRACE_TEXTURE_SYNC=1 VICTORY_TRACE_GPU_FAILS=1` | frame ~1600, ~63 s | +68.6 s | 110 | 17.4 GB | 14.3 GB | 1.0 → 6.0 GB | The second run reached the load earlier, apparently because of a warm shader cache. **Memory over time** (traced run). Footprint is top's MEM (Activity Monitor's Memory column), sampled every 2 s: | t | Phase | Game footprint | System free | Pressure | |---|---|---|---|---| | 0–9 s | boot | 0.7 → 2.5 GB | 83 → 59% | normal | | 9–22 s | boot wait (only clears plus the present pass) | 2.5 → 3.4 GB | ~58% | normal | | 29–56 s | movie and setup screens | 5.8 → 6.7 GB | 10–12% | warn | | 59 s | load starts | 7.4 GB | 10% | warn | | 63 s | frames stall at ~1600 | 8.9 GB | 7% | warn | | 68 s | first OOM at 68.6 s | 12.3 GB, 8.2 GB compressed | 5% | warn | | 73 s | | 14.3 GB | 10% | warn | | 106–148 s | a frame every few seconds (1664 → 1764) | 16.4 → 17.4 GB, 13–14 GB of it compressed | swings from 2% to 76% | 8 samples critical, the rest warn or normal | **Host texture uploads, same run** (`texture sync in the last 1.0 s`, summed): | Window | New host textures | MiB read and uploaded | Footprint | |---|---|---|---| | 0–42 s | ~1,000 | 7.4 GB, almost all re-reads of ~150 textures (the movie's planes?) | 0.7 → 5.9 GB | | 42–56 s | +15,000, small (38 MiB) | ~0.4 GB | 5.9 → 6.7 GB | | **56–72 s (the load)** | **+13,000** | **~7 GB** | **6.7 → 14.3 GB** | | 72–148 s | +8,500 | ~4 GB | 14.3 → 17.4 GB | During the load the host makes about 13,000 new textures and uploads about 7 GB while the footprint grows about 7.6 GB. That fits host texture copies as the cause (the roadmap's suspect, #110). Caveats: - The sync line does not split first uploads from re-reads, so 7 GB is an upper bound on new copies. - The footprint cannot separate title memory from host textures, so title memory growing at the same time is not ruled out. A per-second count of live host texture bytes in the log would settle it. A sampler for footprint, pressure and swap per run (a small shell script next to `run-native.sh`) is available as a PR if useful. Logs and `memory.tsv` from both runs are attached. [issue-8-attachments.zip](https://github.com/user-attachments/files/35502826/issue-8-attachments.zip)
m0rff commented 2026-11-27 09:41:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by m0rff on 2026-11-27T09:41:45Z.


A byte budget on host texture copies is up as draft PR #301 (issue #294). It follows on from @electrifie's run above, where the host made ~13,000 texture copies during the first load while the footprint grew ~7.6 GB. The budget is Metal's recommended working set less the title's memory: 12124 − 7776 = 4348 MiB on that M4 with Series S, never less than 1536 MiB. Past the budget, it gives up the least recently used copies that nothing uses: no heap entry shows them, no recorded or submitted work holds them, and they aren't render targets or GPU-written. It does not touch what the heap residency sets hold, so it can be combined with VICTORY_METAL_RESIDENCY_SETS=heap.

It may free little. #79 suggests most texture bytes are shown by heap entries, and those are never given up. The new trace line answers that from a 16 GB run, which is why I'm asking.

16 GB and 24 GB testers (@electrifie, and anyone from #79 or #110 with an 18 or 24 GB Mac), a run would help:

git fetch https://github.com/LakshanSivakumar/Native-Victory-macOS pull/301/head:pr-301 && git checkout pr-301
tools/macos/native-setup.sh
VICTORY_TRACE_TEXTURE_SYNC=1 tools/macos/run-native.sh <game folder>

Then please post:

  • git rev-parse --short HEAD, the Mac and its memory, and the console profile;
  • the native host: Metal line (it now has texture_budget_mib=);
  • grep "host texture copies:" runs/<date>/victory.log, especially the lines around the first load after the menus. Each line gives the MiB of copies, the budget, how much heap entries show, how much could be given up, how much was given up and how many came back;
  • how many kIOGPUCommandBufferCallbackErrorOutOfMemory lines there are, and the frame where frames stop, compared with your last run on main.

If you have time, a second run with VICTORY_METAL_TEXTURE_BUDGET_MB=0 (no budget, otherwise the same) gives a clean comparison. On 24 GB, a run with VICTORY_METAL_RESIDENCY_SETS=heap added shows the two together.

If the copies turn out to be mostly "shown by heap entries", this PR won't be enough on its own. That would point at the levers in #79 (one copy instead of two, fewer top mips).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7214984860 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7214984860). Originally posted by [m0rff](https://github.com/m0rff) on 2026-11-27T09:41:45Z. --- A byte budget on host texture copies is up as draft PR #301 (issue #294). It follows on from @electrifie's run above, where the host made ~13,000 texture copies during the first load while the footprint grew ~7.6 GB. The budget is Metal's recommended working set less the title's memory: 12124 − 7776 = **4348 MiB** on that M4 with Series S, never less than 1536 MiB. Past the budget, it gives up the least recently used copies that nothing uses: no heap entry shows them, no recorded or submitted work holds them, and they aren't render targets or GPU-written. It does not touch what the heap residency sets hold, so it can be combined with `VICTORY_METAL_RESIDENCY_SETS=heap`. **It may free little.** #79 suggests most texture bytes are shown by heap entries, and those are never given up. The new trace line answers that from a 16 GB run, which is why I'm asking. 16 GB and 24 GB testers (@electrifie, and anyone from #79 or #110 with an 18 or 24 GB Mac), a run would help: ```bash git fetch https://github.com/LakshanSivakumar/Native-Victory-macOS pull/301/head:pr-301 && git checkout pr-301 tools/macos/native-setup.sh VICTORY_TRACE_TEXTURE_SYNC=1 tools/macos/run-native.sh <game folder> ``` Then please post: - `git rev-parse --short HEAD`, the Mac and its memory, and the console profile; - the `native host: Metal` line (it now has `texture_budget_mib=`); - `grep "host texture copies:" runs/<date>/victory.log`, especially the lines around the first load after the menus. Each line gives the MiB of copies, the budget, how much heap entries show, how much could be given up, how much was given up and how many came back; - how many `kIOGPUCommandBufferCallbackErrorOutOfMemory` lines there are, and the frame where frames stop, compared with your last run on main. If you have time, a second run with `VICTORY_METAL_TEXTURE_BUDGET_MB=0` (no budget, otherwise the same) gives a clean comparison. On 24 GB, a run with `VICTORY_METAL_RESIDENCY_SETS=heap` added shows the two together. If the copies turn out to be mostly "shown by heap entries", this PR won't be enough on its own. That would point at the levers in #79 (one copy instead of two, fewer top mips).
daidalos4 commented 2026-11-27 11:12:42 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by daidalos4 on 2026-11-27T11:12:42Z.


VICTORY_METAL_RESIDENCY_SETS=heap on a 16 GB Mac, as asked above.

Setup: MacBook Pro M1 (MacBookPro17,1), 16 GB, macOS 27.0.1, --console series-s, main at c1b95875 plus the read cache from #101. Startup line: title_memory_mib=7776 recommended_working_set_mib=12124.

heap_set_mb over the run (story load after the engagement screen, Enter via VICTORY_KEYS):

time frame heap_set_mb
+0:28 64 1675
+1:43 2240 1772
+3:24 5184 3461
+3:33 5248 9291
+4:19 6208 9344
+6:34 9984 9694
+7:07 10432 10649

The set jumps by ~5.8 GB in 9 seconds around frame 5200, then creeps up. The first kIOGPUCommandBufferCallbackErrorOutOfMemory comes at +7:28, at 10651 MB, with 19 failed command buffers in the next 90 s. The loading-screen art draws correctly until then.

The same load without the flag (default per-encoder residency) also hit OutOfMemory about 15 min in, then an access violation in the title at image+0x55e56f8.

Happy to rerun with #301 or any other switch.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7216810263 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7216810263). Originally posted by [daidalos4](https://github.com/daidalos4) on 2026-11-27T11:12:42Z. --- `VICTORY_METAL_RESIDENCY_SETS=heap` on a 16 GB Mac, as asked above. **Setup:** MacBook Pro M1 (MacBookPro17,1), 16 GB, macOS 27.0.1, `--console series-s`, main at `c1b95875` plus the read cache from #101. Startup line: `title_memory_mib=7776 recommended_working_set_mib=12124`. **`heap_set_mb` over the run** (story load after the engagement screen, Enter via `VICTORY_KEYS`): | time | frame | heap_set_mb | |---|---|---| | +0:28 | 64 | 1675 | | +1:43 | 2240 | 1772 | | +3:24 | 5184 | 3461 | | +3:33 | 5248 | **9291** | | +4:19 | 6208 | 9344 | | +6:34 | 9984 | 9694 | | +7:07 | 10432 | 10649 | The set jumps by ~5.8 GB in 9 seconds around frame 5200, then creeps up. The first `kIOGPUCommandBufferCallbackErrorOutOfMemory` comes at +7:28, at 10651 MB, with 19 failed command buffers in the next 90 s. The loading-screen art draws correctly until then. The same load without the flag (default per-encoder residency) also hit `OutOfMemory` about 15 min in, then an access violation in the title at `image+0x55e56f8`. Happy to rerun with #301 or any other switch.
ItsMariusBC commented 2026-11-27 11:42:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by ItsMariusBC on 2026-11-27T11:42:40Z.


The 24 GB data point asked for above: VICTORY_METAL_RESIDENCY_SETS=heap against the default, on current main.

Apple M5 Pro, 24 GB, macOS 27.2.1, main c1b9587, Series S, windowed, game files on an external USB disk. The log says title_memory_mib=7776 recommended_working_set_mib=18186. Both runs had a warm shader cache (shaders_cached=21566 shaders_translated=0, prewarm done in 18 to 19 s).

Default (useResource per encoder) heap (a set per heap)
Other switches none VICTORY_HOLD_BYTE=1471b6330:1
30 fps until frame 1408, +51.5 s frame 1728, +62.7 s
Slow stretch before the world frames 1920 to 1984: 185 s frames 1984 to 2048: 127 s
First world frame, first binds from +301 s, 20 s long (see the note) from +266 s, 86 s long
Next frame's first binds 0.1 s later 97 s later
work held for a wait that does not hold 80 lines, median 10.8 s, longest 58.6 s 33 lines, median 17.9 s, longest 92.9 s
GPU errors none none
Ended watchdog at +380 s the 480 s timer, at frame 2079

heap_set_mb in the heap run: 1,675 at frames 64 to 512, 9,339 at frame 1024, 9,400 at frame 1536, 15,644 at frame 1984, 16,960 at frame 2048. That is the last counter line of the run, 53 s before the world frame starts.

What the system did during the heap run (memory_pressure, read every 15 s): the free percentage went down to 0 %, and the swap file grew from 8 to 10 GB. It was at 64 % a minute after the run.

So on 24 GB the set reaches 17 GB of an 18.2 GB recommended working set before the world, no command buffer fails, and the world frames take a minute and a half each.

The slow stretch before the world is there in both modes, and it is not shader work or disk: no translation in either run, under 6 s of Metal compiles in it, and DirectStorage reads under 5 MB/s for most of it. The log lines of that stretch are the fence waits above and the title activating its spatial audio stream again.

Sound: the audio output fell back to silence (AudioQueueStart failed with OSStatus 2003329396) on 4 of 14 stream activations in the default run and 6 of 32 in the heap run, the first at +188 s and +207 s.

On screen, both runs: the loading artwork shows, smooth at first and then very slow, and the world is black.

Note on the default run: I was compiling on six cores during its last 85 s, from about +295 s on, so its world frame and its watchdog do not count. Everything before that does.

The heap run's binary also carried a local change to victory translate --cache, which a run does not execute.

I can attach both logs, or run again with other switches.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7217386312 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7217386312). Originally posted by [ItsMariusBC](https://github.com/ItsMariusBC) on 2026-11-27T11:42:40Z. --- The 24 GB data point asked for above: `VICTORY_METAL_RESIDENCY_SETS=heap` against the default, on current main. Apple M5 Pro, 24 GB, macOS 27.2.1, main `c1b9587`, Series S, windowed, game files on an external USB disk. The log says `title_memory_mib=7776 recommended_working_set_mib=18186`. Both runs had a warm shader cache (`shaders_cached=21566 shaders_translated=0`, prewarm done in 18 to 19 s). | | Default (`useResource per encoder`) | `heap` (`a set per heap`) | | --- | --- | --- | | Other switches | none | `VICTORY_HOLD_BYTE=1471b6330:1` | | 30 fps until | frame 1408, +51.5 s | frame 1728, +62.7 s | | Slow stretch before the world | frames 1920 to 1984: 185 s | frames 1984 to 2048: 127 s | | First world frame, first binds | from +301 s, 20 s long (see the note) | from +266 s, 86 s long | | Next frame's first binds | 0.1 s later | 97 s later | | `work held for a wait that does not hold` | 80 lines, median 10.8 s, longest 58.6 s | 33 lines, median 17.9 s, longest 92.9 s | | GPU errors | none | none | | Ended | watchdog at +380 s | the 480 s timer, at frame 2079 | `heap_set_mb` in the heap run: 1,675 at frames 64 to 512, 9,339 at frame 1024, 9,400 at frame 1536, 15,644 at frame 1984, 16,960 at frame 2048. That is the last counter line of the run, 53 s before the world frame starts. What the system did during the heap run (`memory_pressure`, read every 15 s): the free percentage went down to 0 %, and the swap file grew from 8 to 10 GB. It was at 64 % a minute after the run. So on 24 GB the set reaches 17 GB of an 18.2 GB recommended working set before the world, no command buffer fails, and the world frames take a minute and a half each. The slow stretch before the world is there in both modes, and it is not shader work or disk: no translation in either run, under 6 s of Metal compiles in it, and DirectStorage reads under 5 MB/s for most of it. The log lines of that stretch are the fence waits above and the title activating its spatial audio stream again. Sound: the audio output fell back to silence (`AudioQueueStart failed with OSStatus 2003329396`) on 4 of 14 stream activations in the default run and 6 of 32 in the heap run, the first at +188 s and +207 s. On screen, both runs: the loading artwork shows, smooth at first and then very slow, and the world is black. Note on the default run: I was compiling on six cores during its last 85 s, from about +295 s on, so its world frame and its watchdog do not count. Everything before that does. The heap run's binary also carried a local change to `victory translate --cache`, which a run does not execute. I can attach both logs, or run again with other switches.
LakshanSivakumar commented 2026-11-27 11:54:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T11:54:22Z.


Thank you, the table is what I needed. The set jumps by about 5.8 GB in 9 seconds around frame 5200, and the first failed command buffer comes at 10,651 MB. That tells me the jump is one event, not a slow leak.

Your later run on #301 (a texture budget, no OutOfMemory for 22 minutes) is the first sign that a byte budget helps on 16 GB. I have not run it myself.

One question: at frames 5184 and 5248, what was the game doing (which screen)? If you still have the log lines between those two frames, please paste only the lines with heap or residency in them, with your user name removed.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7217610942 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7217610942). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T11:54:22Z. --- Thank you, the table is what I needed. The set jumps by about 5.8 GB in 9 seconds around frame 5200, and the first failed command buffer comes at 10,651 MB. That tells me the jump is one event, not a slow leak. Your later run on #301 (a texture budget, no `OutOfMemory` for 22 minutes) is the first sign that a byte budget helps on 16 GB. I have not run it myself. One question: at frames 5184 and 5248, what was the game doing (which screen)? If you still have the log lines between those two frames, please paste only the lines with `heap` or `residency` in them, with your user name removed.
LakshanSivakumar commented 2026-11-27 11:54:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T11:54:24Z.


Thank you. This is a clear table. It says that on 24 GB the residency set is not the limit by itself: both modes reach the world with no GPU error, and the machine runs out of free memory first (free memory at 0%, swap 8 to 10 GB).

I do not need the full logs. If you can, please run once more with VICTORY_TRACE_TEXTURE_SYNC=1 and post the host texture copies lines for the first 100 seconds after the world load (your #301 comment has the same numbers, so only if the head has changed). The slow stretch of 127 to 185 s before the world is the thing I want to understand next; please say what the log shows in it (fence waits, which queue).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7217611389 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7217611389). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T11:54:24Z. --- Thank you. This is a clear table. It says that on 24 GB the residency set is not the limit by itself: both modes reach the world with no GPU error, and the machine runs out of free memory first (free memory at 0%, swap 8 to 10 GB). I do not need the full logs. If you can, please run once more with `VICTORY_TRACE_TEXTURE_SYNC=1` and post the `host texture copies` lines for the first 100 seconds after the world load (your #301 comment has the same numbers, so only if the head has changed). The slow stretch of 127 to 185 s before the world is the thing I want to understand next; please say what the log shows in it (fence waits, which queue).
froziiik commented 2026-11-27 17:50:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by froziiik on 2026-11-27T17:50:40Z.


/claim — evicting covered placed textures across VA aliases and retired GPU epochs under a texture budget, and trimming unmapped leading fine mips on partial textures

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7224846231 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7224846231). Originally posted by [froziiik](https://github.com/froziiik) on 2026-11-27T17:50:40Z. --- /claim — evicting covered placed textures across VA aliases and retired GPU epochs under a texture budget, and trimming unmapped leading fine mips on partial textures
github-actions[bot] commented 2026-11-27 17:50:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T17:50:50Z.


Claimed by @froziiik. Open a draft pull request with Refs #8 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7224849121 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7224849121). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T17:50:50Z. --- Claimed by @froziiik. Open a draft pull request with `Refs #8` in its description within 24 hours, or the claim expires.
ItsMariusBC commented 2026-11-27 18:12:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by ItsMariusBC on 2026-11-27T18:12:18Z.


An answer to the slow stretch, later than I meant to: on this 24 GB Mac it is gone with VICTORY_TEXTURE_DROP_TOP_MIP=1, and with the heap sets on top the world runs six to seven times faster than in the default mode, for the same free memory.

Apple M5 Pro, 24 GB, macOS 27.2.1, main 4cf84c83 with #327 merged (kept shader containers, not on this path), Series S, windowed, warm shader cache, VICTORY_HOLD_BYTE=1471b6330:1, --seconds 480, nothing building alongside. One run per column.

DROP_TOP_MIP=1, default residency DROP_TOP_MIP=1 + RESIDENCY_SETS=heap the same, again
First world frame's first binds +79 s +78 s +78 s
World frames in the run 30 169 (to +404 s) 203
Frame rate in the world (run-summary.sh) 0.3 fps 0.5 to 0.6 0.5 to 0.8
heap_set_mb, highest 0 13,421 13,443
Free memory at its lowest (memory_pressure, every 15 s) 7 % 7 % 7 %
GPU errors, command buffers never reported on none none none
Ended the timer title fault at +404 s the timer

This morning, without the switch, the world's first binds came at +229 to +301 s after a stretch of 127 to 185 s at 0.4 fps, free memory went to 0 % and command buffers were lost. So the stretch was the Mac running out of memory, and the mip drop removes it in both residency modes.

What the default mode's world frames are made of. Three more runs on the same build, default residency, with the mip drop:

  • VICTORY_TRACE_RESIDENCY=1, VICTORY_PROFILE=30, VICTORY_TRACE_TEXTURE_SYNC=1: cb_commit 0 ms and no "residency: slow call" in the whole run; texture sync tens to hundreds of ms a second; 310 "work held for a wait that does not hold" lines in the world, median 8.8 s, longest 17.2 s. I did not tally which queue.
  • VICTORY_TRACE_COMMITS=1: in the world the GPU is busy 315 s of about 325; 91 command buffers of more than 1 s make 222 s of it, each of 47 to 119 passes.
  • The same with VICTORY_PASSES_PER_BUFFER=1: 10,964 passes in the world, 179 s of gpu_ms, and none over 163 ms. The longest ones, whatever their shaders, all sit between 145 and 163 ms.

That flat ceiling is what made me try the heap sets again: it is close to the per-pass cost I remember docs/native-host.md giving for useResource per encoder. My parse of that trace lost the content of most passes, so I cannot say which ones they are.

The fault in the first heap run. Three first-chance 0xc0000005 at image+0x5149aec within 1 ms, then the reporter's image+0x55e56f8, at frame 2145. Not the watchdog's 0x23cf683, which the held byte still covers. It did not come back in the second run, which went further (frame 2209).

On screen in the heap runs: a real picture, too dark as on main, with many more textures showing than at 0.3 fps.

So for 24 GB Macs both switches together look like the better default. I can run other combinations.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7225239563 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7225239563). Originally posted by [ItsMariusBC](https://github.com/ItsMariusBC) on 2026-11-27T18:12:18Z. --- An answer to the slow stretch, later than I meant to: on this 24 GB Mac it is gone with `VICTORY_TEXTURE_DROP_TOP_MIP=1`, and with the heap sets on top the world runs six to seven times faster than in the default mode, for the same free memory. Apple M5 Pro, 24 GB, macOS 27.2.1, main `4cf84c83` with #327 merged (kept shader containers, not on this path), Series S, windowed, warm shader cache, `VICTORY_HOLD_BYTE=1471b6330:1`, `--seconds 480`, nothing building alongside. One run per column. | | `DROP_TOP_MIP=1`, default residency | `DROP_TOP_MIP=1` + `RESIDENCY_SETS=heap` | the same, again | | --- | --- | --- | --- | | First world frame's first binds | +79 s | +78 s | +78 s | | World frames in the run | 30 | 169 (to +404 s) | 203 | | Frame rate in the world (`run-summary.sh`) | 0.3 fps | 0.5 to 0.6 | 0.5 to 0.8 | | `heap_set_mb`, highest | 0 | 13,421 | 13,443 | | Free memory at its lowest (`memory_pressure`, every 15 s) | 7 % | 7 % | 7 % | | GPU errors, command buffers never reported on | none | none | none | | Ended | the timer | title fault at +404 s | the timer | This morning, without the switch, the world's first binds came at +229 to +301 s after a stretch of 127 to 185 s at 0.4 fps, free memory went to 0 % and command buffers were lost. So the stretch was the Mac running out of memory, and the mip drop removes it in both residency modes. **What the default mode's world frames are made of.** Three more runs on the same build, default residency, with the mip drop: - `VICTORY_TRACE_RESIDENCY=1`, `VICTORY_PROFILE=30`, `VICTORY_TRACE_TEXTURE_SYNC=1`: `cb_commit` 0 ms and no "residency: slow call" in the whole run; texture sync tens to hundreds of ms a second; 310 "work held for a wait that does not hold" lines in the world, median 8.8 s, longest 17.2 s. I did not tally which queue. - `VICTORY_TRACE_COMMITS=1`: in the world the GPU is busy 315 s of about 325; 91 command buffers of more than 1 s make 222 s of it, each of 47 to 119 passes. - The same with `VICTORY_PASSES_PER_BUFFER=1`: 10,964 passes in the world, 179 s of `gpu_ms`, and none over 163 ms. The longest ones, whatever their shaders, all sit between 145 and 163 ms. That flat ceiling is what made me try the heap sets again: it is close to the per-pass cost I remember docs/native-host.md giving for `useResource` per encoder. My parse of that trace lost the content of most passes, so I cannot say which ones they are. **The fault in the first heap run.** Three first-chance `0xc0000005` at `image+0x5149aec` within 1 ms, then the reporter's `image+0x55e56f8`, at frame 2145. Not the watchdog's `0x23cf683`, which the held byte still covers. It did not come back in the second run, which went further (frame 2209). On screen in the heap runs: a real picture, too dark as on main, with many more textures showing than at 0.3 fps. So for 24 GB Macs both switches together look like the better default. I can run other combinations.
alicans commented 2026-11-27 19:17:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by alicans on 2026-11-27T19:17:43Z.


The same on a 24 GB M4 Pro (macOS 15.8.2): with VICTORY_TEXTURE_DROP_TOP_MIP=1 and VICTORY_METAL_RESIDENCY_SETS=heap, my runs get into the world and stay there.

My setup: main 582670f1 with two local changes (a title-watchdog patch and a UAV view level fix). Series S, windowed. VICTORY_HOLD_BYTE=1471b6330:1, VICTORY_DEPTH_TWINS=0. Runs of 300 s, stopped by my script if the memory level (kern.memorystatus_level, read 4 times a second) drops below 10 %.

NV42 (pipelines not yet built) NV44 (same, built)
First world frames +92 s +99 s
Lowest memory level 12 % 12 %
Peak RSS 10 GB 9 GB
heap_set_mb, highest 13,288 12,743
Host texture copies, highest 10,533 MiB (2,851 distinct) 10,193 MiB (2,823 distinct)
World frame rate 0.2 fps (24,432 of 55,024 draws without a pipeline) 3 to 4.5 fps for the first ~130 frames, then 0.15 fps
GPU errors none none
Ended the timer the timer

In NV44 the drop came at frame 1893 (+166 s). There were 1,739 first binds in that frame, and the host copies grew from about 3.6 GB to 10 GB. The 19 frames after it took 131 s.

Without the two switches (NV40, NV41, main 4cf84c83 with #359 and 582670f1), both runs hit my memory limit at 75 to 84 s, before the world.

A third run with the same build and switches (NV43) ended at image+0x4dac5bf at +73 s, before the world (#339).

In your heap runs, did the frame rate also drop when the host copies grew?

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7226384192 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7226384192). Originally posted by [alicans](https://github.com/alicans) on 2026-11-27T19:17:43Z. --- The same on a 24 GB M4 Pro (macOS 15.8.2): with `VICTORY_TEXTURE_DROP_TOP_MIP=1` and `VICTORY_METAL_RESIDENCY_SETS=heap`, my runs get into the world and stay there. My setup: main `582670f1` with two local changes (a title-watchdog patch and a UAV view level fix). Series S, windowed. `VICTORY_HOLD_BYTE=1471b6330:1`, `VICTORY_DEPTH_TWINS=0`. Runs of 300 s, stopped by my script if the memory level (`kern.memorystatus_level`, read 4 times a second) drops below 10 %. | | NV42 (pipelines not yet built) | NV44 (same, built) | | --- | --- | --- | | First world frames | +92 s | +99 s | | Lowest memory level | 12 % | 12 % | | Peak RSS | 10 GB | 9 GB | | `heap_set_mb`, highest | 13,288 | 12,743 | | Host texture copies, highest | 10,533 MiB (2,851 distinct) | 10,193 MiB (2,823 distinct) | | World frame rate | 0.2 fps (24,432 of 55,024 draws without a pipeline) | 3 to 4.5 fps for the first ~130 frames, then 0.15 fps | | GPU errors | none | none | | Ended | the timer | the timer | In NV44 the drop came at frame 1893 (+166 s). There were 1,739 first binds in that frame, and the host copies grew from about 3.6 GB to 10 GB. The 19 frames after it took 131 s. Without the two switches (NV40, NV41, main `4cf84c83` with #359 and `582670f1`), both runs hit my memory limit at 75 to 84 s, before the world. A third run with the same build and switches (NV43) ended at `image+0x4dac5bf` at +73 s, before the world (#339). In your heap runs, did the frame rate also drop when the host copies grew?
ItsMariusBC commented 2026-11-27 19:29:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by ItsMariusBC on 2026-11-27T19:29:53Z.


A correction to my comment above, and a warning for anyone on 24 GB (@alicans): I wrote that VICTORY_TEXTURE_DROP_TOP_MIP=1 with VICTORY_METAL_RESIDENCY_SETS=heap looked like the better default. On this Mac the fourth run with that pair took the whole login session down. I withdraw the recommendation.

Same Mac (Apple M5 Pro, 24 GB, macOS 27.2.1), main b998bb65 with #327 merged, Series S, windowed, warm shader cache, VICTORY_HOLD_BYTE=1471b6330:1, the two switches, --seconds 480. Two runs, an hour apart:

Run 3 Run 4
World frames 514 (about 1.5 fps) to frame 2403, then stopped
heap_set_mb, highest 13,515 13,745
GPU errors (run-summary.sh) Hang 2, Other 23, all at +172.5 s; the run recovered and went the full 480 s OutOfMemory 1, Timeout 4, Other 5, at +218 s
Free memory at its lowest 6 % not sampled (my sampler went down with the session)
Ended the timer stopped the GPU's work; exiting in_flight=4 left=4 at +249.6 s

In run 4, macOS's watchdog killed WindowServer at +246 s: WindowServer-…ips with "indicator":"monitoring timed out for service", "namespace":"WATCHDOG", a userspace_watchdog_timeout.spin beside it, and a gpuEvent report 11 s later. Every open application went with it. The Mac did not reboot.

So the GPU stall of run 3 was the warning, and I should have read it as one. The two earlier runs with the same pair (main 4cf84c83) had no GPU error at all, so I cannot say whether the difference is the newer main, the higher frame rate, or chance.

The default residency with the mip drop has run several times here with no GPU error, at 0.3 fps. That is what I am back on.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7226585573 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7226585573). Originally posted by [ItsMariusBC](https://github.com/ItsMariusBC) on 2026-11-27T19:29:53Z. --- A correction to my comment above, and a warning for anyone on 24 GB (@alicans): I wrote that `VICTORY_TEXTURE_DROP_TOP_MIP=1` with `VICTORY_METAL_RESIDENCY_SETS=heap` looked like the better default. On this Mac the fourth run with that pair took the whole login session down. I withdraw the recommendation. Same Mac (Apple M5 Pro, 24 GB, macOS 27.2.1), main `b998bb65` with #327 merged, Series S, windowed, warm shader cache, `VICTORY_HOLD_BYTE=1471b6330:1`, the two switches, `--seconds 480`. Two runs, an hour apart: | | Run 3 | Run 4 | | --- | --- | --- | | World frames | 514 (about 1.5 fps) | to frame 2403, then stopped | | `heap_set_mb`, highest | 13,515 | 13,745 | | GPU errors (`run-summary.sh`) | Hang 2, Other 23, all at +172.5 s; the run recovered and went the full 480 s | OutOfMemory 1, Timeout 4, Other 5, at +218 s | | Free memory at its lowest | 6 % | not sampled (my sampler went down with the session) | | Ended | the timer | `stopped the GPU's work; exiting in_flight=4 left=4` at +249.6 s | In run 4, macOS's watchdog killed WindowServer at +246 s: `WindowServer-…ips` with `"indicator":"monitoring timed out for service"`, `"namespace":"WATCHDOG"`, a `userspace_watchdog_timeout.spin` beside it, and a `gpuEvent` report 11 s later. Every open application went with it. The Mac did not reboot. So the GPU stall of run 3 was the warning, and I should have read it as one. The two earlier runs with the same pair (main `4cf84c83`) had no GPU error at all, so I cannot say whether the difference is the newer main, the higher frame rate, or chance. The default residency with the mip drop has run several times here with no GPU error, at 0.3 fps. That is what I am back on.
5ame-24 commented 2026-11-28 02:21:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by 5ame-24 on 2026-11-28T02:21:49Z.


Setup: MacBook Pro M1 Max, 32 GB, macOS 26.6.2, Metal Shader Converter 4.0.3, main at 226645f9, arm64 test build. No game files: a synthetic soak on the test rig, not a game run.

A small leak that may add to the memory growth here, found without the game.

The submission path leaves Metal objects behind. The game's threads have no autorelease pool (only the pipeline-compile threads and the window loop have one), and Metal hands back autoreleased command buffers and encoders, so each submit_passes leaves a few objects alive until the thread exits.

How I saw it: a synthetic soak on the state_tests.rs rig (a fresh list of 40 draws under four pipelines, execute, wait on a fence, repeat). Frame time stays flat at about 1 ms, but process memory climbs about 1.9 KB per submission, from 79 MB to 131 MB over 30,000 frames. It still grows with no draws and no textures. It stays flat (27 MB for 12,000 frames) when each frame runs inside an autorelease pool.

Fix I tried: run the body of submit_passes in crates/victory-metal/src/gfx.rs inside objc2::rc::autoreleasepool(|_| { ... }). With it, memory is flat at 73 MB over 12,000 frames. Without it, the soak grows 13 MB in 10,000 frames. The victory-gpu and victory-metal suites pass on arm64 with MSC 4.0.3.

What I have not shown: how many submissions the title makes per frame, or whether leaked command buffers keep large resources alive (that would be far worse than 2 KB each). The 16 GB failure here is gigabytes, so this is at most a contributor. footprint_mb is already in the native draws so far line, so a long run's log would show a steady climb if it matters.

Happy to share the soak test and the patch in whatever form suits.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7232311657 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/8#issuecomment-7232311657). Originally posted by [5ame-24](https://github.com/5ame-24) on 2026-11-28T02:21:49Z. --- **Setup:** MacBook Pro M1 Max, 32 GB, macOS 26.6.2, Metal Shader Converter 4.0.3, `main` at `226645f9`, arm64 test build. No game files: a synthetic soak on the test rig, not a game run. A small leak that may add to the memory growth here, found without the game. The submission path leaves Metal objects behind. The game's threads have no autorelease pool (only the pipeline-compile threads and the window loop have one), and Metal hands back autoreleased command buffers and encoders, so each `submit_passes` leaves a few objects alive until the thread exits. How I saw it: a synthetic soak on the `state_tests.rs` rig (a fresh list of 40 draws under four pipelines, execute, wait on a fence, repeat). Frame time stays flat at about 1 ms, but process memory climbs about 1.9 KB per submission, from 79 MB to 131 MB over 30,000 frames. It still grows with no draws and no textures. It stays flat (27 MB for 12,000 frames) when each frame runs inside an autorelease pool. Fix I tried: run the body of `submit_passes` in `crates/victory-metal/src/gfx.rs` inside `objc2::rc::autoreleasepool(|_| { ... })`. With it, memory is flat at 73 MB over 12,000 frames. Without it, the soak grows 13 MB in 10,000 frames. The `victory-gpu` and `victory-metal` suites pass on arm64 with MSC 4.0.3. What I have not shown: how many submissions the title makes per frame, or whether leaked command buffers keep large resources alive (that would be far worse than 2 KB each). The 16 GB failure here is gigabytes, so this is at most a contributor. `footprint_mb` is already in the `native draws so far` line, so a long run's log would show a steady climb if it matters. Happy to share the soak test and the patch in whatever form suits.
Sign in to join this conversation.
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#8
No description provided.