Memory is an important factor in processing different tasks faster. Since it is electronic memory, it is costly and most people cannot afford a huge amount of RAM. Also, there is a limit on RAM that the operating systems can support. But the Memory Compression feature in Windows 11 and Windows 10 makes sure that you are getting optimal and balanced usage of RAM along with the page file. The new OS comes with memory optimization that incorporates compression of data occupying the electronic memory. The article talks about how older Windows versions managed memory, what is the memory compression feature and how Memory Compression works in Windows 11/10.
(Image Credit: Microsoft)
Memory Management in older Windows versions
In Windows, the whole memory thing is divided into three distinct parts:
- Random Access Memory (Electronic Memory)
- Pagefile (Extension of RAM on Hard Disk)
- Hard Disk and other types of storage systems
In the older versions, it was necessary to allow a good amount of hard disk space to pagefile.sys that acted as an extension of the electronic memory. Memory management in older versions of Windows was simple and straight. Store the currently running applications and related data to electronic memory and send the least used data to pagefile.sys. While the traditional application resided in the main memory, the data part was often pushed to pagefile if it is not used for long. If the capacity of pagefile was exceeded, the data on pagefile was replaced, according to a post on Insider Hub. In that case, if the application – that was still in the electronic memory – required old data, it was again to be loaded into the RAM from the hard disk or other storage devices – which means it took more time to read or write data.
In other words, applications and most recent data are to reside in RAM, frequently used data by current applications stayed in pagefile.sys and the hard disk was accessed when a new set of data had to be read or written. This includes data not present on pagefile – the data that may have been replaced with a new set.
Memory Management in Windows 11/10 – The App Pagefiles
With Windows 11/10, memory management changed a little. There were two types of applications in Windows 8/8.1. The traditional applications still worked as explained above. Part of them stayed in RAM while the required data was stored to pagefile when the applications were idle and when the RAM was full.
The modern apps ran only when they were in focus. If you opened app A and app B and are currently working on app A, app B along with related data would be pushed back to the pagefile. That way, app A can have good access to memory and need not reach out to pagefile for every fetch process. When you sent app A to the background by focusing on app B, app A and related data would go to pagefile while app B gets exclusive access to RAM.
This method saved on memory and made apps faster. With Windows 11/10, the compression feature was added to make it even faster. The following section explains how it works in Windows 11/10.
Memory Management in Windows 11/10 – Compression over Pagefile
The memory management is the same as that of Windows 8/8.1. The traditional apps are stored in electronic memory and focused apps are also stored in RAM. If RAM becomes congested due to excess data, the app and data things are compressed up to 40% and accommodated in the same electronic memory.
Windows 11/10 too uses pagefile.sys to store data of the electric memory. If an app is using too much data but at slower intervals, some of its data is pushed to pagefile if electronic memory is short of free space. If the app becomes aggressive, the data is moved back from pagefile to the electronic memory and some other app is pushed to pagefile to make space for the current app. Only in rare cases, the hard disk is approached: when a new set of data or app is to be loaded or when the data required by an app is not present on either RAM or pagefile.
Memory Compression in Windows 11/10 optimizes RAM usage
Windows 11/10 too has two categories of apps: UWP and Traditional. The traditional applications are stored separately in electronic memory while the modern apps each have their own stack. This makes it easier to push modern apps and related data to pagefile when you open too many apps in a way that memory falls short despite compression.
It saves about 50% of pagefile activity (compared to older versions of Windows) when you are using the memory compression feature in Windows because most of the data is already available on the main memory – in a compressed form. When the app or data is required, it is decompressed and used. So there is the need to keep a portion of RAM empty to provide for uncompressed data.
Even when using pagefile, the speed is faster in Windows 11/10 because the entire app and related data are stored as a compressed page which is accessed in sequential order. While part of the data is being uncompressed, the other part is sent to the main memory for processing. This too saves time and makes computing faster on Windows 11/10 machines.
How to check if Memory Compression is enabled in Windows?
The simplest way to check if Memory Compression is enabled or disabled is:
- Open the Task Manager
- Select the Performance tab on the top
- Click on Memory on the left side
- There in the right panel you will see In use (Compressed)
- This indicated that Memory Compression is enabled on your PC.
How to Enable or Disable Memory Compression in Windows 11/10
Open an elevated PowerShell window.
To check if memory Compression is enabled or disabled, execute the following command:
Get-MMAgent
If you see true against memory compression, it means that it is enabled. If you see false, it means that it is disabled.
Execute the following command to disable Memory Compression:
Disable-MMAgent -mc
Execute the following command to enable Memory Compression:
Enable-MMAgent –mc
Hope this helps.
Now read: System Compression in Windows and how it saves space on devices.