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