Guide Clear Unused Memory

  • Hi there and welcome to PC Help Forum (PCHF), a more effective way to get the Tech Support you need!
    We have Experts in all areas of Tech, including Malware Removal, Crash Fixing and BSOD's , Microsoft Windows, Computer DIY and PC Hardware, Networking, Gaming, Tablets and iPads, General and Specific Software Support and so much more.

    Why not Click Here To Sign Up and start enjoying great FREE Tech Support.

    This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Welcome to our Community
Wanting to join the rest of our members? Feel free to sign up today.
Sign up
Status
Not open for further replies.

jmarket

PCHF's Almighty Ruler
PCHF Owner
Security Manager
Support Manager
Jan 10, 2015
2,574
620
PCHF Bunker
pchelpforum.net
Knowing how to clear unused RAM in *nix is very useful. This quick guide will show you the commands needed to clear unused memory in all flavors of Linux.

NOTE: WE HIGHLY RECOMMEND USING
Code:
sync
before doing this to ensure that dirty objects are freeable. Otherwise, running these commands may not yield the full benefit.

Debian, Ubuntu, and any other aptitude-based distribution:

To clear caches, simply run this in Terminal:

Code:
sudo sysctl -w vm.drop_caches=3

To fully clear unused memory (page cache, inodes, and dentries), run this in Terminal:

Code:
sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches

Fedora, CentOS, and any other yum-based distribution:

To clear only the pagecache, do this in the Terminal:

Code:
echo 1 > /proc/sys/vm/drop_caches

To clear dentries and inodes from memory, run this in Terminal:

Code:
echo 2 > /proc/sys/vm/drop_caches

To clear everything, including the pagecache, dentries and inodes, run this in Terminal:

Code:
echo 3 > /proc/sys/vm/drop_caches
 
  • Like
Reactions: xrobwx71
Status
Not open for further replies.