views:

555

answers:

1

From free -m i can see that there is 377MB of memory used and 1649MB free on the machine(Of which 1567 is cached by ubuntu). See below for the actual output:

caz@riskvm:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          2026       1975         51          0         30       1567
-/+ buffers/cache:        377       1649
Swap:         3153         87       3065

However when I look at top's output I can see processes using 1GB and 273MB in the RES column. RES means resident in non-swapped physical memory from the top man page.

top - 11:45:26 up 1 day, 38 min,  3 users,  load average: 0.27, 0.21, 0.23
Tasks: 125 total,   1 running, 123 sleeping,   0 stopped,   1 zombie
Cpu(s):  0.2%us,  6.6%sy,  0.0%ni, 92.8%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2075560k total,  2023796k used,    51764k free,    31264k buffers
Swap:  3229024k total,    89764k used,  3139260k free,  1605400k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6689 root      20   0 1242m 1.0g 1.0g S   13 51.1 292:59.21 vmware-vmx
 6658 root      20   0  492m 273m 262m S    2 13.5  41:16.75 vmware-vmx
    1 root      20   0  2844  536  484 S    0  0.0   0:01.50 init
    2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S    0  0.0   0:00.02 migration/0

I understand that some of that is shared by other processes (Shared objects and the like). But if there is 1GB of memory shared by other processes, surely at least that much must be used?

How does free report 377MB of memory used and when I look at top I see processes using 1GB and more RES memory?

+4  A: 

The resident memory reported in top includes things like mmaped framebuffers in graphics cards, nics and other "non-ram" memory. The memory reported by free is strictly ram + swap.

Ronny Vindenes
Comparing 377MB with 1GB; that seems to be a lot of memory mapped framebuffers, about 600MB. The 1GB process is a VMWare process, would it be using that much non-ram memory?
Caz
What is your graphics card, how much memory is on it? 512 MB is certainly not uncommon these days, for desktop machines at least ...
unwind
Yeah, I think with PAE, you address your 4G of real address space as 3.5G below the line and 0.5G above (because the top of your 4G address space is for memory-mapped stuff) - that puts it at 512M.
paxdiablo
lspci reports the video card to have 256MB. What has me suspicious is that I asked VMWare to allocate exactly 1GB main mem to the vm. Which is what top is reporting. I also wonder whether vmware would mmap non main memory since many vm's would contend for the same resouce...
Caz