diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 9b3436db34e..97a90ca8086 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -732,7 +732,7 @@ class GCRuntime void setMaxMallocBytes(size_t value); void resetMallocBytes(); - bool isTooMuchMalloc() const { return mallocBytes <= 0; } + bool isTooMuchMalloc() const { return mallocBytesUntilGC <= 0; } void updateMallocCounter(JS::Zone *zone, size_t nbytes); void onTooMuchMalloc(); @@ -1178,11 +1178,11 @@ class GCRuntime * Malloc counter to measure memory pressure for GC scheduling. It runs * from maxMallocBytes down to zero. */ - mozilla::Atomic mallocBytes; + mozilla::Atomic mallocBytesUntilGC; /* - * Whether a GC has been triggered as a result of mallocBytes falling - * below zero. + * Whether a GC has been triggered as a result of mallocBytesUntilGC + * falling below zero. */ mozilla::Atomic mallocGCTriggered; diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 09c6d93a445..e9e2452166e 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -1127,7 +1127,7 @@ GCRuntime::GCRuntime(JSRuntime *rt) : #endif validate(true), fullCompartmentChecks(false), - mallocBytes(0), + mallocBytesUntilGC(0), mallocGCTriggered(false), alwaysPreserveCode(false), #ifdef DEBUG @@ -1655,14 +1655,14 @@ GCRuntime::setMaxMallocBytes(size_t value) void GCRuntime::resetMallocBytes() { - mallocBytes = ptrdiff_t(maxMallocBytes); + mallocBytesUntilGC = ptrdiff_t(maxMallocBytes); mallocGCTriggered = false; } void GCRuntime::updateMallocCounter(JS::Zone *zone, size_t nbytes) { - mallocBytes -= ptrdiff_t(nbytes); + mallocBytesUntilGC -= ptrdiff_t(nbytes); if (MOZ_UNLIKELY(isTooMuchMalloc())) onTooMuchMalloc(); else if (zone)