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