Jump to content

Free up buffer/cache/allocated memory


brent

Recommended Posts

If you are running a webserver, Database, or plex server you might find that your memory is at 90%+ all the time. Here is how to clear it up.

 

1. create a file at /usr/local/bin. I am calling it free-memory but you can call the file what ever you want.

sudo nano /usr/local/bin/free-memory

3. add the command then save and close.

free -h && sudo sysctl -w vm.drop_caches=3 && sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && free -h

2. change the permissions of the script.

sudo chmod 555 free-memory

4. Creating a cron job.

sudo contrab -e

5. I want to run mine every minute. Change this to your needs.

* * * * * /usr/local/bin/free-memory

6. check your server after a minute. you should see your memory usage change.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...