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)
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.
Comment 1•14 years ago
|
||
Assuming we get a notification when we go into the background, an easy start would be to trigger the memory-pressure observers.
Comment 2•14 years ago
|
||
(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.
Reporter | ||
Comment 3•14 years ago
|
||
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.
Comment 4•14 years ago
|
||
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
Comment 5•14 years ago
|
||
Assuming session history gets really good and we have a disk cache, we could just kill the child.
Updated•13 years ago
|
Comment 6•13 years ago
|
||
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...
Comment 7•13 years ago
|
||
(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?
Comment 8•13 years ago
|
||
(In reply to comment #7)
> I wonder if we GC on memory-pressure?
We do:
http://mxr.mozilla.org/mozilla-central/source/dom/base/nsJSEnvironment.cpp#200
Comment 9•13 years ago
|
||
> Bug 666317 adds discarding decoded image data.
Yes, although the pref is currently set so we'd discard after 10s anyway...
Comment 10•13 years ago
|
||
(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.
Comment 11•13 years ago
|
||
I see. I'm happy to know the change I made was actually good for something, then!
Comment 12•13 years ago
|
||
This bug is very similar to bug 668809.
Comment 13•10 years ago
|
||
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
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•