atlas-engineer / nyxt

Nyxt - the hacker's browser.
https://nyxt-browser.com/
9.82k stars 411 forks source link

Infinite buffer count: automatic webview unloading/reloading #366

Open Ambrevar opened 5 years ago

Ambrevar commented 5 years ago

One of the biggest flaws that plagues modern browsers is how much memory they eat. Users tend to leave dozens of tabs open until the system runs out of memory. Users should not have to worry about that. Next could be different here.

The idea is to automatically unload the old buffer webviews from memory, only reloading them on demand. Buffers would be unloaded after a threshold is reached, e.g. after some amount of memory has been alocated, or some number of buffers is used.

This way the user could easily have hundred of buffers, while only some 20-30 of them are loaded.

This brings up the concept of "live buffers" vs. "dead buffers". A dead buffers only takes a couple of KiB in memory, while a live buffer, well, probably a couple of MiB. In order to restore a dead buffer to its previous state, we need to collect some informaton:

Of course not all buffers can be reloaded into the same state. For instance some HTML5 video players or games may not support this. For this reason, I suggest we leave it to the user to customize their "whitelist" of URLs that ought not to be unloaded.

Once this is implemented, #365 could store "dead buffers" instead of only the (name title) pairs.

easbarba commented 5 years ago

I think Firefox/Chrome in Mobile System do something similar.

As user call an early opened tab it has to reload it all again, as if that tab was "dead" and firefox only kept their URI.

Looking forward!

aartaka commented 2 years ago

I thought that loading about:blank in the buffer could lessen the RAM footprint, as all the JavaScript handling will basically disappear. I even implemented a prototype, to no avail -- RAM usage was more or less the same, when loading about:blank into dormant buffers.

There are several other ways that could work for RAM preservation: