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