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