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

Unified Diff: runtime/vm/pages.cc

Issue 861033005: Consistent treatment of allocation failures in old space. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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: runtime/vm/pages.cc
===================================================================
--- runtime/vm/pages.cc (revision 43111)
+++ runtime/vm/pages.cc (working copy)
@@ -62,8 +62,7 @@
VirtualMemory* memory =
VerifiedMemory::Reserve(size_in_words << kWordSizeLog2);
if (memory == NULL) {
- FATAL1("Out of memory while allocating %" Pd " words.\n",
- size_in_words);
+ return NULL;
}
return Initialize(memory, type);
}
@@ -183,6 +182,9 @@
HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) {
HeapPage* page = HeapPage::Allocate(kPageSizeInWords, type);
+ if (page == NULL) {
+ return NULL;
+ }
bool is_exec = (type == HeapPage::kExecutable);
@@ -217,6 +219,9 @@
HeapPage* PageSpace::AllocateLargePage(intptr_t size, HeapPage::PageType type) {
intptr_t page_size_in_words = LargePageSizeInWordsFor(size);
HeapPage* page = HeapPage::Allocate(page_size_in_words, type);
+ if (page == NULL) {
+ return NULL;
+ }
page->set_next(large_pages_);
large_pages_ = page;
IncreaseCapacityInWords(page_size_in_words);
@@ -312,7 +317,9 @@
!page_space_controller_.NeedsGarbageCollection(after_allocation)) &&
CanIncreaseCapacityInWords(kPageSizeInWords)) {
HeapPage* page = AllocatePage(type);
- ASSERT(page != NULL);
+ if (page == NULL) {
+ return 0;
+ }
// Start of the newly allocated page is the allocated object.
result = page->object_start();
// Note: usage_.capacity_in_words is increased by AllocatePage.
« 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