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