mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 01:49:58 -04:00
With NX2NAVI_HEAP_LAZY=1, a heap page nothing has touched yet is still reserved. mem_copy_readable holds frz_lock and, for a range with no armed or probed region, copied it with a plain memcpy. A reserved heap page in that range faulted into fault_veh, then access_fault, then heap_lazy_fault, which takes frz_lock on the same thread. The SRW lock is not recursive, so the copy never returned, and every later fault, thaw and freeze waited behind it. Callers are frame_rate.c's floor probe and vk_memory.c mirror_capture (MIRROR_CAPTURE_KB or MIRROR_STAGE). Now, when the lazy heap is on and a range meets the heap, the range is copied run by run as plat_mem_state reports its pages. The heap's reserved runs read zero, as they would once committed, and are not committed, so a diagnostic read or a mirror's first copy does not undo what the setting saves. Readable runs are copied, and anything else leaves the range out (ok = 0). Ranges outside the heap, and every range while the lazy heap is off, keep the copy that asks the system nothing. tests/heap_lazy_copy_check builds memory.c with the Windows platform layer and its fault handler. It copies an untouched heap page, a range from written pages into untouched ones, a range past the heap's end, and a batch of three, each on a worker the main thread gives 3 s. Before the change the first copy hung (exit 4). Checks that passed: heap_lazy_copy_check, pass_cc_check on memory.c, no new -Wall -Wextra warnings, wb_lazy_check, mem_growth_check, mem_budget_check and gpa_check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 KiB
97 KiB