Introduction to Linux - A Hands on Guide | Linux Bible | Linux From Scratch | A Newbie's Getting Started Guide to Linux | Linux Command Line Cheat Sheet | More Linux eBooks



Thursday, 3 October 2013

How To : Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint

free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory,

This article explains a few methods to free up and release the unused or cached memory which your system could not release properly after using it. The easiest and most ordinary way to achieve this is System Reboot. But, when you are having Terminal with you, there is no need to reboot your system and no need to use any third party software.

Checking Used Memory and Free Memory

To check the current amount of used and free memory in the system in real time, use the following command:

watch -n 3 free -m
Output:
free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory,


Or you can also try the following command to see much detailed information about current memory usage:

watch -n 3 cat /proc/meminfo
Output:
free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory,


Above command will provide plenty of information including-

  • MemTotal : 1024792 kB
  • MemFree : 434168 kB
  • Buffers : 66672 kB
  • Cached : 283148 kB
  • SwapCached : 0 kB
  • Active : 197488 kB
  • Inactive : 2264 kB and much more..

Releasing the Memory

1. Freeing Up the Page Cache

echo 1 > /proc/sys/vm/drop_caches

2. Freeing Up the Dentries and Inodes

echo 2 > /proc/sys/vm/drop_caches

3. Freeing Up the Page Cache, Dentries and Inodes

echo 3 > /proc/sys/vm/drop_caches

4. Flushing the File System Buffers

sync

Result:

free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory,
Before Clean Up Activity

free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory, free-up-memory,
After Clean Up Activity



9 comments:

  1. Very very useful. Thanks for this

    ReplyDelete
  2. excellent saved me rebooting the company cloud

    ReplyDelete
  3. bash: /proc/sys/vm/drop_caches: Permission denied

    ReplyDelete
  4. This article is terrible and misleading.

    The drop_caches command does nothing except zero out the computer's page cache, which will simply make the computer slower. Pages in the cache are automatically released as needed.

    The only legitimate purpose of drop_caches is if you want to run a performance test, where the cache would cause the results to be too fast and hence the test invalid.

    ReplyDelete
    Replies
    1. So what solutions do you offer? Dont just critique,

      Delete
    2. What kinds of solution do you need?
      Addind more Rams could be better solution than drop caches.
      Drop caches never be a 'solution' at all. You just lost chances of reusing them and will make more disk I/Os to refill sacrificed pages. Kernel does drop page caches automatically much more intelligent way than you.

      Delete