Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 need a utility (or if this doesn't exist, a Windows function) to query the state of pages in a running application. Utilities like VMMap already give quite some information, but what I am missing is the following: knowing whether a memory page is currently in RAM, swapped out, or is not loaded.

The problem is that my executable is loaded from the network, and although I used the /SWAPRUN:NET linker flag in the past, I don't use it anymore since it leads to horrible performance problems in Windows Explorer since Windows Vista (if this flag is set Windows Explorer also loads the complete executable over the network just to show the icon).

I have some trick to force the application in memory myself, but I have the impression that it doesn't always work, and it also doesn't seem to work if Windows gets low on memory (I think it simply removes the executable pages instead of swapping them out to the page file).

With such a utility I would be able to check what Windows is really doing, and I can try some alternative ideas to force the application code in memory.

share|improve this question
You are right. Windows does not write unmodified pages from .exe or .dll files to the pagefile. It just frees the physical memory and reads from the original location again if required. The VirtualLock function can be used to prevent memory being paged out but it's probably a bad idea if you are getting low memory. – David Marshall Jan 30 '13 at 11:51
Would this dirty trick work: use VirtualProtect to make the page writable, change 1 byte (does it has to be different?), then make the page read+execute again. – Patrick Jan 30 '13 at 13:58
Yes, that would force Windows to save it to the pagefile if it wanted to reuse the physical memory. I don't think the hardware can detect that a write hasn't actually changed the memory contents. – David Marshall Jan 30 '13 at 15:51
> knowing whether a memory page is currently in RAM, swapped out, or is not loaded. Windows does not include a function for determining this information. One good reason is that any answer you get could be obsolete by the time you want to act on it. – Jamie Hanrahan Aug 6 '14 at 17:59

You must log in to answer this question.

Browse other questions tagged .