Windows – Why are there hard faults when the RAM is not 100% used

memorywindows

I've got 2GB of RAM and the resource monitor shows that it's only used about 75%. However there are some apps (NetBeans, Visual Studio) that every once in a while start making a lot of hard faults (up to and over 2000/min), thus predictably slowing down to a crawl. How is this so? The memory usage during these "fits" doesn't change. Perhaps it also includes memory mapped files or something?

Best Answer

When a program is started, it is not necessarily completely loaded into memory, just enough is loaded that is required at any given time. When program code is called that is not yet in physical RAM, a page fault (or hard fault) is raised and the OS will load the required part of the program. You computer may be reporting that a program is consuming, say, 100MB of memory, when most of that memory is still on the drive and yet to be paged into physical RAM.

Related Question