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