Why is Win7x64 seemingly ignoring my virtual memory (out of memory error and app termination when RAM limit reached)
UPDATE: I'm now 95% certain it is firefox.exe running out of virtual memory (vs working set) - don't know how to solve it though.
I have 10GB physical RAM in my system, and virtual memory configured for 9GB minimum, 14GB maximum.
I am constantly plagued with "out of memory" warnings which I typically ignore, but eventually it will get bad enough and Windows will ungracefully terminate and application, or Firefox will crash on its own. If I pull up task manager and check memory usage when this occurs, I am always in the neighborhood of 10GB.
To me this implies either:
a) Windows is completely ignoring the configured virtual memory
b) The error is actually from a single 32 bit application hitting the upper 2 GB limit (http://stackoverflow.com/questions/639540/how-much-memory-can-a-32-bit-process-access-on-a-64-bit-operating-system), but whenever an errors occurs, the largest single consumption is Firefox at ~1.6 GB, ruling this out I would think.
Does anyone know what could possibly be going on here??
EDIT:
Here's something interesting. Running msinfo32.exe, I see:
Installed Physical Memory: 10GB
Available Physical Memory: 1.43GB
Total Virtual Memory: 20.7GB
Available Virtual Memory: 3.42GB
Page File Space: 10.7GB
This is a bit confusing..."Total Virtual Memory" must (I guess) represent "Installed Physical Memory" + "Page File Space"
If so, or even if not, why does "Available Virtual Memory" say 3.42GB when if I look in Task Manager, I am only currently using 8.58GB? (Which is consistent with "Available Physical Memory", and seems to confirm my theory that Windows is not using virtual memory, although according to msinfo32.exe, not only is it using virtual memory, it is currently "using" a lot of it.)
I've added the "Commit Size" column to task manager, and while the usage numbers there are indeed a bit higher than Working Set, it seems to generally be about 20% higher, so in no way could exceed my physical + virtual.
Something really doesn't make sense here.
EDIT 2: So loaded up a few instances of Chrome and loaded some heavy pages, enough to push through the remaining physical RAM, and no crash yet. However, Available Virtual Memory in msinfo32.exe now shows Available Virtual Memory of 920MB, meaning I expect I'm close to an out of memory error. It seems like Windows thinks something is somehow using my virtual memory without task manager being aware of it, almost as if it has more than one opinion of what memory is being used.
Posted May 25, 2015, 4:03 AM UTC · edited
is firefox the app that is crashing? 32bit apps are limited to 2gb. you may need to use process explorer to see what's really going on, but i'm guessing you have a plugin gone crazy.
But firefox isn't showing in Task Manager as having anything near 2GB. I can't imagine plugins running inside that process but their memory not show in the firefox.exe process?
The limit is actually 2GB "address space", rather than 2GB of actual memory. Certain things can be "mapped" to address space, such as files on disk (this is the usual way that program code files, exes and dlls, are loaded). These may not be loaded into memory, so the program may run out of address space well before the actual memory use is 2GB.
For a program like Firefox, with all its plugins, dlls, etc. running out of address space when using 1.6GB memory sounds reasonable.
Relevant:
http://stackoverflow.com/questions/22174310/windows-commit-size-vs-virtual-size
Memory can be reserved, committed, first accessed, and be part of the working set. When memory is reserved, a portion of address space is set aside, nothing else happens.
Virtual size comprises the size of all pages that the process has reserved.
So with SysInternals Process Explorer (which is what you were talking about and I overlooked) you can see Virtual Size - right now it is 1.8GB vs 1.1 Working Set. So it looks like I could be running up against the 2GB limit for Virtual Size.
Why I wonder is Virtual Size so large for Firefox?
This might also explain why msinfo32.exe is showing all my virtual memory being used, as ALL apps seem to have Virtual Size waaaaaaaaaaaaay higher than Working Set.
Examples:
devenv.exe: .16GB Working vs 1.1 Virtual
explorer.exe: .1GB Working vs .6GB Virtual
This is absolute insanity.
Wait a minute though....
msdtssvr.exe: ~0GB Working vs 18GB Virtual
sqlsevr.exe : .05GB Working vs 12.8GB Virtual
sqlsevr.exe (#2): .03GB Working vs 12.5GB Virtual
I would be running out of total memory long ago based on this, so there's obviously a bit more complication to what exactly "Virtual Size" is. But I think this fairly strongly implies it is not overall system memory being the issue, but 2GB "Virtual Size" for Firefox.exe.
Because - as you pointed out - Virtual Size contains reserved pages for each process, it is of course perfectly normal for Virtual Size to be significantly higher than the Working Set or even Private Bytes for any process.