NEW 291369
Figure out a way to implement idle tab discarding (unloading tabs from RAM) to reduce memory usage on Linux
https://bugs.webkit.org/show_bug.cgi?id=291369
Summary Figure out a way to implement idle tab discarding (unloading tabs from RAM) t...
Jeff Fortin
Reported 2025-04-10 07:38:31 PDT
Given how I work on multiple projects in parallel in the day-to-day and have dozens (if not hundreds) of tabs open in any tab workspace (see also https://gitlab.gnome.org/GNOME/epiphany/-/issues/1835 regarding workspaces), one of the things that has become indispensable for me, even with large amounts of RAM (ex: 24 GB), is the ability for the browser to auto-unload (a.k.a. "discard") tabs from RAM when unused for a long time and too many are open. Currently, you can achieve this on Firefox (and now Chrome, by default). Some reference material: * https://support.mozilla.org/en-US/kb/unload-inactive-tabs-save-system-memory-firefox * https://hacks.mozilla.org/2021/10/tab-unloading-in-firefox-93/ * https://addons.mozilla.org/en-US/firefox/addon/auto-tab-discard/ This saves tremendous amounts of RAM (and, in Firefox's case, CPU) in practice. Apple gave up on that idea in macOS, from what I heard and from what I can see in bug #162865, where they say: > […] they page out to disk and stay there That sounds a lot like the kind of "tab unloading" I'd want on Linux, too, but I don't seem to be seeing it in practice? In any case, any form of tab unloading from would be needed on Linux, given how horrible Linux is as handling out-of-memory conditions. In the case of browsers like Epiphany, this would also mitigate the problem of inotify handles (see https://gitlab.gnome.org/GNOME/epiphany/-/issues/1454) Would it be possible/feasible for WebKitGTK to empower WebKitGTK-based browsers to: * do the same thing as Safari's WebKit (paging out the whole thing to disk) but configurably by the browser's built-in UIs (and/or webextensions like "Auto Tab Discard"; the request for API for that is bug #265970), and much more aggressively by default? * otherwise would it be possible for it to completely unload like Chrome and Firefox do? I don't see how those browsers could scale for lots of tabs otherwise. Merely opening 15 tabs eats 5-6 GB of RAM until you fully close them…
Attachments
Jeff Fortin
Comment 1 2025-04-10 07:53:29 PDT
A reason why the web browser client app (and/or extension) would need the flexibility to control this beyond automatic idle websites "process suspending" is also that it is very useful for users to be able to tell the browser to aggressively unload hogs like Reddit and YouTube tabs (when they don't have unsaved forms changes etc.), while keeping "safe" (ex: work intranet, chat system) tabs allowlisted.
Jeff Fortin
Comment 2 2025-04-10 10:05:53 PDT
Previous requests downstream where some preliminary discussion had occurred a long time ago: * https://gitlab.gnome.org/GNOME/epiphany/-/issues/213 * https://gitlab.gnome.org/GNOME/epiphany/-/issues/233
Michael Catanzaro
Comment 3 2025-04-10 11:24:59 PDT
Notably the history in https://gitlab.gnome.org/GNOME/epiphany/-/issues/213#note_368485 is quite important. This feature was previously added in bug #150515 and removed in bug #154585. Hard to believe it's been nearly a decade. I was hoping to see some sort of explanation of what problems were encountered, but I guess whoever attempts this will need to rediscover those....
Jeff Fortin
Comment 4 2025-06-25 10:25:43 PDT
As an additional point of reference, in addition to the API for webextensions, Firefox 140+ now has explicit/manual (and automatic, I think) tab unloading as a core feature too: * https://www.mozilla.org/en-US/firefox/140.0/releasenotes/ * https://support.mozilla.org/en-US/kb/unload-tabs-reduce-memory-usage-firefox
Note You need to log in before you can comment on or make changes to this bug.