Route Service.onTrimMemory notifications through to Gecko's memory pressure observer
Categories
(GeckoView :: General, enhancement, P1)
Tracking
(firefox86 fixed)
| Tracking | Status | |
|---|---|---|
| firefox86 | --- | fixed |
People
(Reporter: bugzilla, Assigned: bugzilla)
References
Details
(Whiteboard: [geckoview:m87])
Attachments
(2 files)
Since Android may send these to the services hosting content processes, we should route them through to the memory-pressure observer, which will help by forcing GCs, cleaning up the heap, etc.
I don't expect this to be a definitive fix for bug 1682319, but it should help.
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 1•5 years ago
|
||
Gecko already broadcasts memory-pressure events from the parent process down
to its content processes, but that excludes any case where Android is calling
Service.onTrimMemory directly on the content processes.
This patch handles onTrimMemory and translates its requests into
memory-pressure events that various Gecko components (including the GC)
listen for. We only handle the severity levels for background processes for now,
as memory cleanup for background processes is currently the most pressing issue
(and I'm not even sure what we could do for foreground memory cleanup without
janking anything).
The argument to memory-pressure should depend on the severity of the request
as well as the frequency of pressure events. In particular:
- The most severe request,
TRIM_MEMORY_COMPLETE, is a last-ditch effort to
reduce memory. This should trigger a full GC, so we uselow-memoryhere. - "New" requests, where "new" is defined as an event that was triggered in
excess 10 seconds since the previous "new" event, also gets a full GC, so we
uselow-memoryhere as well. - Additional requests that do not fall under either of the above criteria
receive thelow-memory-ongoingevent, which omits a full GC. The idea here
is that, when low memory notifications occur in rapid succession, repeatedly
doing full GCs over and over is just going to hang the Gecko thread and not
result in any notable improvement.
| Assignee | ||
Comment 3•5 years ago
|
||
Comment 5•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/cddfeeb87193
https://hg.mozilla.org/mozilla-central/rev/1dc8d0dd5e30
Description
•