Closed Bug 1711610 Opened 5 months ago Closed 4 months ago

Should not trigger the tab unloader when the page file usage is low

Categories

(Core :: Memory Allocator, enhancement)

Unspecified
Windows
enhancement

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: toshi, Assigned: toshi)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Bug 1586236 introduced the memory resource notification to detect a low memory situation. However, the notification is signaled only when the available physical memory is low. On the other hand, an OOM crash on Windows happens when there is no space in the page file.

When the memory resource notification is signaled (= low physical memory), we still need to check the available page file and if it's still large enough, we should not trigger the tab unloader or the memory pressure event because an OOM crash is not likely to happen soon.

See Also: → 1586236

After bug 1586236, we use the memory resource notification object to detect a low
memory situation on Windows, which is signaled when the available physical memory
is low. If the available physical memory is low, however, it's possible that there
is still commit space enough for the application to run. In such a situation, we
don't want to make aggressive efforts to reduce memory usage.

This patch makes sure we send the memory pressure event (both New and Ongoing) only
when the available commit space is lower than the threshold value defined by the pref
"browser.low_commit_space_threshold_mb". Its default value is set to 200MB
based on our telemetry data indicating ~60% of OOM crashes with <100MB, ~75% with <300MB.

To use the pref in nsAvailableMemoryWatcher, this patch moves the call to
AvailableMemoryTracker::Init() to XRE_mainRun(). It was in NS_InitXPCOM
because the old initialization code hooked APIs and needed to be done while
the process has only one thread (bug 741540). The current AvailableMemoryTracker
does not use hooks, so it doesn't have to be initialized that early.

Attached image 20210520-2days-x64.png

Uploading charts from the latest crash ping data as a hint to determine the threshold

Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8bee937821e3
Should not trigger the memory pressure event if the available commit space is not low.  r=gsvelto
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
Regressions: 1713100
You need to log in before you can comment on or make changes to this bug.