Chromium Code Reviews| Index: Source/platform/heap/ThreadState.cpp |
| diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp |
| index d9618393402e09b50ac8cde15375e2335c00c7d9..a1b13d22a26c9b03b4ee149e93ab34ef7d10300e 100644 |
| --- a/Source/platform/heap/ThreadState.cpp |
| +++ b/Source/platform/heap/ThreadState.cpp |
| @@ -539,10 +539,9 @@ bool ThreadState::shouldScheduleIdleGC() |
| // Heap::markedObjectSize() may be underestimated if any thread has not |
| // finished completeSweep(). |
| size_t currentObjectSize = allocatedObjectSize + Heap::markedObjectSize() + WTF::Partitions::totalSizeOfCommittedPages(); |
| - // Schedule an idle GC if Oilpan has allocated more than 1 MB since |
| - // the last GC and the current memory usage is >50% larger than |
| - // the estimated live memory usage. |
| - return allocatedObjectSize >= 1024 * 1024 && currentObjectSize > estimatedLiveObjectSize * 3 / 2; |
| + // Schedule an idle GC if Oilpan has allocated more than 1 MB and the |
| + // current memory usage is >50% larger than the estimated live memory usage. |
| + return Heap::allocatedSpace() >= 1024 * 1024 && currentObjectSize > estimatedLiveObjectSize * 3 / 2; |
| #else |
| return false; |
| #endif |
| @@ -565,10 +564,9 @@ bool ThreadState::shouldSchedulePreciseGC() |
| // Heap::markedObjectSize() may be underestimated if any thread has not |
| // finished completeSweep(). |
| size_t currentObjectSize = allocatedObjectSize + Heap::markedObjectSize() + WTF::Partitions::totalSizeOfCommittedPages(); |
| - // Schedule a precise GC if Oilpan has allocated more than 1 MB since |
| - // the last GC and the current memory usage is >50% larger than |
| - // the estimated live memory usage. |
| - return allocatedObjectSize >= 1024 * 1024 && currentObjectSize > estimatedLiveObjectSize * 3 / 2; |
| + // Schedule a precise GC if Oilpan has allocated more than 1 MB and the |
| + // current memory usage is >50% larger than the estimated live memory usage. |
| + return Heap::allocatedSpace() >= 1024 * 1024 && currentObjectSize > estimatedLiveObjectSize * 3 / 2; |
| #endif |
| } |
| @@ -592,11 +590,11 @@ bool ThreadState::shouldForceConservativeGC() |
| // aggressively. This is a safe guard to avoid OOM. |
| return currentObjectSize > estimatedLiveObjectSize * 3 / 2; |
|
sof
2015/06/09 15:49:56
If size_t is 4 bytes wide (win32), the computation
|
| } |
| - // Schedule a conservative GC if Oilpan has allocated more than 32 MB since |
| - // the last GC and the current memory usage is >400% larger than |
| - // the estimated live memory usage. |
| + // Schedule a conservative GC if Oilpan has allocated more than 32 MB and |
| + // the current memory usage is >400% larger than the estimated live memory |
| + // usage. |
| // TODO(haraken): 400% is too large. Lower the heap growing factor. |
| - return allocatedObjectSize >= 32 * 1024 * 1024 && currentObjectSize > 5 * estimatedLiveObjectSize; |
| + return Heap::allocatedSpace() >= 32 * 1024 * 1024 && currentObjectSize > 5 * estimatedLiveObjectSize; |
| } |
| void ThreadState::scheduleGCIfNeeded() |