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

Unified Diff: runtime/vm/heap.cc

Issue 211593004: Reduce GC from external allocation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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
Index: runtime/vm/heap.cc
===================================================================
--- runtime/vm/heap.cc (revision 34384)
+++ runtime/vm/heap.cc (working copy)
@@ -34,6 +34,8 @@
DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB,
"old gen heap size in MB,"
"e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap");
+DEFINE_FLAG(int, new_gen_ext_limit, 64,
+ "maximum total external size (MB) in new gen before triggering GC");
Heap::Heap() : read_only_(false), gc_in_progress_(false) {
for (int sel = 0;
@@ -94,6 +96,11 @@
void Heap::AllocateExternal(intptr_t size, Space space) {
if (space == kNew) {
new_space_->AllocateExternal(size);
+ if (new_space_->ExternalInWords() > FLAG_new_gen_ext_limit * MBInWords) {
Anders Johnsen 2014/03/26 07:09:04 DBC: Just to be sure I get it right: This means t
koda 2014/03/26 16:16:28 Not exactly. The total amount of memory that this
Anders Johnsen 2014/03/26 18:05:27 I see. Thanks for explaining!
Ivan Posva 2014/03/27 21:18:16 (FLAG_new_gen_ext_limit * MBInWords)
koda 2014/03/27 22:11:13 Done.
+ // Attempt to free some external allocation by a scavenge. (If the total
+ // remains above the limit, next external alloc will trigger another.)
+ CollectGarbage(kNew);
+ }
} else {
ASSERT(space == kOld);
old_space_->AllocateExternal(size);

Powered by Google App Engine
This is Rietveld 408576698