The computer applications store their loading configuration and settings in the RAM. As the memory type used in RAM is much faster, it takes less time to load the program the next time after its configuration is stored in the physical memory.
So, using higher capacity RAM allows us to use more applications at the same time without any lag. But, when a significant amount of the cache files of these programs are loaded to the RAM, the available space for other important system processes may decrease. It will eventually cause the computer to become sluggish.
Thus, clearing the cache at regular intervals can free up the physical memory and improve your system performance, especially if you multitask. In this guide, we have prepared most of the possible ways to free up your RAM.
Clear Ram Cache on Windows
RAM does not have its own cache memory. Even if it does, it is only a few Kilobytes in size. The RAM cache is actually the cached files created by the applications and programs in your system that are loaded to the memory to load them faster.
When a number of applications run on the system, their cache file increases. As a result, the RAM is highly cached. However, the RAM being a volatile memory, does not store them permanently. As soon as the RAM loses power, its contents, including the cached files, are lost.
Thus, the most effective way to clear the RAM cache is restarting the system. Your RAM will be cleared automatically when you restart the computer.
However, the temporary files and another cache may be injected into the RAM as soon as the system boots up. And the RAM reaches the same cache state. On top of that, you may not always want to reboot the computer to just clear the RAM cache.
Clear Temporary Files
As mentioned earlier, whenever we run programs and applications on our PC, it stores its configurations and cache as temporary files in the drive. These files are loaded to the RAM as soon as the program is loaded after the system starts. These temporary files can cause the RAM cache to increase. Thus, you will have to remove them all.
1- Open Run by pressing Windows + ‘R’ and type temp
.
2- Press Ctrl + ‘A’ to select all files and press the delete button.
3- Similarly, type %tmp%
in the run dialog box and delete all its contents as well.
4- Do the same for the Prefetch folder by entering prefetch
in the Run dialog box.
5- Press Windows + ‘I’ to open Settings.
6- Navigate to System>Storage.
7- Select Temporary files.
8- Click on Remove files.
9- Restart your system to find the RAM cache cleared.
Use RAMMap
Windows has a separate application called RAMMap to monitor all the details of the physical memory. In addition to monitoring the RAM usage, cached memory, and other information, you can also clear the cached data from the RAM.
1- Download RAMMap from Microsoft and extract the compressed file.
2- Run the RAMMap application.
3- Click on the Empty menu and select Empty Standby List. This will clear all the superfetch cache in the blocks of the memory module.
The RAM cache should be cleared after this.
Clear Page File
The pagefile is the space allotted in your hard drive that acts as virtual RAM when your physical memory starts filling up. All the cache and program configurations get stored in a file named pagefile.sys when the RAM space decreases.
But unlike RAM, its content may not get removed automatically. They can be loaded to the RAM for fasting working of the system. As a result, the RAM cache increases.
So, you will have to set it to clear the pagefile upon every restart.
1- Press Windows + ‘R’ and enter gpedit.msc
in Run to open Local Group Policy Editor.
2- Go to Computer Configuration/Windows Settings/Security Settings/Local Policies/Security Options
.
3- Look for Shutdown: Clear virtual memory pagefile.
4- Double-click on it and set it to Enabled.
5- Restart your PC to clear the page file.
Run a VBS Script
It can be quite difficult to identify individual programs that have stored their temporary files on the RAM. So, you can run a script in a .vbs
format that clears the cached RAM when you run it.
Since the script requires you to enter the amount of cache to be cleared manually, you first need to see the value of cached RAM. Let’s move on to the whole process.
1- Open Task Manager by pressing Ctrl + Shift + Esc.
2- Go to the Performance tab and select Memory.
3- At the bottom, find the value under Cached and note it.
4- Open Run by pressing Windows + ‘R’ and type notepad
to start a Notepad window.
5- Type the code FreeMem = Space(500000000)
. This will clear 500 MB of RAM cache. If the value is different for you, change it accordingly by replacing 6 with the respective number.
6- Press Ctrl + ‘S’ and save it with any name and .vbs
extension.
7- Open notepad again.
8- Type the code Mystring = (80000000)
and save it with .vbs
extension as well.
9- Run the first file followed by the second by double-clicking on them.
10- Check the Cached RAM value in Task Manager.
You should find the cache cleared. However, the RAM cache will start increasing shortly, and hence the RAM usage, as the programs are continuously operating in the background.
So, before running this script, you should close any heavy programs from the task manager and also disable the startup applications.
1- Open Task Manager.
2- Select the programs and click End Task.
3- Similarly, go to Startup Apps.
4- Select each program and click Disable.
Then, repeat the script mentioned earlier, and you should find it runs effectively to clear the cache.
Delete Cache of Most Used Programs
Some amount of RAM caching also occurs when the applications in the system create their individual cache files. So, deleting the cache in those individual programs can also clear the RAM cache.
For instance, you can clear your browser cache by going to browser history and deleting all the cache. You can do this for all those programs that you use frequently and have the option to clear the cache.
If you are looking to clear your RAM cache due to low memory availability and system lag, you can optimize your Windows PC. You can increase the pagefile size, perform a clean boot, disable startup applications, etc. We have prepared a dedicated guide to help you fix the lagging PC.