mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
heap_lazy = 1 commits the game's heap a 1 MiB chunk at a time on first use (Windows, opt-in)
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.
This commit is contained in:
1 parent
afae80c908
commit
6370c7c0b6
11 files changed
+142
-8
No files matched your search
@@ -985,6 +985,8 @@ void plat_mem_fault_hook(int (*fn)(uint64_t addr)) {
|
||||
fault_install();
|
||||
}
|
||||
|
||||
void plat_mem_fault_reads(int on) { (void)on; }
|
||||
|
||||
void plat_crash_hook(void (*fn)(const PlatCrash *c)) {
|
||||
crash_fn = fn;
|
||||
fault_install();
|
||||
|
||||
Reference in new issue
Block a user