mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
SetHeapSize takes the game's whole heap at boot (2.1 GiB on 1.4.3) and Windows charges all of it against the commit limit, although a sky-island run touched about two thirds. With TOTK_HEAP_LAZY=1 the heap stays reserved: the first read or write of a chunk faults and memory.c heap_fault commits it; read faults reach the hook only in this mode (plat_mem_fault_reads). A byte per chunk (lazy_map) answers without asking the OS, so frozen-region write faults pay nothing for it, and only clear chunks are committed, never pages a freeze made read-only. mem_thaw, which file reads, save writes and Vulkan imports call before the kernel or driver touches guest memory, commits its range's chunks first; ipc.c and svc.c check readability by the layout; vk_mem_host_room counts the uncommitted heap as taken. Default off: the heap path is unchanged unless set. Sky island, 120 s, this laptop (Iris Xe): peak commit 6345-6536 MiB on dev, 5736-5821 MiB with heap_lazy = 1; about 600 first-use faults, 8 ms in all.