Windows 10 (and 8) include a new virtual memory file named swapfile.sys. It’s stored in your system drive, along with the pagefile.sys and hiberfil.sys. But why does Windows need both a swap file and a page file?
Windows swaps out some types of data that aren’t being used to the swap file. Currently, this file is used for those new “universal” apps — formerly known as Metro apps. Windows may do more with it in the future.
Like pagefile.sys and hiberfil.sys, this file is stored in the root of your system drive — C:\ by default. It’s also visible only if you’ve enabled “Show hidden files and folders” and if you have the “Hide protected operating system files” option disabled.
Hiberfil.sys is used by the Windows operating system to store all the contents of your RAM during hibernation. It also helps enable the new “hybrid boot” fast booting feature in Windows 8 and 10. Pagefile.sys is where the Windows operating system pages out memory when there’s no room left in your RAM and the system needs more RAM.
There’s not a lot of official Microsoft information about this file out there, but we can piece together an answer from official Microsoft blog posts and forum responses.
In summary, the swapfile — swapfile.sys — is currently used for swapping out Microsoft’s new style of app. Microsoft has called these universal apps, Windows Store apps, Metro apps, Modern apps, Windows 8 apps, Windows 8-style UI apps, and other things at various points.
These apps are managed differently from traditional Windows desktop apps. Windows manages their memory more intelligently. Here’s how Microsoft’s Black Morrison explains it:
“You may ask, ‘Why do we need another virtual page file?’ Well, with the introduction of the Modern App, we needed a way to manage their memory outside of the traditional Virtual Memory/Pagefile method.
“Windows 8 can efficiently write the whole (private) working set of a suspended Modern app to disk in order to gain additional memory when the system detects pressure. This process is analogous to hibernating a specific app, and then resuming it when the user switches back to the app. In this case, Windows 8 takes advantage of the suspend/resume mechanism of Modern apps to empty or re-populate an app’s working set.”
Rather than using the standard pagefile.sys file for this, Windows swaps out bits of universal apps that are no longer necessary to the swapfile.sys file.
Microsoft’s Pavel Lebedinsky explains a bit more:
“Suspend/resume of Metro-style apps is one scenario, there could be others in the future.
The swapfile and the regular pagefile have different usage patterns and different requirements with regard to space reservation, dynamic growth, read/write policies etc. Keeping them separate makes things simpler.”
Essentially, the standard page file is used for the normal things in Windows, while the Microsoft’s new app framework uses a separate type of file for intelligently swapping out bits of new apps.
This particular file is actually quite small, and should be about 256 MB in size at the most. You shouldn’t need to remove it. Even if you have some sort of tablet with a very low amount of storage, the swapfile.sys probably helps make it more responsive.
The swapfile.sys file is managed along with the pagefile.sys file. Disabling the paging file on a drive will also disable the swap file on that drive.
We really don’t recommend doing this, as disabling your page file is a bad idea.
But you can remove this file, if you like. To access the appropriate dialog, open the Start menu, type “performance”, and select the “Adjust the appearance and performance of Windows” setting shortcut.
In the Performance Options window, click the Advanced tab and click the Change button under Virtual memory.
Uncheck “Automatically manage paging file size for all drives,” select a drive, select “No paging file,” and click “Set.” Both the pagefile.sys and swapfile.sys files will be removed from that drive after you reboot your computer.
You should be able to recreate a page file on another drive from here and Windows will move your virtual memory files to that drive, allowing you to reduce wear on a solid-state drive and put them on a mechanical hard drive, for example.
Click OK and reboot your PC. The swapfile.sys and pagefile.sys files should vanish from your drive. To recreate them, visit this dialog again and enable a system managed size on your C:\ drive or another drive.
Overall, this file isn’t too bad — it’s a new file, but it takes up much less space than the traditional pagefile.sys and hiberfil.sys files. Windows 10 should use less disk space than Windows 7, even with this additional virtual memory file.