Why does Windows claim to be low on memory when I have swap space available?

发布时间 2023-09-28 15:54:08作者: 不及格的程序员-八神
Asked 8 years, 1 month ago
Viewed 1k times
 
5

I have 4GB of RAM. But according to system monitor my PC never uses above 3.1 GB. When it reaches 3.1 GB used apps start to shut down/crash.

Why is that remaining 800MB not used?

I found a few web resources like: The usable memory may be less than the installed memory on Windows 7-based computers

But my PC does not say anything about usable memory. It's only 4GB and not limited.

Also found few other questions here, but every one has usable part displayed. And my PC does not show it.

 

I get the following error almost constantly:

 

Shouldn't it use swap instead of issuing errors?

Just a thought: I have less than 10% free space on disks, and they're red. It's still plenty of space on HDD, but maybe Windows then tries not to use swap?

Memory monitor: 

 

Also, a screenshot of how swap file looks like when errors appear: 

 

  • 1
    The loaded OS needs RAM, likely to be the 800MB that you are "missing". 
    – Hannu
     Aug 24, 2015 at 14:36
  • 2
    @DragonLord read carefully. First of all its 64-bit. Secondly, sees all memory 
    – Gacek
     Aug 24, 2015 at 15:15
  • 2
    @qasdfdsaq Reopening is possible in both the pending and closed states. I have edited this question to try to make it more clear that it is not asking the same thing as the other questions. Also I have cast a vote to reopen this question. If this question is asked again as a new question, there is some risk of confusion because the new question could be considered a duplicate of this question.   Aug 25, 2015 at 16:26
  • 2
    @Gacek What makes you sure your swap file isn't being used? The image you posted of Task Manager's Performance tab indicates have 10 GB of Committed RAM. If this question were open right now I'd post an answer stating that you don't have 800 MB free RAM and that your swap file isn't large enough to accommodate your system's memory demand.   Aug 25, 2015 at 19:37
  • 1
    @twisty In other words, everything is normal here. Only things to do are to free up some hard drive space and/or add more RAM chips.   Aug 25, 2015 at 20:49

1 Answer

6
 

You really are out of memory (virtual memory, that is)

Take a look at your the Commit Charge as highlighted in your Task Manager screen shot:

enter image description here

First number = Current commit
Second number = Commit limit

According to this Super User answer:

The commit limit = current pagefile size + RAM size - RAM permanently allocated to nonpageable memory.

This is a hard limit: Windows cannot grant requests by programs for more memory beyond it. This screen shot indicates you have 10 GB of a possible 10 GB allocated to programs. This is triggering the "Out of memory" message.

What to do?

  1. Install more physical RAM. This will increase your Commit Limit accordingly and improve your computer's performance.

  2. Increase the size of your page file. This too will increase your Commit Limit, but because paging slows down a computer, don't expect any performance benefit.

  3. Close programs that are using the most memory. You can return to the Memory tab in Resource Monitor and sort the processes by the Commit (KB) column to see which ones are having the greatest impact on your memory use. Perhaps you have a program that's using too much memory that can be closed. Be aware that "The total commit charge will always be larger than the sum of these values, as the total includes system-wide allocations such as the paged pool." (Source)

  •  
    Increased paging size limit. 4GB RAM + 10000MB Pagefile (init size) gave me x/13GB commit size. Hope this will suffice for now. But thanks to this i know (or think) now I could utilize even 16GB of RAM. Getting new spec soon and plan to make it 16GB + space for additional 16GB just in case. My current system is 2/2 RAM slots. Very much thank you for your answer. Didnt know what this filed was before. 
    – Gacek
     Aug 26, 2015 at 14:55
  • 1
    Correct. Commit is the total amount of comitted memory that has been requested but not necessarily used. A lot of applications speculatively request more memory than actually needed but this all has to be physically backed somewhere, i.e. with RAM or a pagefile. In extreme cases you could have a program that requires 100MB request 100GB ,and you would need a 100GB pagefile to run it.   Aug 26, 2015 at 15:17
  • 1
    @Twisty Acually what DanielB said is clearer to me. I may not be windows memory management spec. I'm just a simple webapp programmer and don't care about how windows manages memory. Only care for apps to take as less as possible. And app allocating memory means to me that it takes this memory and it belongs to this app only. 
    – Gacek
     Aug 26, 2015 at 17:34
  • 1
    @Gacek Fair enough. The very reason we have community is so multiple perspectives can bring about the clearest information.   Aug 26, 2015 at 17:37 
  • 1
    Just to note: setting initial level of swap file (my windows does not like to allocate to higher limit and system controlled option fails here. It didn't want to go beyond certain point) high solves all my out of memory errors. Thank you @Twisty :) 
    – Gacek
     Aug 27, 2015 at 16:58

问 8 年零 1 个月前
观看 次数 1,000 次
 
5

我有 4GB 内存。但根据系统监视器,我的电脑从未使用过 3.1 GB 以上的内存。当达到 3.1 GB 时,使用过的应用程序开始关闭/崩溃。

为什么剩下的 800MB 没有被使用?

我发现了一些网络资源,例如:可用内存可能小于基于 Windows 7 的计算机上安装的内存

但我的电脑没有提及任何有关可用内存的信息。只有4GB,而且没有限制。

在这里还发现了一些其他问题,但每个问题都显示了可用的部分。而我的电脑不显示它。

系统控制面板图像

我几乎不断地收到以下错误:

内存不足错误图像

难道它不应该使用交换而不是发出错误吗?

只是想一想:我的磁盘上的可用空间不到 10%,而且它们是红色的。HDD 上仍然有足够的空间,但 Windows 可能会尝试不使用交换空间?

内存监视器:内存监控图像

另外,出现错误时交换文件的样子的屏幕截图: 在此输入图像描述

  • 1
    加载的操作系统需要 RAM,可能是您“缺少”的 800MB。 
    – 汉努
     2015 年 8 月 24 日 14:36
  • 2
    @DragonLord 仔细阅读。首先它是 64 位的。其次,查看所有内存   2015 年 8 月 24 日 15:15
  • 2
    @qasdfdsaq 在挂起和关闭状态下都可以重新打开。我编辑了这个问题,试图更清楚地表明它并没有问与其他问题相同的事情。我也投票重新讨论这个问题。如果将此问题作为新问题再次提出,则存在一些混淆的风险,因为新问题可能被视为此问题的重复。   2015 年 8 月 25 日 16:26
  • 2
    @Gacek 什么让你确定你的交换文件没有被使用?您发布的任务管理器“性能”选项卡的图像表明有 10 GB 的承诺 RAM。如果这个问题现在开放,我会发布一个答案,指出您没有 800 MB 可用 RAM,并且您的交换文件不够大,无法满足系统的内存需求。   2015 年 8 月 25 日 19:37
  • 1
    @twisty 换句话说,这里一切正常。唯一要做的就是释放一些硬盘空间和/或添加更多 RAM 芯片。   2015 年 8 月 25 日 20:49

1 个回答

6
 

你确实内存不足(即虚拟内存)

查看任务管理器屏幕截图中突出显示的提交费用:

在此输入图像描述

第一个数字 = 当前提交
第二个数字 = 提交限制

根据这位超级用户的回答

提交限制 = 当前页面文件大小 + RAM 大小 - 永久分配给不可分页内存的 RAM。

这是一个硬性限制:Windows 无法授予程序对超出该限制的更多内存的请求。此屏幕截图表明您有 10 GB,其中可能有 10 GB 分配给程序。这会触发“内存不足”消息。

该怎么办?

  1. 安装更多物理 RAM。这将相应地增加您的提交限制并提高您的计算机的性能。

  2. 增加页面文件的大小这也会增加您的提交限制,但由于分页会减慢计算机的速度,因此不要指望任何性能优势。

  3. 关闭使用最多内存的程序。 您可以返回资源监视器中的“内存”选项卡,并按列对进程进行排序Commit (KB),以查看哪些进程对内存使用影响最大。也许您的程序使用了太多内存,可以将其关闭。请注意,“总提交费用将始终大于这些值的总和,因为总数包括系统范围的分配,例如分页池。” 来源

  •  
    增加分页大小限制。4GB RAM + 10000MB 页面文件(初始化大小)给了我 x/13GB 提交大小。希望现在就足够了。但多亏了这一点,我知道(或认为)现在我什至可以利用 16GB 的 RAM。尽快获得新规格并计划将其设为 16GB + 额外 16GB 空间以防万一。我当前的系统是 2/2 RAM 插槽。非常感谢您的回答。之前不知道这个文件是什么。   2015 年 8 月 26 日 14:55
  • 1
    正确的。提交是已请求但不一定使用的提交内存总量。许多应用程序推测地请求比实际需要更多的内存,但这一切都必须在某个地方进行物理支持,即使用 RAM 或页面文件。在极端情况下,您可能有一个需要 100MB 请求 100GB 的程序,并且您需要 100GB 页面文件来运行它。   2015 年 8 月 26 日 15:17
  • 1
    @Twisty Acually DanielB 所说的对我来说更清楚。我可能不是windows内存管理规范。我只是一个简单的webapp程序员,并不关心windows如何管理内存。只关心应用程序占用尽可能少的资源。分配内存的应用程序对我来说意味着它占用该内存并且仅属于该应用程序。   2015 年 8 月 26 日 17:34
  • 1
    @Gacek 足够公平了。我们拥有社区的原因是多个视角可以带来最清晰的信息。   2015 年 8 月 26 日 17:37 
  • 1
    只是要注意:设置交换文件的初始级别(我的Windows不喜欢分配到更高的限制,系统控制选项在这里失败。它不想超出某个点)高可以解决我所有的内存不足错误。谢谢你@Twisty:)   2015 年 8 月 27 日 16:58