[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
This commit is contained in:
Petr Hosek 2022-11-30 02:34:46 +00:00
parent c995120968
commit 12e20a446e
1 changed files with 2 additions and 1 deletions

View File

@ -691,7 +691,8 @@ private:
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) {