Closed Bug 807998 Opened 9 years ago Closed 9 years ago

Free dirty unused pages in jemalloc when minimizing memory on Fennec

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 20

People

(Reporter: kats, Assigned: kats)

References

Details

Attachments

(1 file)

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.
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
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.