Skip to content

Reduce long-session serial-history memory and remove global rehashes - #34

Merged
ly05010419 merged 1 commit into
ly05010419:mainfrom
Flowershangfromthebranches:fix/totk-paged-serial-history
Oct 19, 2026
Merged

ly05010419 merged 1 commit into
ly05010419:mainfrom
Flowershangfromthebranches:fix/totk-paged-serial-history

Conversation

@Flowershangfromthebranches

Copy link
Copy Markdown
Contributor

Long TOTK sessions retain every finalized texture serial and every GPU-owned serial. In a 2h52m 1.0.0 session the sets reached 24.37M and 16.70M entries; their hash arrays alone accounted for about 1 GiB, and growth required rehashing all old keys on the submit path.

This replaces only those two membership sets with sparse, exact paged bitmaps. All uint64 serials and historical ownership facts are preserved under the existing mutex; texture-pool following, recording pins, retirement and GPU synchronization retain their existing semantics. Allocating a new page never reinserts previous keys. Periodic diagnostics report actual requested bytes and pages beyond the existing detailed memory-log cap. Storage still grows with occupied serial ranges.

This is independent of #29 and #30: it does not change shader loading, skip draws, limit FPS, or alter resolution/interpolation. Other local translation/prefetch changes are deliberately excluded to keep this review separate from the existing async-loading work.

Validation on current main c5ac270:

  • 72 source tests passed with the existing Python 3.14 build environment, including full-width serials, cached miss then insertion, duplicates, and two million retained facts.
  • Production renderer syntax check passed (45 existing warnings).
  • git diff --check passed.
  • A synthetic two-million dense-serial comparison used 64 MiB for the old hash arrays versus 260 KiB for the paged structure. This is not an FPS or whole-process memory result.

Supporting local integration evidence: the 1.0.0 packaged runtime passed the texture-retirement GPU probe (35,021 checks), UBSan, and a short scene/movement check using a save copy. That runtime also contains other local shader fixes, so these checks are not represented as an isolated performance benchmark of this branch. No long-session memory plateau is claimed; ASan could not initialize on the local macOS 27.2 host. Details: docs/serial-history.md.

@ly05010419
ly05010419 merged commit 218b2cc into ly05010419:main Oct 19, 2026
1 check passed
ly05010419 added a commit that referenced this pull request Oct 20, 2026
…ultrawide HUD, 1.4.3 survey, mods, controls.txt) into the Breath of the Wild branch

Resolved by hand: nvn_mtl.m (PR #34's paged-bitmap serial sets keep the serial forgetting of 635fb31: totk_serial_del
clears a bit; the memory line shows both; the BotW frame reset stays in mtl_present), build_app.py (make -j and the
per-game launcher defines), the Makefile (the BotW targets and the Opus test), loader.c (the #57 stale-reference handler
and 1.4.3's survey return address are TOTK-only: Breath of the Wild has no GAME_ADDR for them), world_survey.c (BotW
keeps its stub, with runtime_survey_sync), README (both update-history rows).

Found by the merged build: Breath of the Wild lacked runtime_output_size_current (frontend.m's shortcut text) and
runtime_survey_sync (hle_nvn.c); and the add-on content file handles shared fs_host.c's 0x200000000 range, so closing a
host file at the title ended the game ("close invalid add-on content handle"): they now start at 0x400000000.

Tested on the merged binaries: TOTK 1.2.1 jump session (anomalies 0, occlusion normal, serial set 48,606 / 13 pages),
Breath of the Wild DLC + key 3 (k3a6) and key 2 (k2c, 11 of 12 pairs within 5 px).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants