Project 256meg and tab zombification

The main thing that I'm working on these days is "Project 256meg" (aka bug 792131). The goal of the project, as the name implies, is to get Fennec working well on phones with only 256 MiB of memory. There are a large number of older ARMv6 Android devices out there which have less than the 512 MiB of memory that we currently require for Fennec. Having Fennec run well on these devices would allow all of those people to use it as well.

One of the changes I landed recently was to "zombify" tabs under certain conditions. Zombifying a tab unloads the content loaded in the tab, thereby freeing up most of the memory associated with that tab. The tab itself remains, and remembers the URL it was on, so that when the user switches to it, it will resurrect itself by re-loading the content. The behaviour is quite similar to what Android itself does with activities - it will close activities in the background silently if needed, and open them again if the user switches back to them.

In bug 784040 we added code that zombifies all of the background tabs when we get a low-memory event from the system. In bug 792143 and bug 803575, we added some additional conditions to zombify individual tabs to prevent excessive memory usage before it happens. Specifically, when a new tab is opened, the least-recently-used background tab is zombified, if it hasn't been used in some amount of time (controlled by the browser.tabs.expireTime pref; defaults to 1 hour; -1 to disable). This behaviour is enabled by default on low-memory devices and is turned on dynamically on high-memory devices after we receive the first low-memory event on those devices.

I'm planning to also add some telemetry to see how often these events get triggered in practice, so that we can tune the behaviour as we go. However if you feel like your tabs are getting turned into zombies too often for your liking, let me know (either file a bug or comment here) and we can investigate.

Posted by Merike at 2012-11-02 16:26:42

Is it known how many of these older phones support OpenGL ES 2.0? This requirement prevents even phones having a bit more memory than 256MB running Fennec :(

Not all of them, it's true. However there are still a good chunk of phones that do support OpenGL ES 2.0 and have less than 512 MiB of memory. There's not a lot of hard data out there, but a lot of the globally "most popular Android phones" fall into this category.

Relaxing the OpenGL ES 2.0 requirement is unfortunately going to be pretty hard given how we've implemented Fennec.

Can this land for the desktop browser as well? This along with load tabs on demand would make a huge difference in Firefox's memory usage, which will go a long way towards mending FF's reputation of being a memory hog.

Additionally, unloading background tabs will ensure that any Flash content on background tabs does not slow down the foreground/most recently used tabs.

I wanted to request the same, but please keep in mind that some people would prefer to have this feature turned off by default.

Some people use the web to steam audio to their speakers while surfing on other tabs. If we will freeze their audio streaming tab without prior notification, they may use another browser which won't kill background tabs.

Another use case is sites such as Facebook, Gmail and Twitter which periodically reload data from the server in order to show notifications to the user. I think that for these sites it'd be best if we could somehow prioritize background threads (Web Workers) so instead of having the whole site fully functional we could turn off only idle threads.