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