mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-02 12:56:05 +00:00
A heap mirror is refreshed from the write watch. acquireMirror checked the watch only when it made a mirror and reused an existing one as it was. Once part of the range left the watch, the next address-based build threw "a heap mirror's range is no longer write-watched" from the refresh, and a build served from the address-space cache threw the same from its heap runs. A range leaves the watch for good when a host import that does not keep the watch covers it: on Windows a direct import of private memory that is not settled (below the 1 MiB settle floor, or any when imports cannot be settled), elsewhere any import while imports are compared. A heap mirror now records the unwatch serial at which its range was last seen fully watched. Its reuse, and a cache hit over it, compare that serial with GuestMemory::UnwatchSerial and look at the watch again only when a range has left it since. A mirror whose range is no longer watched is not reused, the cache is not taken (before its imports are stamped), and the pass plans the range again: an import if the budget allows, else a copy. A refused heap mirror also drops the registry's stale one, whose buffer would stay allocated otherwise.