Paging file, which is also called page file or swap file, serves as an important part of virtual memory implementation in most contemporary general-purpose operating systems, allowing them to use disk storage for data that does not fit into physical RAM. Paging file is usually implemented as architecture-specific code built into the kernel of the operating system and is hidden on the hard disk and is used by the operating system to store parts of programs and data files that cannot be placed into the RAM due to unavailability of space. The operating system continuously moves data between the paging file and the primary memory in order to create free space for new data. The main functions of paging are performed when a program tries to access pages that are not currently mapped to physical memory (RAM). This situation is known as a page fault. Windows keeps on increasing and decreasing the size of the page file, which in itself is not very efficient. This affects the accessibility of fragmentation of your files. You should rather define your own paging size. Select the minimum and maximum size of the virtual memory to be the same. A preferable size is about the double the RAM you have.
You should always create a full backup of your registry before accessing any changes. This can help you to backup the old registry when you make any mistakes while you are tweaking the registry.
This is how you clear the pagefile when shutting down.
1. Click Start and then go to Run. Enter regedit into the pop-up to modify your registry.
2. Expand HKEY_LOCAL_MACHINE, until you find the SYSTEM folder.
3. Now go to SYSTEM. Expand this folder till you see CurrentControlSet.
4. Expand CurrentControlSet till you see Control. Look for Control.
5. Expand Control till you see Session Manager. Go to the Session Manager folder. Expand the folder.
6. Now go to Memory Management.
7. Look at the right side of your registry editor. Look for ClearPageFileAtShutdown. If you see the value, go to step 8. If the value does not exist, add the following value as follows.
o Right click on the right side of the registry editor.
o Select New and then select DWORD.
o Rename the new DWORD value ClearPageFileAtShutdown or right click on DWORD and select Rename.
8. Double click on ClearPageFileAtShutdown. A pop-up comes out.
9. Type in 0 if you want Clear Page File disabled. If you’d like to enable Clear Page File, simply type in 1.
10. Exit the registry and reboot your PC.