What is a pagefile?
In storage, a pagefile is a reserved portion of a storage drive that is used as an extension of random access memory for data in RAM that hasn't been used recently. A pagefile can be read from the storage drive as one contiguous chunk of data and thus faster than re-reading data from various original locations.
Windows uses pagefiles to make more RAM available to applications that are used actively, rather than sitting idle. For example, a user might open a browser, conduct several searches, and then minimize the browser for an extended period. In the meantime, the user works steadily in a video editing program that requires a significant amount of RAM. Windows might move the browser files from RAM to the pagefile to provide more physical memory resources to the video editing program.
The pagefile (sometimes referred to as page file or paging file) is a Windows system file whose full name is pagefile.sys. By default, it is located in the root directory of the system drive, typically the C: drive. Figure 1 shows the file on the C: drive as it appears in Windows Explorer. Because the pagefile is a system file, it is hidden by default. For the file to be visible, Explorer must be configured to display protected operating system files.
The pagefile is part of Windows' virtual memory system, which abstracts the physical memory through the use of virtual addresses. The system also maintains a page table that maps the virtual addresses to the physical addresses. Windows provides each process with a set of virtual addresses that enables it to use a block of physical memory independently of other processes.
A system's virtual memory can include both RAM and disk space, which is the area of physical storage reserved through the pagefile. The disk space can be on a solid-state drive (SSD) or hard disk drive (HHD). Running processes are aware only of the virtual addresses and have no knowledge of the physical addresses. Windows handles the translations between the virtual and physical addresses through seamless operations running in the background.
Virtual memory makes it possible to provide more memory than is available in RAM. This is accomplished through sophisticated memory management techniques and the use of one or more pagefiles. Potentially, each of a computer's available drives can contain a pagefile; however, it is common for a system to use only one pagefile.
For example, the screenshot in Figure 2 shows the Memory portion of the Task Manager Performance tab. In this case, the system has 8 gigabytes (GB) of memory; however, the Committed section (outlined in red) indicates that there is 9.2 GB of total available memory. This number is the sum of the system's RAM and pagefiles. Because this system in this example has only one drive, this total amount reflects that drive only.
The Committed section represents the system's virtual memory. The first amount, 3.8 GB, is the total amount of virtual memory currently used. The second amount, 9.2 GB, is the total amount of virtual memory available on this system. The extra 1.2 GB (over the 8 GB of physical memory) is the approximate amount of space available through the pagefile. Although the system includes only 8 GB of physical memory, it behaves as though it has 9.2 GB.
Memory totals can also be viewed through the Windows System Information app, which provides details about the system's physical and virtual memory, the pagefile and its location, and other system components, as shown in Figure 3. The information in this figure is based on the same system as in Figure 2. There are 8 GB of installed RAM but 9.24 GB of total virtual memory. In addition, the pagefile takes up about 1.25 GB of storage space.
Most non-Windows operating systems also implement some form of virtual memory and provide the ability to extend the physical memory to local disk storage in the same way that Windows uses the pagefile. On these systems, the extended memory might be called a swap file, swap space or swap partition.
Managing pagefile settings in Windows
Windows automatically manages the system's virtual memory components and processes. This includes maintaining the pagefile and determining its size. However, Windows users and administrators can customize the pagefile settings. Although Windows normally handles the pagefile with no problem, sometimes changing the pagefile settings could be useful, such as when running a critical business application that requires a substantial amount of memory.
Users can override the default pagefile settings through the advanced system settings, unless administrative policy prevents them. The settings can be accessed through the Advanced tab of the Performance Options dialog box, as shown in Figure 4.
The Virtual memory section shows the current pagefile size for all drives. In this case, there is only one drive, and the size is about 1,280 MB. This is the same system on which the previous figures are based, so the size shown here is consistent with the approximate amounts in those figures.
To update the pagefile settings, the user clicks Change, which launches the Virtual Memory dialog box. Here the user can set an initial file size and a maximum file size, as shown in Figure 5.
The Virtual Memory dialog box also provides the No paging file option. If this option is selected, Windows will stop using a pagefile for managing the RAM overflow. Users should be cautious about enabling this option, and many experts recommend against it.
The lack of a pagefile can disrupt a system's operations in unexpected ways, such as causing applications to crash or making the system unstable. Some software will not operate properly without it. For example, several Windows servers require a pagefile, including certificate servers, distributed file system (DFS) replication servers and Windows Server domain controllers.