TL;DR Applications used to have their memory usage minimized soon after
their priority had been demoted to the background level. This won't
happen anymore unless we're actually short on memory, so switching
applications is now faster and less prone to flicker/repaint.

Long version:

Bug 1234176 [1] just landed. It alters an age-old behavior we had baked
in FxOS before the 1.0 release to make sure that the user could run at
least 5-6 applications at the same time in the tight memory budget of
the early days.

Before the bug all applications sent to the background would have their
memory aggressively minimized by sending them a memory-pressure event
(originally it was even more aggressive, as we run the GC/CC thrice).
This made sure that backgrounded apps would consume as little memory as
possible but it had significant drawbacks: decoded pictures would be
dropped, surface/layer caches purged and so on. When the app was brought
to the foreground again it would usually need to repaint, possibly
causing flicker, and it would respond slower than it should.

Now thanks to Nuwa and better hardware we have plenty of memory so this
aggressive minimization was hurting performance (and consuming power)
for little gain. I've disabled it and replaced it with a more subtle
mechanism. The Android kernel offers a trigger to detect low-memory
scenarios. We used to set this trigger at a fixed level in order to keep
a single, large foreground application alive when low on memory. I've
modified this mechanism to float the trigger between a "soft" memory
pressure level where apps will be minimized before they get killed by
the LMK and a "hard" one which represents the old behavior.

In short apps will now be able to use as much memory as they want, even
in the background, until we're actually running short of memory. Once we
do, we try to minimize all apps' memory usage first, and if that's not
enough we start to kill them and proceed from there as we did before.

I've updated the documentation under
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Out_of_memory_management_on_Firefox_OS#How_the_LMK_and_low_memory_notifications_work_together
to reflect the new behavior.

 Gabriele

[1] Let applications consume more memory, even in the background, as
long as we're not running out of it
    https://bugzilla.mozilla.org/show_bug.cgi?id=1234176

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos

Reply via email to