Windows – Is it possible to hint Windows to bring a process completely out of swap

processswapwindows

Is it possible to hint the Windows virtual-memory-manager to bring a particular process out of swap?

The situation I often find myself in is normally using about 50% of my RAM for all the normal programs, one in particular being an IDE for an embedded target, along with its associated debugger.

Then I leave a memory hungry process running – eg wireshark or something that's accumulating data over a weekend, everything gets swapped out – as they should. After the big process is finished, most processes are left in swap.

Then the sporadic pauses to swap the process back in cause problems with the debugger, presumably due to timing issues in the comms between IDE and the hardware-debugger. So control of the target device can be sporadic until enough attempts have brought the debug-data in the IDE back out of swap.

Best Answer

KerrekSB developed a special tool for this purpose:

https://stackoverflow.com/a/2940209/684229

It is available on GiTHUB with binaries: https://github.com/louisdx/unpage

During the run, you get lots of errors "Failed to read one byte from 0x....000, error 299 (0 bytes read)", but it is not a problem, the tool works great.