Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a bit confused by the memory stats that htop is reporting on one of our servers. On the top bars, it's showing system memory as:

Mem: 456 / 7950MB

So, looks very low usage.

However, my main process is showing it's memory usage as:

VIRT    RES     SHR     MEM% 
13.3G   2388M   2239M   30%

Hmm, a lot higher.

Why are the system stats only showing 456MB used, when the process reports that it's using 2388MB?

Update Here's the output from free:

             total       used       free     shared    buffers     cached
Mem:       8141292    5425364    2715928          0     103560    4839368
-/+ buffers/cache:     482436    7658856
Swap:      2097148          0    2097148
share|improve this question

2 Answers 2

Htop show memory: MEN TOTAL, USED, BUFFERS AND CACHE. If you sum used, buffers and cache you will have result equals result of command free. Htop you need to consider all results because process can use any memory. Man htop describe memory is:

   M_SIZE (VIRT)
        Size in memory of the total program size.

   M_SHARE (SHR)
        The size of the process’s shared pages

   PERCENT_MEM(MEN%)
        The percentage of memory the process is currently using (based on the process’s resident memory size, see M_RESIDENT below).

   M_RESIDENT (RES)
        The resident set size, i.e the size of the text and data sections, plus stack usage.

I hope I´ve helped.

share|improve this answer

Why are the system stats only showing 456MB used, when the process reports that it's using 2388MB?

You are misinterpreting htop output.

It reports 456 MB are free out of 7950MB of total RAM.

share|improve this answer
    
In that case, it would be the opposite convention to the swap usage shown directly under it (currently showing 0/2074 with no swap file usage) - are you sure? –  UpTheCreek Mar 8 at 16:06
    
You are right. Might be a bug. What htop version are you using ? Can you post a screenshot of htop output ? What says the free command ? –  jlliagre Mar 8 at 16:29
    
I've updated the question with the output from free - will try to post a screenshot later. free is reporting about 5.4GB in use / 2.7GB available. I'm under the impression that htop generally shows higher memory usage than other tools, so I guess htop must mean 456MB free as you say, still, it seems very low. –  UpTheCreek Mar 8 at 17:29
    
Oh, and htop version is 0.8.3 –  UpTheCreek Mar 8 at 17:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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