Free dirty unused pages in jemalloc when minimizing memory on Fennec

RESOLVED FIXED in Firefox 20

Status

()

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: kats, Assigned: kats)

Tracking

unspecified
Firefox 20
All
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Bug 805855 adds code to free dirty pages kept by jemalloc when the nsMemoryReporterManager::MinimizeMemoryUsage code runs (AFAICT this happens when the app goes into the background, or if somebody triggers it manually from about:memory). We should consider enabling this behaviour for Fennec as well.

Although... it looks like in Fennec we don't trigger the same codepath when we go into the background. In Fennec, we run the code at [1] but based on MXR'ing around it looks like other platforms trigger [2]? Need to verify that. This bug is specifically only for turning on the memory.free_dirty_pages pref in Fennec; I'll file a separate bug for the backgrounding behaviour if needed, since that will probably impact other things too.

[1] https://hg.mozilla.org/mozilla-central/file/4a2be997f539/widget/android/nsAppShell.cpp#l440
[2] https://hg.mozilla.org/mozilla-central/file/4a2be997f539/dom/ipc/ProcessPriorityManager.cpp#l264
Please keep an eye on bug 805855 -- I don't think we want to do this only when doing MinimizeMemoryUsage.
Created attachment 684506 [details] [diff] [review]
Turn on memory.free_dirty_pages in fennec

This works as expected (i.e. releases heap-dirty memory back to the system on a memory-pressure event). I tested it on Fennec by running "adb shell am broadcast -a org.mozilla.gecko.FORCE_MEMORY_PRESSURE" after startup to simulate a memory-pressure situation, and comparing the about:memory dumps before and after. The heap-dirty went down from 3.8 MiB to 523 KiB and resident memory went down from 129 MiB to 124 MiB.
Attachment #684506 - Flags: review?(justin.lebar+bug)
Attachment #684506 - Flags: review?(justin.lebar+bug) → review+
Assignee: nobody → bugmail.mozilla
https://hg.mozilla.org/mozilla-central/rev/491736c9cddc
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
You need to log in before you can comment on or make changes to this bug.