9

I am currently running a single GPU Cluster Compute node on Amazon EC2 which is listed as having 22 GB of RAM per instance. top confirms that the instance does indeed have 22 GB of RAM but on an idle systems it appears that 5-6 GB of RAM are consistently in use. Neither top nor ps aux can identify the processes to which this usage is attributable.

5-6 GB seems too large for the OS to me, but perhaps I am wrong. Could this be an overhead due to virtualization on Amazon? Any other ideas or suggestions as to how I could track this down?

migrated from stackoverflow.com Oct 8 '11 at 16:51

This question came from our site for professional and enthusiast programmers.

  • 1
    Are you including the memory cache in this calculation? It might be useful to show the contents of proc meminfo. – Ray Vahey Oct 7 '11 at 18:08
7

The reason why you see a substantial amount of memory being used is that Linux is using much of it for file caching.

This would probably clarify things for you:

http://www.linuxatemyram.com/

5

When you look at top, the free memory you see is the value before kernel caching.

top - 12:59:25 up 1 day, 15:47,  5 users,  load average: 0.04, 0.10, 0.12
Tasks: 161 total,   1 running, 160 sleeping,   0 stopped,   0 zombie
Cpu(s):  3.5%us,  1.8%sy,  0.0%ni, 94.2%id,  0.4%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   3985464k total,  3369908k used,   615556k free,   752964k buffers
Swap:  1951740k total,       12k used,  1951728k free,  1439160k cached

My laptop as 3985464 kilo-bytes of memory total. But the linux kernel would cache most of that internally, so top only shows 619748kB of free memory. But if you look at it using the free command, you understand that, in fact, most of the memory is available... in the cache.

$ free
             total       used       free     shared    buffers     cached
Mem:       3985464    3365716     619748          0     752796    1439152
-/+ buffers/cache:    1173768    2811696
Swap:      1951740         12    1951728

The real free memory is the one shown on the buffers/cache line.

             total       used       free     shared    buffers     cached
-/+ buffers/cache:    1173768    2811696

This machine as 2.8GB of free memory.

  • This is pretty confusing since I guess I don't understand the role of the cache. What do you mean by "the linux kernel would cache most of [total memory of 3985464k]"? You state that top then only shows another number, but only shows means the other number will be less, yet the number you quote is greater. Insert head-scratch smiley here. – Adam Dec 7 '17 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.