Add `GeckoRuntime.reduceMemoryUsage()`
Categories
(GeckoView :: General, enhancement, P2)
Tracking
(firefox66 wontfix, firefox67 fix-optional, firefox68 fix-optional)
Tracking | Status | |
---|---|---|
firefox66 | --- | wontfix |
firefox67 | --- | fix-optional |
firefox68 | --- | fix-optional |
People
(Reporter: JanH, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [geckoview:m93?])
Reporter | ||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Updated•6 years ago
|
I'm elevating this to a P1 because Fenix has multiple tabs and we also have memory-constrained devices for FxTV.
We know we need the app to participate in the memory pressure handling, because it needs to make the decision to close background Session
instances as a first line. Maybe we can simply expose GeckoRuntime.reduceMemoryUsage()
instead of monitoring it in GV ourselves? We would then need to do the backoff ourselves (like re-enabling bfcache). We could expose a similar thing for storage which would cause disk caches to be evicted.
Reporter | ||
Comment 6•6 years ago
|
||
Maybe we can simply expose GeckoRuntime.reduceMemoryUsage() instead of monitoring it in GV ourselves?
In that case (especially if GeckoView will still handle the back-off on its own), repeated calls to reduceMemoryUsage()
within a short time frame should be converted into ongoing memory pressure for Gecko, i.e. what so far I didn't got around doing in bug 1457062.
like re-enabling bfcache
bfcache memory-pressure handling would need to be ported to GeckoView in the first place, though.
Comment 7•6 years ago
|
||
Adding [gvtv:p2] whiteboard tag because Fire TV devices have limited memory and are likely to be affected by memory pressure issues.
Comment 8•6 years ago
•
|
||
Demoting to priority [geckoview:fenix:p2] because Android Q support is not a Fenix MVP release blocker.
Reporter | ||
Comment 9•6 years ago
|
||
This isn't an Android Q issue though, is it?
Comment 10•6 years ago
|
||
(In reply to Jan Henning [:JanH] from comment #9)
This isn't an Android Q issue though, is it?
You're correct. The comment was a copy/paste error, but handling memory pressure is still something we can implement after Fenix MVP.
Comment 11•6 years ago
|
||
Removing bug priority to send this bug back to GV triage for discussion.
Updated•6 years ago
|
Updated•5 years ago
|
Comment 13•4 years ago
•
|
||
:cpeterson, can this bug could have a priority? Its support might reduce memory usage when gecko uses huge memory like Bug 1639280.
I don't think we want GeckoView to handle memory pressure events directly. In a browser, the main thing you want to do in response to a memory pressure event is to close background tabs. GeckoView can't (easily) do that by itself, so instead the app should handle that. Fenix is already doing this today.
We might still want to expose a reduceMemory()
method on GeckoRuntime
, though. This would do the same thing as the "minimize memory usage" in "about:memory". I don't think this would help the situation in Bug 1639280, however.
Reporter | ||
Comment 15•4 years ago
|
||
This would do the same thing as the "minimize memory usage" in "about:memory".
That's not quite the same thing as activating Gecko's memory pressure handling, though, is it? "minimize memory usage" only sends a bunch of "heap-minimize" notifications.
Comment 16•4 years ago
|
||
(In reply to Jan Henning [:JanH] from comment #15)
That's not quite the same thing as activating Gecko's memory pressure handling, though, is it? "minimize memory usage" only sends a bunch of "heap-minimize" notifications.
That's correct, in Fennec however both things were conflated into one: we sent the memory-pressure
events and also used them to discard tabs. I also implemented that using a more generic mechanism in bug 675539 - still tied to memory-pressure
events but had to disable it due to unpleasant issues it was causing. It's behind a pref now so by default sending memory-pressure
events won't unload tabs unless we instruct Firefox or the GeckoView-based application to do so. Regular memory-pressure
events will purge caches, trim database buffers, jettison invisible images and so on.
Comment 17•4 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #13)
:cpeterson, can this bug could have a priority? Its support might reduce memory usage when gecko uses huge memory like Bug 1639280.
I no longer work on GeckoView.
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) (he/him) from comment #14)
I don't think we want GeckoView to handle memory pressure events directly. In a browser, the main thing you want to do in response to a memory pressure event is to close background tabs. GeckoView can't (easily) do that by itself, so instead the app should handle that. Fenix is already doing this today.
We might still want to expose a
reduceMemory()
method onGeckoRuntime
, though. This would do the same thing as the "minimize memory usage" in "about:memory". I don't think this would help the situation in Bug 1639280, however.
snorp, if you don't want GeckoView to handle memory pressure events directly, can this bug be WONTFIX'd? Or do you want to morph this bug into the "Expose a reduceMemory()
method on GeckoRuntime
" feature request?
Comment 18•4 years ago
|
||
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) (he/him) from comment #14)
I don't think we want GeckoView to handle memory pressure events directly. In a browser, the main thing you want to do in response to a memory pressure event is to close background tabs. GeckoView can't (easily) do that by itself, so instead the app should handle that. Fenix is already doing this today.
We might still want to expose a
reduceMemory()
method onGeckoRuntime
, though. This would do the same thing as the "minimize memory usage" in "about:memory". I don't think this would help the situation in Bug 1639280, however.
We need to hook up CC to the OS memory-pressure/killer events. I'm pretty surprised we don't have that hooked up, since that's an MVP criteria for me to avoid users crashing. Do we CC when we close tabs? Phones are memory-poor environments, so this certainly would explain some of the crashes I get, if not.
Hmm so yeah we probably do want to morph this into a bug for exposing GeckoRuntime.reduceMemoryUsage()
. I've changed it.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•