火狐 清理缓存_Firefox内存清理程序确实可以工作吗?

火狐 清理缓存

火狐 清理缓存

image
()

It is no secret that Firefox can consume quite a bit of system memory during normal usage. While the number of tabs you have open and the installed add-ons certainly contribute, even a conservatively used out of the box installation can report quite a bit of memory usage.

Firefox在正常使用期间会消耗大量系统内存已不是什么秘密。 尽管您打开的选项卡数量和已安装的加载项肯定会有所贡献,但是即使保守地使用开箱即用的安装也可以报告相当多的内存使用情况。

This has caused a few Firefox add-ons to surface which claim to free up memory the browser no longer needs, but do they actually work?

这导致了一些Firefox附加组件浮出水面,这些附加组件声称可以释放浏览器不再需要的内存,但是它们确实有效吗?

Windows如何处理内存的两分钟概述 (A Two Minute Overview on How Windows Handles Memory)

image

Before we dive into examining a memory cleaner, it is important to understand a little bit about the way Windows handles memory. This will be important so we can interpret the results of our experiment.

在我们深入研究内存清理器之前,重要的一点是要了解Windows处理内存的方式。 这很重要,因此我们可以解释我们的实验结果。

Don’t worry, we will cover this at a very high level so you don’t have to be a mega-geek to follow along.

不用担心,我们将在一个非常高的水平上对此进行介绍,因此您不必一定要成为一个超级怪胎。

As a quick disclaimer, this is an extremely brief summary of the very basics of Windows memory management. By no means should this be considered authoritative or definitive as it is only explained to level applicable to the subject matter of this article.

快速免责声明,这是Windows内存管理基础知识的非常简短的摘要。 绝不应该将其视为权威或权威的,因为仅在适用于本文主题的水平上进行了解释。

Windows is smart enough to know that unused physical memory is wasted memory, so it loads everything it needs and thinks it will need into memory. However, only what your system actually needs (both Windows and applications) and is actively using at the current time is reported as used physical memory. The rest (what Windows thinks it will need) resides in what is called virtual memory.

Windows足够聪明,可以知道未使用的物理内存是浪费的内存,因此它可以将所需的所有内容加载到内存中,并认为需要。 但是,只有系统实际需要的(Windows和应用程序)并且当前正在积极使用的才被报告为已用物理内存。 其余的(Windows认为将需要的)驻留在所谓的虚拟内存中。

Virtual memory is essentially the data which is not actively required by the OS but is ready to be loaded into active memory at any time. You can very crudely calculate the amount of virtual memory your system has at any one time using this formula:

虚拟内存本质上是OS主动不需要的数据,但随时可以将其加载到活动内存中。 您可以使用以下公式非常粗略地计算系统随时具有的虚拟内存量:

Virtual Memory = (Total Physical Memory – Used/Active Physical Memory) + Maximum System Page File Size

虚拟内存=(总物理内存–已用/活动物理内存)+最大系统页面文件大小

So, suppose you have a system with 4 GB of physical memory and a 6 GB maximum page file. You then boot up Windows and open a few applications (Outlook, Firefox, etc.) and Windows reports that 2.5 GB of physical memory is being used. This means you have 1.5 GB of “unused” physical memory and a 6 GB page file for a total of 7.5 GB of available virtual memory.

因此,假设您的系统具有4 GB的物理内存和6 GB的最大页面文件。 然后,您启动Windows并打开一些应用程序(Outlook,Firefox等),然后Windows报告正在使用2.5 GB的物理内存。 这意味着您拥有1.5 GB的“未使用”物理内存和6 GB的页面文件,总共有7.5 GB的可用虚拟内存。

Remember, the OS is smart enough to know that unused physical memory is wasted memory, so it will fill the remaining 1.5 of physical memory with what it anticipates you will need so it can be accessed on demand almost instantaneously. This can be anything from minimized background program data to common OS functions.

请记住,该操作系统足够聪明,可以知道未使用的物理内存就是浪费的内存,因此它将用您期望的数量填充剩余的1.5物理内存,因此可以几乎即时地按需访问它。 从最小化的后台程序数据到常见的OS功能,这可以是任何东西。

So what happens when Windows runs out of physical memory to use as virtual memory? It writes this data to the system page file which is a huge (in our case 6 GB) file on your hard drive. While this allows for the OS to store pretty much any data it needs to keep in memory, writing and retrieving (aka a page fault) this information to/from the hard drive is orders of magnitude slower than accessing it from physical memory. This is why the more physical memory you have the faster your system can run. The less your system uses its page file, the faster it will perform.

那么当Windows用尽物理内存用作虚拟内存时会发生什么呢? 它将这些数据写入系统页面文件,该文件是硬盘驱动器上的一个巨大文件(在我们的情况下为6 GB)。 尽管这允许操作系统将几乎所有需要保留的数据存储在内存中,但将信息写入硬盘或从硬盘读取信息(又称页面错误)要比从物理内存访问信息慢几个数量级。 这就是为什么您拥有的物理内存越多,系统运行速度就越快的原因。 系统使用其页面文件的次数越少,执行速度就越快。

监视Firefox的内存使用情况 (Monitoring Firefox’s Memory Usage)

For our investigation we will simply be using Windows Task Manager. We will be tracking the following columns (the descriptions are defined on Microsoft’s page):

为了进行调查,我们将仅使用Windows Task Manager。 我们将跟踪以下各列(说明在Microsoft页面上定义):

  • Working Set = Amount of memory in the private working set plus the amount of memory the process is using that can be shared by other processes.

    工作集=专用工作集中的内存量加上该进程正在使用的可由其他进程共享的内存量。
  • Peak Working Set = Maximum amount of working set memory used by the process.

    峰值工作集=进程使用的最大工作集内存量。
  • Memory (Private Working Set) = Subset of working set that specifically describes the amount of memory a process is using that cannot be shared by other processes.

    内存(专用工作集)=工作集的子集,专门描述一个进程正在使用的内存量,其他进程无法共享该内存。
  • Commit Size = Amount of virtual memory that is reserved for use by a process.

    提交大小=保留供进程使用的虚拟内存量。
image

We will be using an out of the box installation of Firefox 4.0.1 with only the Memory Fox add-on loaded. In Firefox, we will have the following tabs open and will not do anything other than scroll up and down the loaded pages.

我们将使用现成的Firefox 4.0.1安装,仅加载Memory Fox附加组件。 在Firefox中,我们将打开以下标签,除了向上或向下滚动加载的页面外,不会执行其他任何操作。

image

After waiting a few moments for everything to finish loading, Windows Task Manager reports the following for Firefox.

等待片刻之后,Windows任务管理器报告了Firefox的以下内容。

image

Now when we start the Memory Fox add-on, look at the dramatic drop in the amount of reported memory use.

现在,当我们启动Memory Fox附加组件时,请看一下报告的内存使用量的急剧下降。

image

Also take note that a new process is started by this add-on which is what handles the memory functions.

还请注意,此加载项将启动一个新过程,该过程将处理内存功能。

image

Leaving Firefox idle and watching the Working Set and Memory values, you can see there is a constant struggle between Firefox needing active physical memory and the memory cleaner add-on reclaiming this memory.

让Firefox保持空闲状态并查看“工作集”和“内存”值,您会发现Firefox需要活动的物理内存与回收该内存的内存清理程序附件之间始终存在争斗。

Here is the reported memory usage taken every few seconds while Firefox is left idle.

这是Firefox闲置时每几秒钟报告的内存使用情况。

image
image

Note the drop in the Working Set and Memory values. This the is memory cleaner reclaiming the system memory.

请注意工作集和内存值的下降。 这是内存清理器,回收系统内存。

image
image
image

After going up for a bit, you can see another drop.

上升一段时间后,您可以看到另一个下降。

image
image
image

Lather. Rinse. Repeat.

泡沫。 冲洗。 重复。

Additionally, if you do nothing but switch tabs and scroll up and down the loaded pages, you can see the numbers fluctuate a bit more drastically which will be explained below.

此外,如果除了切换选项卡并在已加载的页面上上下滚动外什么都不做,您会发现数字波动更大,下面将对此进行说明。

解释结果 (Interpreting the Results)

When you first look it, you would think, hey this is working great. But take a look at the Commit Size column and you can see that this value never really changes. In fact is goes up once you start the memory cleaning add-on.

当您初看它时,您会认为,嘿,这很好。 但是,看看“提交大小”列,您会发现该值从未真正改变过。 实际上,一旦启动内存清理插件,它就会上升。

Remember, the Commit Size column reports the actual amount of memory (physical + virtual) Windows needs to run the respective application. So in our example, the ~120 MB is reserved and active on the system specifically for Firefox and is residing in either unused physical memory and/or the system page file. Also remember that if the page file needs to be used, there is a noticeable performance impact because the virtual memory has to be written to and read from the hard disk which is significantly slower than physical memory.

请记住,“提交大小”列报告了Windows运行相应应用程序所需的实际内存量(物理+虚拟)。 因此,在我们的示例中,〜120 MB在专用于Firefox的系统上保留并处于活动状态,并且驻留在未使用的物理内存和/或系统页面文件中。 还请记住,如果需要使用页面文件,则会对性能产生明显影响,因为必须将虚拟内存写入硬盘或从硬盘读取虚拟内存,这比物理内存要慢得多。

So essentially the memory cleaner is moving active physical memory to virtual memory (because the memory is reclaims has to go somewhere). When this happens, Firefox no longer has the memory it needs to function actively available so it has to ask Windows to move the respective data it needs from virtual memory back to physical memory.  And around and round we go…

因此,从本质上讲,内存清理器会将活动的物理内存移至虚拟内存(因为回收内存必须到某个地方)。 发生这种情况时,Firefox不再拥有其需要活动可用的内存,因此它必须要求Windows将所需的相应数据从虚拟内存移回物理内存。 到处走走…

At best, this process does nothing useful at all and at worst it causes a massive amount of unneeded page faults because, again, if Windows has to bring the page file into play then there is going to a noticeable performance hit. This can especially be the case on system which do not have much physical memory (where pretty much all virtual memory is kept in a page file), which is ironic because these are the systems a memory cleaner was “designed” for.

最好的情况是,此过程根本没有任何用处,最坏的情况是会导致大量不必要的页面错误,因为如果Windows必须发挥页面文件的作用,那么性能将受到明显影响。 在没有太多物理内存(几乎所有虚拟内存都保存在页面文件中)的系统上,尤其是这种情况,具有讽刺意味的是,因为这些是为内存清理器“设计”的系统。

The moral of this whole story is quite simply, memory cleaners do nothing but shift around numbers. Any OS is going to know how to handle memory appropriately, so just let them do their thing.

整个故事的寓意很简单,内存清理人员除了在数字周围移动外什么也不做。 任何操作系统都将知道如何适当地处理内存,因此只要让他们做自己的事即可。

管理Firefox的内存使用情况 (Managing Firefox’s Memory Usage)

Since we have shown that memory cleaning add-ons do not really do anything useful, what can you do about the large amount of memory Firefox uses? Here are a few suggestions:

既然我们已经证明内存清理附加组件并没有真正有用的功能,那么对于Firefox使用的大量内存该怎么办? 这里有一些建议:

  • Remove add-ons you don’t need (especially any memory cleaning ones).

    删除不需要的加载项(尤其是所有内存清理的加载项)。
  • Keep the number of tabs you have open to a minimum.

    将您打开的标签数保持最少。
  • Periodically close Firefox and relaunch it.

    定期关闭Firefox并重新启动。
  • Add more memory to your system.

    向系统添加更多内存。
  • Don’t worry about it.

    不用担心

Memory Fox Next Add-on for Firefox

Memory Fox Next Firefox附加组件

翻译自: https://www.howtogeek.com/62301/htg-explains-do-firefox-memory-cleaners-actually-work/

火狐 清理缓存

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值