[scudo] Do not consider releasing unallocated pages
We already know that there are no free blocks above Region->AllocatedUser.
This results in a smaller RegionPageMap and faster releaseFreeMemoryToOS.
Patch By: fabio-d
Differential Revision: https://reviews.llvm.org/D138794
GitOrigin-RevId: 12e20a446e4df75a6aa147dd322ba6a34545c2bc
diff --git a/lib/scudo/standalone/primary64.h b/lib/scudo/standalone/primary64.h
index d06a047..b653bc8 100644
--- a/lib/scudo/standalone/primary64.h
+++ b/lib/scudo/standalone/primary64.h
@@ -691,7 +691,8 @@
const uptr GroupSize = (1U << GroupSizeLog);
const uptr AllocatedUserEnd = Region->AllocatedUser + Region->RegionBeg;
ReleaseRecorder Recorder(Region->RegionBeg, &Region->Data);
- PageReleaseContext Context(BlockSize, RegionSize, /*NumberOfRegions=*/1U);
+ PageReleaseContext Context(BlockSize, Region->AllocatedUser,
+ /*NumberOfRegions=*/1U);
const uptr CompactPtrBase = getCompactPtrBaseByClassId(ClassId);
auto DecompactPtr = [CompactPtrBase](CompactPtrT CompactPtr) {