The Windows operating system contains several system files required for its proper functioning. Some among them which raise a lot of curiosity are Swapfile.sys, Hiberfil.sys & Pagefile.sys. To see these system files on your System (C) Drive root you will have to un-hide protected operating system files from Folder Options. In this post we will briefly talk about each file.
When you have Hibernation and subsequently Fast Startup enabled (which is the default setting), your Hiberfil.sys file will be approximately 3/4th of your RAM. So you can see that the Hiberfil.sys file in my case is 6.6GB, since I have a RAM of 8GB. In case you have disabled Hibernation, you will find its size roughly equalling your RAM.
In Windows 8, you will not find the size of Hyberfil.sys running wild, when you have Hibernation enabled. In the earlier version of Windows, the hibernation file stored the kernel session, device drivers and application data. In Windows 8, the hibernation files stores the kernel session and device drivers only, as a result of which the size remains more or less constant.
If you wish to, you can always disable/enable hibernation manually or by using our Ultimate Windows Tweaker, or a Microsoft Fix It. But then remember, that in Windows 8, this will disable Fast Startup too.
Pagefile.sys or the Page File is the computers paging file which your Windows uses as Virtual memory. The PageFile.sys holds objects in an over-used memory that have not been accessed for a long period of time. When Windows runs out of physical memory, it resorts to using the Page File, by writing some of the contents of RAM on to the disk. If this ‘Paged out’ memory is needed back, some other part is written to disk and this part is read back. You can read more on Paging Files at TechNet.
If you often get a message Your system is low on virtual memory, when you try to start any memory intensive application, you may want to increase the Paging File size. The size of the Page file on my Windows 8 PC is around 1.2GB.
Cleaning the Page file on every shutdown means overwriting the data by zeros, and it takes time. This will increase shutdown time. But if you work on confidential documents, then you may want to have this setting ‘on’. When you load such documents, they are loaded into RAM. To save RAM Windows places certain items in the pagefile. Hence you may want to delete pagefile at every shutdown, in such cases. To do so open Regedit and navigate to the following key:
HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ Memory Management
In the right pane, select New > DWORD (32-bit) Value. Name the DWORD value ClearPageFileAtShutdown and give it value of 1.
In earlier versions of Windows, you had Swapfile.sys or the Swap file. The Swap file holds objects which have been ejected from memory and are not expected to be accessed for some time and allows an operating system to use hard disk space to simulate extra memory whenever the system runs low on memory, by swapping section of RAM that an idle program is using onto the hard disk to free up memory for other programs. This combination of RAM and Swap files is known as Virtual Memory. Having a swap file makes your computer’s operating system “have” more RAM than it actually has.
The Swapfile is not used in the fast startup process of Windows 8. It is the Hiberfil.sys file which stores the kernel session and comes into play here.
In Windows 8, you again get to see Swapfile.sys! This latest version of Windows has both – the swapping as well as the paging file at the same time. It is around 256 MB in size – in my case it is 262 MB.
Why do we need another virtual page file in Windows 8 ?
The Swapfile.sys in Windows 8 is a special type of pagefile used internally by the system to make certain types of paging operations more efficient. It is used to Suspend or Resume Metro or Modern Windows 8 apps.
TechNet explains the ‘new’ Swapfile.sys in Windows 8 as follows:
With the introduction of the Modern App, we needed a way to manage their memory outside of the traditional Virtual Memory/Pagefile method. With that, the “%SystemDrive%\swapfile.sys” was born.
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.
I hope this explains the reason why we see all the 3 files viz. Hiberfil.sys, Pagefile.sys & Swapfile.sys files in Windows 8.