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