| Index: Source/platform/heap/HeapPage.cpp
|
| diff --git a/Source/platform/heap/HeapPage.cpp b/Source/platform/heap/HeapPage.cpp
|
| index 85ca1afc8c9edc7b8ea0ae5b17d38c0f39776149..f38a2f87209ef0e56d46b03cdf0591412e87bd5a 100644
|
| --- a/Source/platform/heap/HeapPage.cpp
|
| +++ b/Source/platform/heap/HeapPage.cpp
|
| @@ -667,11 +667,15 @@ void NormalPageHeap::promptlyFreeObject(HeapObjectHeader* header)
|
| header->finalize(payload, payloadSize);
|
| if (address + size == m_currentAllocationPoint) {
|
| m_currentAllocationPoint = address;
|
| - if (m_lastRemainingAllocationSize == m_remainingAllocationSize) {
|
| - Heap::decreaseAllocatedObjectSize(size);
|
| - m_lastRemainingAllocationSize += size;
|
| - }
|
| m_remainingAllocationSize += size;
|
| + // Sync recorded allocated-object size:
|
| + // - if previous alloc checkpoint is larger, allocation size has increased.
|
| + // - if smaller, a net reduction in size since last call to updateRemainingAllocationSize().
|
| + if (m_lastRemainingAllocationSize > m_remainingAllocationSize)
|
| + Heap::increaseAllocatedObjectSize(m_lastRemainingAllocationSize - m_remainingAllocationSize);
|
| + else if (m_lastRemainingAllocationSize != m_remainingAllocationSize)
|
| + Heap::decreaseAllocatedObjectSize(m_remainingAllocationSize - m_lastRemainingAllocationSize);
|
| + m_lastRemainingAllocationSize = m_remainingAllocationSize;
|
| SET_MEMORY_INACCESSIBLE(address, size);
|
| return;
|
| }
|
|
|