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