Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Mario Kart World maps no memory past its application pool (mem_map_li…
…mit on): in free roam the game frees its own blocks, and its footprint stays near 4 GB with DM_GUEST_FILE

Free roam streams the world, and the memory kept growing: on a 16 GB M1 Pro, handheld, a
scripted drive into new areas took the footprint from 7.8 to 9.4 GB in 12 minutes (the game's
charged memory 3.9 to 5.3 GB, 4.5 GB compressed, swap growing). Most of it was the game's own
memory, which the host cannot give back without knowing what the game still needs.

With mem_map_limit on, MapPhysicalMemory past the 9 GB pool fails as on Horizon, and the
game's streaming frees its own blocks: its alias region peaked at 1.5 GB mapped where it had
3.0 GB, as issue #1536 found on an 8 GB Mac. With DM_GUEST_FILE=1 as well, the footprint
stayed at 3.8 to 4.4 GB over 13 to 17 minutes, compressed memory under 0.6 GB, swap flat,
wired unchanged. The cost is more long frames: a 20-minute played windowed run (Grand Prix and
free roam) had 1.35 long frames a second (21 over 100 ms) against 0.65-0.73 without the files. Measured on
a branch that also had pull requests #1179, #1229, #1230, #1251 and #1350.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • Loading branch information
seedds and claude committed Nov 6, 2026
commit 3e8f2e9d77f90bbbcde18ddcbcd7801d12f9644b
7 changes: 7 additions & 0 deletions dm/games/0400C3F00006E000/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ A Switch 2 game. Brought up on the base game (v0), SDK 19.3.3 built for the Swit
| `sys_resource 0x4000000` | [`game.tsv`](game.tsv) | the NPDM declares 64 MB of system resource: virtual address memory on, and `nninitStartup` still sets a heap |
| `app_pool 0x240000000`, `mem_reserve 0x320000000`, `mem_alias 0x100000000` | `game.tsv` | the Switch 2's 9 GB, as Donkey Kong Bananza's. `SetHeapSize` asks for 0x1dbc00000 (7.43 GB; 1.8.0 asks 0x1de400000 by pull request #1116), and with a 7.5 GB heap region the first boot stopped there (`SetHeapSize OOM`): an 8 GB heap region. The alias region is mapped up to +1.75 GB by the title |
| `modules main subsdk0 subsdk1 sdk` | `game.tsv` | the base game has no `subsdk1`; each build row names its own modules ([A version without one of the profile's modules](../../../docs/reference/packing.md#a-version-without-one-of-the-profiles-modules-stops-the-host-at-boot)) |
| `mem_map_limit on` | `game.tsv` | `MapPhysicalMemory` past the 9 GB pool fails as on Horizon, so the game frees its own blocks when it streams in free roam instead of mapping more ([Memory in free roam](#memory-in-free-roam)) |
| `render_cond on` | `game.tsv` | agl wraps its clears in render conditions, as in Donkey Kong Bananza and Splatoon Raiders; not tried without it here |
| `romfs_marker Movie/StaffRoll_00.webm` | `game.tsv` | a file of both versions' RomFS |

Expand Down Expand Up @@ -60,6 +61,12 @@ On a 16 GB M1 Pro (2026-11-04) the same race kept its frame median at 25 to 28 m

On the 16 GB M6 (2026-11-04, a host on the older chain `475a55e74858`, the Mac also swapping for another session's game for part of the run), the first race with those shared tiles: 4 heaps (1,024 MB) where the run above had 12 (3,072 MB), resident memory 11.3 GB where it had 12.8 GB, the frame median 16.7 ms and the 95th percentile 17 to 20 ms over 2,400 frames, no out-of-memory line. The run was minutes long, so it does not show that [issue #1193](https://github.com/seedds/nxnative/issues/1193)'s crash after 16 minutes is gone.

## Memory in free roam

Free roam streams the world as the kart drives on, and without `mem_map_limit` memory kept growing: on a 16 GB M1 Pro (2026-11-06, handheld, headless, a scripted drive into new areas, `DM_MEMSTAT`), the footprint went from 7.8 to 9.4 GB in 12 minutes, the game's own charged memory from 3.9 to 5.3 GB, and macOS compressed 4.5 GB of it, with swap growing. The host's GPU memory grew only 0.3 GB of that; Metal's allocated total rose 2.6 GB, mostly the no-copy buffers over the game's pools. Grand Prix races did not show it.

With `mem_map_limit on`, the game maps up to 1.5 GB in its alias region where it mapped 3.0 GB, as [issue #1536](https://github.com/seedds/nxnative/issues/1536) found on an 8 GB Mac. With `DM_GUEST_FILE=1` too (the game's memory in files, which macOS writes out instead of compressing or swapping), the footprint stayed at 3.8 to 4.4 GB over 13 to 17 minutes of free roam, compressed memory under 0.6 GB, swap flat, wired unchanged at about 6.5 GB. The cost is more long frames: a played windowed run of 20 minutes (Grand Prix and free roam) had 1.35 long frames a second (21 over 100 ms) against 0.65 to 0.73 in runs without the files, mostly later in the session; a headless free-roam run had 0.75 against 0.49. The limit and the files do not change the frame rate: free roam drops to about 40 fps on this Mac in its heavier areas. The files take disk space while the game runs (about 8 GB here) and go at exit. Measured on a branch with pull requests #1179, #1229, #1230, #1251 and #1350 as well.

## Terrain and movies

The flat ground with blocky seams behind the title and the menu was terrain tiles the CPU wrote with no flush, read as zeros: [Uncompressed storage the CPU wrote, in a pool the GPU has not written](../../../docs/reference/nvn-objects.md#uncompressed-storage-the-cpu-wrote-in-a-pool-the-gpu-has-not-written). The title now shows real terrain, with hills, lawns and road edges.
Expand Down
2 changes: 2 additions & 0 deletions dm/games/0400C3F00006E000/game.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ mem_reserve 0x320000000
mem_alias 0x100000000
mem_stack 0x10000000
app_pool 0x240000000
# MapPhysicalMemory past the application pool fails, as on Horizon (hle_svc.c): the game's streaming frees its own blocks instead of mapping more (README, Memory in free roam)
mem_map_limit on
sys_resource 0x4000000

# ---- Shader split (shader_split.py) ----
Expand Down
Loading