Αναζήτηση αυτού του ιστολογίου

Linux Memory Usage

Top commands to check memory in Linux:
Sources:
http://www.binarytides.com/linux-command-check-memory-usage/
http://linux.ittoolbox.com/groups/technical-functional/linuxadmin-l/large-amount-of-inactive-memory-on-linux-system-4509040
https://www.kernel.org/doc/Documentation/sysctl/vm.txt

CLI Tools for Ram Check:
#cat /proc/meminfo
#free or free -m
#top & htop (summarized info at the beginning . Also detailed info per process is provided.
#vmstat -s
#dmidecoade -t 17

Task Managers (like lxdetask):
Usually task managers/applets in tray do not report cached memory (mate does by the way).

Web Browser Ram Usage: 
about:memory for Fire Fox, Shift + Esc in Chrome.
As it has proved a typical googling usage in browser get some about 500Mbytes of Ram.
Facebook, Google , Youtube can increase ram usage up to 1,5 - 2 Gb (multiple tabs).

Mem Optimizing:
http://stackoverflow.com/questions/18529723/what-is-active-memory-and-inactive-memory

It seems that a kind of headache is the inactive /cached memory.
It is supposed that this inactive memory, will be free by the system when needed to be used.

If for some reason this is not hapenning automatically and you run into luck of ram problems, then you can free cache memory manually:

#free && sync && echo 3 > /proc/sys/vm/drop_caches && echo "" && free
OR
#sync && echo 3 > /proc/sys/vm/drop_caches 0

Results:
Cache memory has been observed to reach 1.2 Gb RAM. By running #sync && echo 3 > /proc/sys/vm/drop_caches 0 the cache is reduced to 250 MB .
According to kernel documents , this procedure seems not to be harmfull for your system , but we have to keep in mind that cached memory helps the system to perform faster.
If you clear the cache, the system might use much more resources to re load an existed application.
On the other hand if you need more ram for a running application, systems selects which cached memory to free and give that ram into the demanding application. It is like how a dynamic memory management made by your linux kernel in order to optimize system performance.

On the other hand, there are a lot of people complaining that used memory + cache memory occupies the whole RAM making the system too slow with great lags, screen freezes, and other ram related erros. By clearing the cache, people claim that system performance is improved / restored.

Although is not clear if for those users, it is something else not perfectly tuned on this kernel automatic memory management that is causing the "lags" , and cached memory is not automatically dropped to be used for real applications.

Real Screen Shot from my system:
Load : Teminal Open,FireFox open with Facebook, youtube (not playing video), google gmail, google plus, task manager open.