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