Skip to content

Commit

Permalink
[scudo] Apply the min release threshold to the group (llvm#112014)
Browse files Browse the repository at this point in the history
For the block smaller than a page size, one block is unlikely to
introduce more unused pages (at most 2 if it acrosses the page boundary
and both touched pages are unused). So it's better to apply the
threshold to reduce the time of scanning groups that can't release any
new pages.
  • Loading branch information
ChiaHungDuan authored and DanielCChen committed Oct 16, 2024
1 parent 5a8ca2b commit a850cb3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler-rt/lib/scudo/standalone/primary64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,8 @@ template <typename Config> class SizeClassAllocator64 {
}

const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
if (PushedBytesDelta < getMinReleaseAttemptSize(BlockSize))
continue;

// Given the randomness property, we try to release the pages only if the
// bytes used by free blocks exceed certain proportion of group size. Note
Expand Down

0 comments on commit a850cb3

Please sign in to comment.