Windows 7 / Page File Disabled / 12 GB RAM / 2+ GB RAM free and "your computer is running low on memory"

7

3

So I am running on Windows 7 (64-bit) Home Premium with 12 GB RAM (Intel Core i7 920).

I have restricted the Page File to 400MB since it was eating up a lot of space om my SSD (that is 80GB).

After that I sometimes get the "low memory"-warning, like this, except for the behold-comment: Low memory warning in Windows 7

When I get those warning I have usually a lot of RAM available; when I check Resource Manager I have over 2GB "Free" and over 2GB "Available" - usually more than that.

The diskspace on all my drives have over 10GB free.

So the question is - why does Windows complain? It actually restarted by computer (hard boot) when it happened, and as I said - lots or RAM available.

Ted

Posted 2011-05-27T07:27:39.190

Reputation: 171

I recon this is a windows issue. Windows Vista and 7 actually cache a lot of the RAM memory. Can you ignore the warning and continue with your normal work or it forces you to close the program? – xciter – 2011-05-27T09:04:32.783

If I am at the computer I can usuallyt press cancel, but that shouldnt be necessary in the first place. Also, it did happen once (when I was not at the computer) that the computer did a hard reboot... – Ted – 2011-05-28T18:38:35.660

Answers

9

Your problem is with Virtual Memory.

Applications ask windows to commit a certain amount of virtual memory to it. This does not mean the application will use all the memory committed, only that Windows promises to make it available if need be. When you look at memory usage only memory actually being used is show, not how much virtual memory has been committed to the process.

The commit limit of windows is RAM plus pagefile, because windows won't make a commitment it can't keep. So you have a commit limit of 12.4GB. Since committed virtual memory that isn't actually used does not occupy any physical space anywhere, applications aren't afraid to ask for large commitments. So it is quite common to have the virtual memory usage a lot larger than the actual memory usage.

As you I've shrunk my pagefile to make more room on my SSD. I set the initial size to 512, but the maximum size to 8GB, just so that windows can grow it if need be. Currently it is 1.4GB so the initial 8.5GB of virtual memory I had hasn't been quite enough.

You can also go hunting down the application that is using all the virtual memory. In task manager set it to show you the commit size of the running processes.

As an example: Catalyst Control Center has a Private Working Set (memory usage) on my machine of 3MB but a Commit Size of 112MB.

Mr Alpha

Posted 2011-05-27T07:27:39.190

Reputation: 6 391

I believe that the memory used for cache is not reused as fast for the real memory needs. If there is lot of RAM, most memory is used for cache most of the times, and any new memory need is not immediately served from the cache leading to the low memory display and unnecessary paging. I did not analyze this, but cannot reason why, in-spite of David's effort to explain the difference between check and money. @David, I think backing store is RAM+Paging size and you seem to explain backing store as something independent of RAM size. – user1969104 – 2014-07-21T22:19:05.000

@user1969104 Your belief is simply false. That's not the issue. The problem is that the OS doesn't have enough backing store to cover all the allocations it's already made, should they all require as much backing store as they might. – David Schwartz – 2014-07-22T16:28:56.863

@David, If the paging file is not present, why can't the OS use RAM itself as the backing store or virtual memory? Why do you think it needs to have an additional file as backing store? – user1969104 – 2014-07-23T05:46:29.533

@user1969104 Because the RAM gets reserved by previous allocations. Say you have no paging file and a process makes a 1GB, private, writable mapping of a file. The OS has no choice but to reserve 1GB of RAM for that mapping, even if the process never writes to that mapping and none of that RAM is ever needed. (Where else can it put those changes but RAM? It can't modify the file because the mapping is private. And it can't write them to the paging file because it doesn't have one.) – David Schwartz – 2014-07-23T16:35:56.840

@DavidSchwartz: You're really good with this stuff, but that answer isn't quite correct. The backing store for a private writeable mapping of a file is simply the mapped file; any changes get written back to the file. That's why such file mappings don't result in increases in commit charge. On the other hand if you make it a "copy on write" mapping (meaning that the original file is left as is, and the OS maintains process-private versions of any modified pages), THAT increases the commit charge. – Jamie Hanrahan – 2014-12-11T19:31:43.567

@JamieHanrahan I think you missed that the mapping was private. If the changes were written back to the file, the mapping would be shared, not private. Private mappings do not need to be copy on write unless another process maps that same file -- modifying the data in memory is fine, it just can't be written back to the file or discarded. It has to be kept in memory or written to the paging file. – David Schwartz – 2014-12-11T19:55:52.323

@DavidSchwartz So a read-only mapping can't be considered shared? That isn't the way I see the terminology. See, there is no declaration in CreateFileMapping or MapViewOfFile for "private" or "shared". There is only copy-on-write, or not. "Shared" or "private" is more or less operational: If there are multiple mappings to the same file (whether via the same mapping object or additional ones) it's shared, otherwise it's private. This is orthogonal to whether any particular mapping is read-only, copy on write, or read/write. These options' effects on commit charge confirm this. – Jamie Hanrahan – 2014-12-12T02:09:16.940

@JamieHanrahan You're bringing up lots of complications that have no relevance to the point I'm making. Regardless of whether the OS uses copy on write or not, if a private, writable file mapping is made, backing store equal to the size of the mapping must be reserved. Whether OSes implement private mappings using copy-on-write or not doesn't affect this. Why are you trying to confuse and complicate such a simple point that's independent of how such mappings are implemented? – David Schwartz – 2014-12-12T10:57:22.450

@DavidSchwartz "Regardless of whether the OS uses copy on write or not, if a private, writable file mapping is made, backing store equal to the size of the mapping must be reserved." No, that's not true. A private (only one process) writeable (not copy on write) file mapping uses the mapped file as the backing store. That's why it isn't charged to commit charge. If another process also maps the file writeable, then it is shared, but it still doesn't need any backing store besides the file. – Jamie Hanrahan – 2014-12-12T11:05:21.067

@JamieHanrahan Private, for a mapping, does not mean "only one process". Punch "private file mapping" into your favorite search engine for nuggets of wisdom like "A file opened with private access can be written to, but the changes will not affect the underlying file." (I think you're confusing the semantics of the mapping with its implementation. The mapping may or may not be implemented with private pages, but that has nothing to do with whether the mapping itself is private.) – David Schwartz – 2014-12-12T11:58:26.520

@DavidSchwartz: Since the question pertains to Windows, I am going by the MSDN pages on CreateFileMapping and MapViewOfFile, which are the APIs in Windows that create mapped regions. Their terminology is as follows: It's private if there's only one process; it's shared if there's more than one. Whether any given mapping is read-only, copy-on-write, or read-write is independent of private vs. shared. http://msdn.microsoft.com/en-us/library/windows/desktop/aa366537%28v=vs.85%29.aspx

– Jamie Hanrahan – 2014-12-12T12:10:16.757

The text you quoted seems to come from the documentation for the Boost C++ libraries. Ok, Boost adopted that terminology... but I don't consider it authoritative vs. the MSDN docs. That's the only reason I started off on this tear: Per the description of CreateFileMapping and MapViewOfFile, a "writeable" (read-write) mapping is backed by the mapped file, whether it's private or not. You are obviously someone who likes to get everything correct, and so I thought you'd appreciate the info. That's all. – Jamie Hanrahan – 2014-12-12T12:36:13.387

@JamieHanrahan I can't find anything that suggests that a mapping is described as "private" if there's only one process. That strikes me as non-standard and even bizarre. Can you point to specifically what makes you think MSDN is describing a mapping as "private" if there's only one process? – David Schwartz – 2014-12-12T12:44:48.080

@David Schwartz The behavior you describe as "private" or "shared" is clearly, in the Windows API, controlled by CreateFileMapping's flProtect arg, which takes values such as PAGE_READONLY, PAGE_READWRITE, or PAGE_WRITECOPY . Also: "Multiple processes can share a view of the same file by either using a single shared file mapping object or creating separate file mapping objects backed by the same file." Behavior of PAGE_WRITECOPY, etc., is not dependent on whether multiple processes are mapping to the same file, only on the flProtect flags (and dwDesiredAccess on the MapViewOfFile call). – Jamie Hanrahan – 2014-12-13T19:13:02.173

@JamieHanrahan Right. So Windows does not have some unusual notion of a "private mapping" meaning one that happens not to have any shared pages at some particular moment in time. That would be awfully strange. – David Schwartz – 2014-12-13T22:35:47.993

Hmm, i will take a look at it nex time it happens... but its weird that windows complains that its low on memory if the apps dont reallyt use it... – Ted – 2011-05-28T18:38:03.477

5The confusion comes from thinking about RAM as memory, when in many ways it isn't. Apps never use RAM, only Virtual Memory; they have no access to the RAM itself. Windows then stores some of the content of Virtual Memory in RAM for performance reasons. It is just one of many things Windows stores in RAM. In reality Widows strives to use all available RAM all the time, for content in virtual memory or to cache other things. So the complaint about memory has nothing to do with RAM. This means you can't even tell how much RAM you need on the basis of how much is used. – Mr Alpha – 2011-05-28T20:31:33.973

Sorry to say that, but the truth is that the windows 7 memory management is poorly written. You cannot disable or have smaller paging file, whatever be the size of RAM. Even if I enable paging file, I do not expect the paging to happen when RAM is still free (or used for cache), unless the memory manager is stupid. – user1969104 – 2014-04-14T11:11:21.780

1@user1969104 The paging doesn't happen, nor it is used for cache. It just needs to be available. The memory manager is being smart and safe. It won't write checks it can't cash, even if it's very unlikely that all its checks will be cashed at once. – David Schwartz – 2014-04-24T17:38:24.433

0

Using a page file so much smaller than your RAM is probably the issue. Windows will be trying to pass idle app memory off onto disk and it'll get upset.

Usually the auto settings work out well, but you do seem to have a high ratio of RAM to disk space so I understand why that may be a problem.

Rory Alsop

Posted 2011-05-27T07:27:39.190

Reputation: 3 168