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