Index: runtime/vm/zone.cc |
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc |
index 0f6754fd15f1a4615c596cd56ae1502c3ebac002..743727a54f91a3abffc9b8b9efb41a1798ae8620 100644 |
--- a/runtime/vm/zone.cc |
+++ b/runtime/vm/zone.cc |
@@ -35,7 +35,7 @@ class Zone::Segment { |
// Computes the address of the nth byte in this segment. |
uword address(int n) { return reinterpret_cast<uword>(this) + n; } |
- static void Delete(Segment* segment) { delete[] segment; } |
+ static void Delete(Segment* segment) { free(segment); } |
DISALLOW_IMPLICIT_CONSTRUCTORS(Segment); |
}; |
@@ -57,16 +57,17 @@ void Zone::Segment::DeleteSegmentList(Segment* head) { |
Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { |
ASSERT(size >= 0); |
- Segment* result = reinterpret_cast<Segment*>(new uint8_t[size]); |
+ Segment* result = reinterpret_cast<Segment*>(malloc(size)); |
+ if (result == NULL) { |
+ FATAL("Out of memory.\n"); |
+ } |
ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment)); |
- if (result != NULL) { |
#ifdef DEBUG |
- // Zap the entire allocated segment (including the header). |
- memset(result, kZapUninitializedByte, size); |
+ // Zap the entire allocated segment (including the header). |
+ memset(result, kZapUninitializedByte, size); |
#endif |
- result->next_ = next; |
- result->size_ = size; |
- } |
+ result->next_ = next; |
+ result->size_ = size; |
return result; |
} |