Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've once read somewhere that Windows can treat programs' executables and DLL files as parts of swap file rather than duplicating their content into pagefile.sys when swapping them out of physical memory. Is that true?

share|improve this question
    
AFAIK, the only "swap" memory Windows has is the pagefile. Other then that, it's up to individual programs to use swap files to save RAM (e.g. Adobe Photoshop). – Breakthrough Mar 6 '11 at 15:21
up vote 6 down vote accepted

This is true.

For example: If you open notepad, then windows will load bits and pieces of the notepad.exe file from the hard drive. Then you write something in notepad. Then you minimize it and do something else that needs a lot of memory so that notepad gets paged out. The stuff you wrote will get page out to the pagefile, but the pieces of notepad.exe that were loaded just gets dropped, since they are already on the hard drive.

While this reduces page file usage, it does not increase your virtual memory. Windows still won't commit to giving more memory than RAM + pagefile.

share|improve this answer
    
Clarification: It doesn't increase the system commit limit, which pertains to "private commmitted" virtual address space. exe's, dll's, other "code files", are all mapped into virtual address space, and they do contribute to the TOTAL virtual address space a process can use. But not to the "commit limit". – Jamie Hanrahan Oct 4 '14 at 17:08
    
I would add: Windows always does this. exe and dlls are mapped into process virtual address space and their pages are brought into memory when and as they're needed ("demand paging"). Nor is there normally a need to write those pages to the pagefile as they are almost never modified. If there is high demand for RAM, such pages (code and constant data) can just be overwritten and used for something else. A page that's needed again later can just be read in again from the original exe or dll. It is a myth that the pagefile is the only file involved in paging. Nor is this unique to Windows. – Jamie Hanrahan Dec 5 '15 at 12:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.