Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1194)

Unified Diff: Source/platform/heap/ThreadState.cpp

Issue 1100283003: Oilpan: Oilpan's GC should not be triggered without having allocated any object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index 6270835414dc436b35f708b6bdad82d70da4ed11..a2fd331e985b6d2e47ae6098a8ed9566291d0453 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -516,9 +516,10 @@ 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 the current memory usage is >1MB
- // and is >50% larger than the estimated live memory usage.
- return currentObjectSize >= 1024 * 1024 && currentObjectSize > estimatedLiveObjectSize * 3 / 2;
+ // 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;
#else
return false;
#endif
@@ -541,9 +542,10 @@ 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 the current memory usage is >1MB
- // and is >50% larger than the estimated live memory usage.
- return currentObjectSize >= 1024 * 1024 && currentObjectSize > estimatedLiveObjectSize * 3 / 2;
+ // 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;
#endif
}
@@ -567,10 +569,11 @@ bool ThreadState::shouldForceConservativeGC()
// aggressively. This is a safe guard to avoid OOM.
return currentObjectSize > estimatedLiveObjectSize * 3 / 2;
}
- // Schedule a conservative GC if the current memory usage is >32MB
- // and is >400% larger than the estimated live memory usage.
+ // 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.
// TODO(haraken): 400% is too large. Lower the heap growing factor.
- return currentObjectSize >= 32 * 1024 * 1024 && currentObjectSize > 5 * estimatedLiveObjectSize;
+ return allocatedObjectSize >= 32 * 1024 * 1024 && currentObjectSize > 5 * estimatedLiveObjectSize;
}
void ThreadState::scheduleGCIfNeeded()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698