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

Unified Diff: runtime/platform/text_buffer.cc

Issue 2418323002: Make fatal out of memory messages uniform. (Closed)
Patch Set: macro Created 4 years, 2 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 | « runtime/platform/hashmap.cc ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/text_buffer.cc
diff --git a/runtime/platform/text_buffer.cc b/runtime/platform/text_buffer.cc
index 44152e6a2b14bb950f58a2072c5b3836d3388572..b06c49fd80b7d4c2f63301ee79fe791a9c5214c6 100644
--- a/runtime/platform/text_buffer.cc
+++ b/runtime/platform/text_buffer.cc
@@ -15,6 +15,9 @@ namespace dart {
TextBuffer::TextBuffer(intptr_t buf_size) {
ASSERT(buf_size > 0);
buf_ = reinterpret_cast<char*>(malloc(buf_size));
+ if (buf_ == NULL) {
+ OUT_OF_MEMORY();
+ }
buf_size_ = buf_size;
Clear();
}
@@ -152,7 +155,9 @@ void TextBuffer::EnsureCapacity(intptr_t len) {
// the debugger front-end.
intptr_t new_size = buf_size_ + len + kBufferSpareCapacity;
char* new_buf = reinterpret_cast<char*>(realloc(buf_, new_size));
- ASSERT(new_buf != NULL);
+ if (new_buf == NULL) {
+ OUT_OF_MEMORY();
+ }
buf_ = new_buf;
buf_size_ = new_size;
}
« no previous file with comments | « runtime/platform/hashmap.cc ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698