为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Gracefully handle memory exhaustion

more options

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.

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.

由ymousa85+firefox于修改

所有回复 (6)

more options

I understand your frustration with Firefox's memory management. Here are some suggestions that might help:

Disable or remove unnecessary extensions/add-ons: Sometimes, extensions and add-ons can consume a lot of memory. Try disabling or removing any that you don't use frequently.

Reduce the number of open tabs: Having too many tabs open can also use a lot of memory. Try closing tabs that you don't need at the moment.

Use Firefox's built-in task manager: Firefox has a built-in task manager that allows you to see which tabs and add-ons are using the most memory. You can access it by pressing Shift+Escape. From there, you can close any tabs or add-ons that are using too much memory.

Increase Firefox's content process limit: Firefox uses a "multi-process" architecture that isolates tabs and add-ons into separate "content processes." By default, Firefox limits the number of content processes it uses to conserve memory. However, you can increase this limit by going to Firefox's settings (about:preferences), clicking on "Performance" and then changing the "Content process limit" to a higher number.

Use a lightweight theme: Firefox's default theme can consume more memory than a lightweight theme. You can find lightweight themes in Firefox's add-ons store.

Consider using a memory management add-on: There are several add-ons available in Firefox's add-ons store that claim to improve memory management. You can try one of these add-ons and see if it helps.

I hope these suggestions help improve Firefox's memory management for you.

more options

That was a very quick reply, with what I'm sure is an answer that has been given many times. Which, to be honest, demonstrates how common this problem is.

Regardless, I have done all of those things, but the fact remains that firefox will grow and grow until it explodes. You can slow that growth, but you cannot stop it, and it will end in catastrophic failure. That's the problem here, and no amount of disabling extensions and lightweight theming is going to fix that.

由ymousa85+firefox于修改

more options

Hi

Have you considered updating to the current version of Firefox? The version you appear to be using dates from 2021.

more options

Is your Linux distribution still supported or has it reached EOL ?

You can look at the Firefox from the official Mozilla server if you currently use a version from the repositories of your Linux distribution to see if it behaves differently.

more options

I've had this issue almost as long as I've used firefox; at the least I have notes here from version 87 all through to version 111. It's happened on the last 3 OS updates I've had, from debian 9, 10 and 11. I've tried debian repository versions, EOL versions, upstream repository versions and appimages. Unless something drastically changes in the way firefox handles memory, I'm not expecting it to just go away any time soon.

由ymousa85+firefox于修改

more options

I've updated firefox again, i'm still having this. With just 3 tabs open firefox is using 2.3GB of RAM. Running 'Minimize memory usage' on `about:memory` does nothing, but closing and re-opening firefox reduces the memory usage by 665MB. Incidentally firefox's process manager leaves 750MB unaccounted for compared to the system task manager.

2.3GB may not sound like much, but nearly 30% of that was apparently unnecessary cruft that firefox wouldn't let go of without a restart. With more tabs and more time, i'm routinely finding that number creeping up to 6-7GB on a machine that only has 8GB available. And then the machine locks up. The oft-quoted "unused RAM is wasted RAM, firefox will let go of it if it needs to" isn't true; FF doesn't let go of it, other applications are paging when they shouldn't have to affecting performance, and eventually when there's no more page file left, the whole machine locks up. Routinely closing and re-opening the application to force it to release memory should not be a requirement of any properly functioning application....

由ymousa85+firefox于修改