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.
  • Hello everyone We want to personally apologize to everyone for the downtime that we've experienced. We are working to get everything back up as quickly as possible. Due to the issues we've had, your password will need to be reset. Please click the button that says "Forgot Your Password" and change it. We are working to have things back to normal. Emails are fixed and should now send properly. Thank you all for your patience. Thanks, PCHF Management
Status
Not open for further replies.

jmarket

PCHF's Almighty Ruler
Staff member
PCHF Owner
Security Manager
Support Manager
Jan 10, 2015
2,578
747
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.