perf(libc): release exact resident mappings without repeated queries

This commit is contained in:
Evgeniy Kazarin committed 2026-10-18 06:03:30 +03:00
1 parent 6447ed1ed7
commit 97c11bcb94
1 file changed
+5
@@ -798,6 +798,11 @@ private:
forgetClean(address, end);
breakRun(address);
breakRun(end);
if (const auto run = residentRuns.find(address); run != residentRuns.end() && run->second.end == end) {
evict(run);
if (!VirtualFree(reinterpret_cast<void*>(address), bytes, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) fail("release private guest memory");
return;
}
for (auto cursor = address; cursor < end;) {
const auto memory = query(cursor);
if (memory.State == MEM_RESERVE) {