diff -up firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp --- firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 2020-04-03 21:30:08.000000000 +0200 +++ firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp 2020-04-23 21:15:56.015491502 +0200 @@ -147,8 +147,12 @@ bool nsAvailableMemoryWatcher::IsVirtual /* static */ bool nsAvailableMemoryWatcher::IsCommitSpaceLow(const MEMORYSTATUSEX& aStat) { - if ((kLowCommitSpaceThreshold != 0) && - (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) { + const char* threshold = getenv("MOZ_GC_THRESHOLD"); + if (threshold) { + kLowCommitSpaceThreshold = atoi(threshold); + } + + if ((kLowCommitSpaceThreshold == 0) || (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) { sNumLowCommitSpaceEvents++; CrashReporter::AnnotateCrashReport( CrashReporter::Annotation::LowCommitSpaceEvents, @@ -206,13 +210,16 @@ void nsAvailableMemoryWatcher::AdjustPol // polling interval accordingly. NS_IMETHODIMP nsAvailableMemoryWatcher::Notify(nsITimer* aTimer) { + const char* threshold = getenv("MOZ_GC_THRESHOLD"); + bool forceLowMem = (threshold && atoi(threshold) == 0); + MEMORYSTATUSEX stat; stat.dwLength = sizeof(stat); bool success = GlobalMemoryStatusEx(&stat); - if (success) { + if (success || forceLowMem) { bool lowMemory = IsVirtualMemoryLow(stat) || IsCommitSpaceLow(stat) || - IsPhysicalMemoryLow(stat); + IsPhysicalMemoryLow(stat) || forceLowMem; if (lowMemory) { SendMemoryPressureEvent();