| Index: Source/wtf/PartitionAlloc.cpp
|
| diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp
|
| index dc284080b30c65526498434099140c38135d2e0d..54bae29d25886b498955be4490f859924b12330d 100644
|
| --- a/Source/wtf/PartitionAlloc.cpp
|
| +++ b/Source/wtf/PartitionAlloc.cpp
|
| @@ -810,6 +810,13 @@ bool partitionReallocDirectMappedInPlace(PartitionRootGeneric* root, PartitionPa
|
| char* charPtr = static_cast<char*>(partitionPageToPointer(page));
|
|
|
| if (newSize < currentSize) {
|
| + size_t mapSize = partitionPageToDirectMapExtent(page)->mapSize;
|
| +
|
| + // Don't reallocate in-place if new size is less than 80 % of the full
|
| + // map size, to avoid holding on to too much unused address space.
|
| + if ((newSize / kSystemPageSize) * 5 < (mapSize / kSystemPageSize) * 4)
|
| + return false;
|
| +
|
| // Shrink by decommitting unneeded pages and making them inaccessible.
|
| size_t decommitSize = currentSize - newSize;
|
| decommitSystemPages(charPtr + newSize, decommitSize);
|
|
|