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?
The resident memory reported in
top
includes things like mmaped framebuffers in graphics cards, nics and other "non-ram" memory. The memory reported byfree
is strictly ram + swap.