LOGO

Swapfile.sys: What It Is & How to Delete It

August 22, 2015
Swapfile.sys: What It Is & How to Delete It

Understanding Windows Swapfile.sys and Pagefile.sys

Both Windows 10 and Windows 8 incorporate a virtual memory file called swapfile.sys. This file resides on your primary system drive, alongside the established pagefile.sys and hiberfil.sys files.

A common question arises: why does Windows utilize both a swap file and a page file for virtual memory management?

The Role of the Swap File

Windows intelligently transfers certain data types, which are temporarily inactive, to the swap file. Currently, the primary function of this file is to support the newer "universal" applications – previously referred to as Metro apps.

It's important to note that Microsoft may expand the functionality of the swap file in subsequent updates and releases.

Distinction Between Swap File and Page File

While both files serve the purpose of virtual memory, their usage differs. The pagefile.sys has traditionally handled the swapping of inactive processes and data, while swapfile.sys is presently focused on specific application types.

This dual-file system allows Windows to optimize memory management and potentially improve system performance.

Future Windows versions could see an increased reliance on the swap file, potentially altering its role within the virtual memory architecture.

Swapfile.sys, Pagefile.sys, and Hiberfil.sys

These system files are often encountered when examining the root directory of a Windows installation. They are intrinsically linked to memory management and system performance.

Similar to pagefile.sys and hiberfil.sys, the swapfile.sys file resides at the base of your primary drive, typically C:\. Visibility of these files is contingent upon enabling the display of hidden files and folders within Windows settings.

Understanding Hiberfil.sys

The hiberfil.sys file serves as a repository for the complete contents of your computer’s Random Access Memory (RAM) when the hibernation feature is utilized. This allows for a faster system resume compared to a complete shutdown and restart.

Furthermore, it plays a crucial role in facilitating the “hybrid boot” functionality introduced in Windows 8 and continued in Windows 10, contributing to quicker startup times.

Understanding Pagefile.sys

When the physical RAM capacity is exhausted, Windows employs pagefile.sys as a virtual memory extension. Data is temporarily transferred from RAM to this file on the hard drive, effectively increasing available memory.

This process, known as “paging,” allows the system to continue operating even when RAM resources are fully allocated. It’s a critical component of Windows’ memory management system.

Swapfile.sys Explained

The swapfile.sys file functions similarly to the pagefile, acting as an extension of RAM. However, it's managed differently and is more closely tied to the Windows core system processes.

It's used for memory compression and to offload less frequently used memory pages, optimizing system performance. Its size is dynamically adjusted by Windows based on system needs.

To view these files, you must first configure Windows to display hidden files and folders, and also disable the protection of operating system files.

Understanding the Purpose of the Swap File

Official documentation from Microsoft regarding this file is limited. However, its function can be understood by examining official blog posts and responses from Microsoft forums.

In essence, the swapfile – specifically, swapfile.sys – is currently utilized for managing the memory of Microsoft’s newer application format. These applications have been referred to by various names, including universal apps, Windows Store apps, Metro apps, and Modern apps.

These applications differ from traditional Windows desktop applications in how they are managed. Windows employs a more sophisticated approach to memory allocation for them. Microsoft’s Black Morrison clarifies this process:

"The question arises, 'Why is another virtual page file necessary?' With the introduction of the Modern App, a method for managing their memory independently of the conventional Virtual Memory/Pagefile system became essential.

"Windows 8 is capable of efficiently writing the entire working set of a suspended Modern app to disk, freeing up memory when system resources are constrained. This mirrors the hibernation and subsequent resumption of an application when the user returns to it. Windows 8 leverages the suspend/resume functionality of Modern apps to clear or repopulate an app’s working set."

Instead of utilizing the conventional pagefile.sys, Windows directs the swapping of data from universal apps that are temporarily inactive to the swapfile.sys.

Further insight is provided by Microsoft’s Pavel Lebedinsky:

"The suspend/resume functionality of Metro-style apps represents one use case, with potential for others in the future.

"The swapfile and the standard pagefile exhibit distinct usage patterns and have differing requirements concerning space allocation, dynamic expansion, and read/write policies. Maintaining them as separate entities simplifies management."

In short, the standard page file handles typical Windows operations, while the newer application framework from Microsoft utilizes a dedicated file for intelligently managing the memory of these applications.

what-is-swapfile.sys-and-how-do-you-delete-it-1.jpg

Removing the Swapfile.sys File

Related: Understanding the Windows Page File and Its Configuration.

Typically, the swapfile.sys file is relatively small, generally capped at around 256 MB. Its removal isn't usually necessary. Even on devices with limited storage, such as tablets, this file can contribute to improved system responsiveness.

The swapfile.sys file operates in conjunction with the pagefile.sys file. Disabling the paging file on a specific drive will also result in the disabling of the swap file on that same drive.

We advise against this practice, as deactivating your page file can negatively impact system performance.

However, if desired, the file can be removed. Begin by opening the Start menu, then type "performance" and select the shortcut labeled "Adjust the appearance and performance of Windows."

what-is-swapfile.sys-and-how-do-you-delete-it-2.jpg

Within the Performance Options window, navigate to the Advanced tab. Then, click the "Change" button located under the Virtual memory section.

what-is-swapfile.sys-and-how-do-you-delete-it-3.jpg

Deselect the option "Automatically manage paging file size for all drives." Next, choose the drive from which you wish to remove the files, select "No paging file," and confirm your selection by clicking "Set." A system reboot is required for both pagefile.sys and swapfile.sys to be removed from the chosen drive.

From this point, a page file can be re-established on an alternative drive. This allows Windows to relocate virtual memory files, potentially reducing wear on a solid-state drive by transferring them to a mechanical hard drive, for instance.

what-is-swapfile.sys-and-how-do-you-delete-it-4.jpg

Confirm your changes by clicking "OK" and restarting your computer. Upon reboot, both the swapfile.sys and pagefile.sys files should no longer be present on the drive. To reinstate them, revisit the dialog and enable system-managed sizing on your C:\ drive or another drive.

In general, this file presents minimal drawbacks – it’s a recent addition, but occupies significantly less disk space compared to the conventional pagefile.sys and hiberfil.sys files. Windows 10 tends to require less disk space than Windows 7, even considering this supplementary virtual memory file.

#Swapfile.sys#Windows#virtual memory#delete#remove#system file