If your computer is running slow and you begin to notice that your hard drive is thrashing, then you are short on memory and some applications will start to crash or display strange error messages.

It is useful to free up RAM regularly under Ubuntu or any Debian-based system. There are many ways used to free up memory on Ubuntu/Debian, but in this tip, we will use the easiest one.

To see how much memory is free on your system, open the Terminal and run this command:

free -m

I got this output:

$ free -m
                      total       used       free     shared    buffers     cached
Mem:             496         483         12               0           40           171
-/+ buffers/cache:         272        223
Swap:             509          34         475

To free up memory, run these commands:

echo 3 > /proc/sys/vm/drop_caches

Run again this command to see the difference:

free -m

I got this:

free -m
                   total       used       free     shared    buffers     cached
Mem:          496         332       164               0             4             57
-/+ buffers/cache:      270        226
Swap:          509          34         475

Note: The "echo 3 > /proc/sys/vm/drop_caches" command is used to clean up your memory from pagecache, dentries and inodes.

That's it!

Post a Comment