Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 75da4dc7ea518c3e1a5740e3d444fbf11fa122c6..487573c30220809890d5b1d5ecc8a9ab7be6cfc7 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -10040,7 +10040,7 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( |
typedef internal::Internals I; |
int64_t* external_memory = reinterpret_cast<int64_t*>( |
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset); |
- const int64_t external_memory_limit = *reinterpret_cast<int64_t*>( |
+ int64_t* external_memory_limit = reinterpret_cast<int64_t*>( |
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset); |
int64_t* external_memory_at_last_mc = |
reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) + |
@@ -10058,7 +10058,11 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( |
CheckMemoryPressure(); |
} |
- if (change_in_bytes > 0 && amount > external_memory_limit) { |
+ if (change_in_bytes < 0) { |
+ *external_memory_limit += change_in_bytes; |
+ } |
+ |
+ if (change_in_bytes > 0 && amount > *external_memory_limit) { |
ReportExternalAllocationLimitReached(); |
} |
return *external_memory; |