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