Reputation: 4948
I have a memory hungry application. I let it run over night on a system with 32GB RAM. Also ran free -m -s 20
along with it to see how the memory status changes. My application was the only thing I manually started after restarting my Ubuntu
(except the terminal of course). let's look at parts of output:
when the application started:
total used free shared buffers cached
Mem: 32100 1428 30671 35 69 594
-/+ buffers/cache: 765 31335
Swap: 32693 0 32693
before the application ends:
total used free shared buffers cached
Mem: 32100 31860 240 84 2 17420
-/+ buffers/cache: 14437 17663
Swap: 32693 12 32681
right after the application ends:
total used free shared buffers cached
Mem: 32100 18723 13376 84 2 17434
-/+ buffers/cache: 1285 30814
Swap: 32693 12 32681
and the status remain same for many hours until I came back in the morning.
My question is:
Why most of my memory is still considered a free
part of buffers/cache
? when is this part of memory going to be the free
part of the overall Mem:
again?
I then opened a browser, an IDE and some other GUI application to see how and from where the memory is allocated to the new applications:
total used free shared buffers cached
Mem: 32100 20378 11721 88 160 18075
-/+ buffers/cache: 2143 29956
Swap: 32693 12 32681
Apparently, Free memory from both Mem:
as well as buffers/cache:
was allocated to new applications. Can you please interpret this for me?
Upvotes: 0
Views: 87
Reputation:
The cached data is also part of the used memory. After a program ends, the data loaded from disk by your program will become a part of the cache. So your system will not free any of the data, but it drops the cached data, if your memory will be needed again. A more or less funny page, that describes the problem.
Upvotes: 2