Closed Bug 607369 Opened 14 years ago Closed 10 years ago

Fennec should shed as much memory as possible when it goes into the background

Categories

(Core Graveyard :: Widget: Android, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: blassey, Unassigned)

References

Details

(Keywords: memory-footprint, mobile)

We frequently get killed off by the OS when we go in the background, requiring us to pay start up costs again when we relaunch.
Assuming we get a notification when we go into the background, an easy start would be to trigger the memory-pressure observers.
(In reply to comment #1) > Assuming we get a notification when we go into the background, an easy start > would be to trigger the memory-pressure observers. The Android code fires the memory-pressure "heap-minimize" notif when the app goes into the background: http://mxr.mozilla.org/mozilla-central/source/widget/src/android/nsAppShell.cpp#341 We do it in "stopping" and not "pausing" The front-end listens and kills off tabs: http://mxr.mozilla.org/mozilla-central/source/mobile/chrome/content/browser.js#315 http://mxr.mozilla.org/mozilla-central/source/mobile/chrome/content/browser.js#2302 But note we only do it when not "heap-minimize", so going into the background won't free up tabs. Also - I don't know if the notif is passed to the child process. That's the place where we really want to free up resources.
just for background, the difference between pausing and stopping is that pausing is when we're no longer visible (for example, when the the screen times out) while stopping is when we're no longer the foreground app.
Accoding to ContentParent.cpp, we do send the memory-pressure notification to the child process: http://mxr.mozilla.org/mozilla-central/source/dom/ipc/ContentParent.cpp#541
Assuming session history gets really good and we have a disk cache, we could just kill the child.
Blocks: 668271
I don't understand what the suggested fix is here. Should we fire memory-pressure on pause? Probably not? Should more things listen to memory-pressure? Perhaps...
(In reply to comment #6) > I don't understand what the suggested fix is here. Should we fire > memory-pressure on pause? Probably not? Should more things listen to > memory-pressure? Perhaps... Bug 666317 adds discarding decoded image data. I wonder if we GC on memory-pressure?
> Bug 666317 adds discarding decoded image data. Yes, although the pref is currently set so we'd discard after 10s anyway...
(In reply to comment #9) > > Bug 666317 adds discarding decoded image data. > > Yes, although the pref is currently set so we'd discard after 10s anyway... The way the pref works, it's 10 to 20 secs. It's possible for Android to kill us in that time.
I see. I'm happy to know the change I made was actually good for something, then!
This bug is very similar to bug 668809.
I don't think this bug is relevant anymore. We do still dispatch the heap-minimize on backgrounding, and there's no content processes in Fennec to worry about any more. Closing.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.