How to interpret linux's top correctly?
We're running to profile a java program on its memory usage. We have a 512 ram box and top shows that 500 or so MB of ram 开发者_JS百科is used with very little free. However over at the RES column we can see that the jvm is only using 100MB or so. And all the other processes are not even significant (less than 1k). So what exactly is consuming all the memory or are we just reading the top wrong?
That 500MB includes memory used by the page cache - cached parts of disk files. This memory is reclaimable for use by processes - so if you add the memory listed as "free" to that listed as "cached", then you will have the memory that is still available for use by tasks.
Alternatively, you can use the free
command, which lists this figure in the "free" column on the -/+ buffers/cache:
line.
Also memory that is used by multiple applications (think dynamic libraries) is counted every time it is referenced even though it takes up one copy. Try using htop
too.
That's reserved memory. The process doesn't use it, it's reserved for it. Should another process want to allocate more memory, it would get the permission.
精彩评论