summaryrefslogtreecommitdiff
path: root/deps/v8/src/zone/accounting-allocator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/zone/accounting-allocator.cc')
-rw-r--r--deps/v8/src/zone/accounting-allocator.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/deps/v8/src/zone/accounting-allocator.cc b/deps/v8/src/zone/accounting-allocator.cc
index 08381b31f1..ee841fb4af 100644
--- a/deps/v8/src/zone/accounting-allocator.cc
+++ b/deps/v8/src/zone/accounting-allocator.cc
@@ -83,7 +83,11 @@ Segment* AccountingAllocator::GetSegment(size_t bytes) {
Segment* AccountingAllocator::AllocateSegment(size_t bytes) {
void* memory = malloc(bytes);
- if (memory) {
+ if (memory == nullptr) {
+ V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
+ memory = malloc(bytes);
+ }
+ if (memory != nullptr) {
base::AtomicWord current =
base::Relaxed_AtomicIncrement(&current_memory_usage_, bytes);
base::AtomicWord max = base::Relaxed_Load(&max_memory_usage_);