f1b26c
diff -up firefox-78.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 firefox-78.0/xpcom/base/AvailableMemoryTracker.cpp
f1b26c
--- firefox-78.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418	2020-06-17 04:20:44.000000000 +0200
f1b26c
+++ firefox-78.0/xpcom/base/AvailableMemoryTracker.cpp	2020-06-25 14:50:46.369798294 +0200
f1b26c
@@ -157,8 +157,12 @@ bool nsAvailableMemoryWatcher::IsVirtual
f1b26c
 
f1b26c
 /* static */
f1b26c
 bool nsAvailableMemoryWatcher::IsCommitSpaceLow(const MEMORYSTATUSEX& aStat) {
f1b26c
-  if ((kLowCommitSpaceThreshold != 0) &&
f1b26c
-      (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
f1b26c
+  const char* threshold = getenv("MOZ_GC_THRESHOLD");
f1b26c
+  if (threshold) {
f1b26c
+    kLowCommitSpaceThreshold = atoi(threshold);
f1b26c
+  }
f1b26c
+
f1b26c
+  if ((kLowCommitSpaceThreshold == 0) || (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
f1b26c
     sNumLowCommitSpaceEvents++;
f1b26c
     CrashReporter::AnnotateCrashReport(
f1b26c
         CrashReporter::Annotation::LowCommitSpaceEvents,
f1b26c
@@ -210,12 +214,15 @@ void nsAvailableMemoryWatcher::AdjustPol
f1b26c
 // polling interval accordingly.
f1b26c
 NS_IMETHODIMP
f1b26c
 nsAvailableMemoryWatcher::Notify(nsITimer* aTimer) {
f1b26c
+  const char* threshold = getenv("MOZ_GC_THRESHOLD");
f1b26c
+  bool forceLowMem = (threshold && atoi(threshold) == 0);
f1b26c
+
f1b26c
   MEMORYSTATUSEX stat;
f1b26c
   stat.dwLength = sizeof(stat);
f1b26c
   bool success = GlobalMemoryStatusEx(&stat;;
f1b26c
 
f1b26c
-  if (success) {
f1b26c
-    bool lowMemory = IsVirtualMemoryLow(stat) || IsCommitSpaceLow(stat);
f1b26c
+  if (success || forceLowMemory) {
f1b26c
+    bool lowMemory = IsVirtualMemoryLow(stat) || IsCommitSpaceLow(stat || forceLowMem);
f1b26c
 
f1b26c
     if (lowMemory) {
f1b26c
       SendMemoryPressureEvent();