- 封存
Gracefully handle memory exhaustion
I really want to use firefox. I really do. But firefox's memory management is making that very difficult. I have 8GB of RAM, which really ought to be enough, but inevita… (閱讀更多)
I really want to use firefox. I really do. But firefox's memory management is making that very difficult.
I have 8GB of RAM, which really ought to be enough, but inevitably, over time, firefox will munch and munch and munch until it has consumed all of it.
And then... my system crashes. I lose work. I get angry.
Well, okay, I use linux, so after this happened a few times I stuck firefox in a systemd scope and limit it to 90% of the memory of my system. At first, that didn't work because firefox would simply eat into the pagefile, until it had consumed all of it (or as much as I entitled it to), at which point firefox would desperately try to do.... something, very frantically, which would lock the CPU usage to 100%, again bringing down the system. So I limit its RAM and prohibit it from using the pagefile, and now, it's just firefox that dies.
....
But, really, that's still a problem. I still have emails partially written, forms filled out, work is still lost. Is it really so abhorrent to take out the trash that you'd rather just commit suicide instead? I say take out the trash, because firefox will restart, reload those very same tabs, and carry on with a fraction of the memory usage. Something's been dropped, and it wasn't important (well, other than the content of that email I've been composing for the last half hour).
So. If I'm going to continue using firefox, which I would very much like to do, there needs to be some way for it to gracefully say to the user: "I've run out of available memory. I'm going to have to..." (for example) 1. perform garbage collection (do whatever 'minimize memory use' seems to do... which is not much, but something that really ought to be the default action in this situation) 2. clear the buffer of some videos being played, or some cached results or something, i dunno. 3. gracefully stop loading the current tab, or process, or whatever, and say to the user "I've run out of resources to continue. Please choose one or more tabs to close in order to continue"
Then, at least, I can sacrifice my background music tab, or something else unimportant, to buy enough time to copy that email into notepad, submit that form, or just run 'minimize memory usage', and be able to carry on.