[vm] Adds full GC check on all external allocations
related #33314
Change-Id: I3f715f5c3580c9f865a4579b732ba56c39c69012
Reviewed-on: https://dart-review.googlesource.com/58001
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index fae7b80..a6bf50b 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -140,9 +140,12 @@
} else {
ASSERT(space == kOld);
old_space_.AllocateExternal(cid, size);
- if (old_space_.NeedsGarbageCollection()) {
- CollectAllGarbage();
- }
+ }
+ // Idle GC does not check whether promotions should trigger a full GC.
+ // As a workaround, we check here on every external allocation. See issue
+ // dartbug.com/33314.
+ if (old_space_.NeedsGarbageCollection()) {
+ CollectAllGarbage();
}
}