Linux – Vmware memory usage shows differently from linux

linuxmemoryvmware-esxi

I have a new system running under VMware, and I'm just trying to make sense of the memory use.

In vSphere client, it shows me active using 335,544 KB:

enter image description here

However, linux shows me using 3,146,148 KB:

root@PFDEV-SVN:~# free -k
             total       used       free     shared    buffers     cached
Mem:       4118636    3146148     972488          0     477216    1268364
-/+ buffers/cache:    1400568    2718068
Swap:      6040400          0    6040400

Why is this so different? Am I just reading this incorrectly?

This is Ubuntu 9.10, without vmware tools installed, running on an ESXi server.

Best Answer

There is a detailed white paper on the topic of memory management and calculations of the active memory working set size.

It basically all boils down to the fact that a guest is not using all the memory that has been assigned to it all the time. Instead, only certain ranges of memory are considered "active" at a particular time period, making the "inactive" memory a candidate for swapping, if you happen to overcommit your physical memory. You should look at the "consumed" memory if you want to roughly match it up with the memory usage within your host (deviations due to memory pages shared across several VMs may occur).