Chromium Code Reviews| 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); |