Index: runtime/vm/pages.h |
diff --git a/runtime/vm/pages.h b/runtime/vm/pages.h |
index 640e771f30036d72e087d96c76f6715efc9689d0..06e3ab5e9d9042c2057d94a55bfef02680dd878d 100644 |
--- a/runtime/vm/pages.h |
+++ b/runtime/vm/pages.h |
@@ -412,8 +412,13 @@ class PageSpace { |
// Unlimited. |
return true; |
} |
- ASSERT(CapacityInWords() <= max_capacity_in_words_); |
- return increase_in_words <= (max_capacity_in_words_ - CapacityInWords()); |
+ // TODO(issue 27413): Make the check against capacity and the bump |
+ // of capacity atomic so that CapacityInWords does not exceed |
+ // max_capacity_in_words_. |
+ intptr_t free_capacity_in_words = |
+ (max_capacity_in_words_ - CapacityInWords()); |
+ return ((free_capacity_in_words > 0) && |
+ (increase_in_words <= free_capacity_in_words)); |
} |
FreeList freelist_[HeapPage::kNumPageTypes]; |