|
|
f5d0dc |
diff -up firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp
|
|
|
f5d0dc |
--- firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 2020-04-03 21:30:08.000000000 +0200
|
|
|
f5d0dc |
+++ firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp 2020-04-23 21:15:56.015491502 +0200
|
|
|
f5d0dc |
@@ -147,8 +147,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,
|
|
|
f5d0dc |
@@ -206,13 +210,16 @@ 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) {
|
|
|
f5d0dc |
+ if (success || forceLowMem) {
|
|
|
f5d0dc |
bool lowMemory = IsVirtualMemoryLow(stat) || IsCommitSpaceLow(stat) ||
|
|
|
f5d0dc |
- IsPhysicalMemoryLow(stat);
|
|
|
f5d0dc |
+ IsPhysicalMemoryLow(stat) || forceLowMem;
|
|
|
f5d0dc |
|
|
|
f5d0dc |
if (lowMemory) {
|
|
|
f5d0dc |
SendMemoryPressureEvent();
|