|
|
1f029b |
diff -up firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp
|
|
|
1f029b |
--- firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 2020-04-03 21:30:08.000000000 +0200
|
|
|
1f029b |
+++ firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp 2020-04-23 21:15:56.015491502 +0200
|
|
|
1f029b |
@@ -147,8 +147,12 @@ bool nsAvailableMemoryWatcher::IsVirtual
|
|
|
1f029b |
|
|
|
1f029b |
/* static */
|
|
|
1f029b |
bool nsAvailableMemoryWatcher::IsCommitSpaceLow(const MEMORYSTATUSEX& aStat) {
|
|
|
1f029b |
- if ((kLowCommitSpaceThreshold != 0) &&
|
|
|
1f029b |
- (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
|
|
|
1f029b |
+ const char* threshold = getenv("MOZ_GC_THRESHOLD");
|
|
|
1f029b |
+ if (threshold) {
|
|
|
1f029b |
+ kLowCommitSpaceThreshold = atoi(threshold);
|
|
|
1f029b |
+ }
|
|
|
1f029b |
+
|
|
|
1f029b |
+ if ((kLowCommitSpaceThreshold == 0) || (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
|
|
|
1f029b |
sNumLowCommitSpaceEvents++;
|
|
|
1f029b |
CrashReporter::AnnotateCrashReport(
|
|
|
1f029b |
CrashReporter::Annotation::LowCommitSpaceEvents,
|
|
|
1f029b |
@@ -206,13 +210,16 @@ void nsAvailableMemoryWatcher::AdjustPol
|
|
|
1f029b |
// polling interval accordingly.
|
|
|
1f029b |
NS_IMETHODIMP
|
|
|
1f029b |
nsAvailableMemoryWatcher::Notify(nsITimer* aTimer) {
|
|
|
1f029b |
+ const char* threshold = getenv("MOZ_GC_THRESHOLD");
|
|
|
1f029b |
+ bool forceLowMem = (threshold && atoi(threshold) == 0);
|
|
|
1f029b |
+
|
|
|
1f029b |
MEMORYSTATUSEX stat;
|
|
|
1f029b |
stat.dwLength = sizeof(stat);
|
|
|
1f029b |
bool success = GlobalMemoryStatusEx(&stat;;
|
|
|
1f029b |
|
|
|
1f029b |
- if (success) {
|
|
|
1f029b |
+ if (success || forceLowMem) {
|
|
|
1f029b |
bool lowMemory = IsVirtualMemoryLow(stat) || IsCommitSpaceLow(stat) ||
|
|
|
1f029b |
- IsPhysicalMemoryLow(stat);
|
|
|
1f029b |
+ IsPhysicalMemoryLow(stat) || forceLowMem;
|
|
|
1f029b |
|
|
|
1f029b |
if (lowMemory) {
|
|
|
1f029b |
SendMemoryPressureEvent();
|