24

I'm running VirtualBox on a Windows XP machine with 2GB RAM. I've created a virtual Ubuntu machine and allocated it a base memory of 750MB.

Just to put it to a test, I ran 20 things at once on the virtual machine. According to "top" in ubuntu, 750 megs of memory were being used, as well as considerable swap space.

However, back in Windows Task Manager, VitrualBox was using only 45,000K of memory. As I asked the virtual machine to do more and more, the CPU usage of the VirtualBox process went up (in Windows) but memory usage stayed the same.

How can a virtual machine that is using 750 MB of memory only consume 45 MB of memory on a physical machine?

I assume the answer is that the virtual machine is not using real memory, but simulated memory (i.e. swap space), but it sure feels snappy like it is running in RAM.

UPDATE: I've played around with perfmon as suggested. Even summing up everything I can think of, it still seems to take up less than 300 megs ... so it is still a mystery.

Process               VirtualBox     VirtualBox#1     Total
PoolNonpagedBytes     5,840          42,552           48,392
PoolPagedBytes        119,796        166,892          286,688
PrivateBytes          8,884,224      52,719,616       61,603,840
VirtualBytes          75,939,840     161,202,176      237,142,016
Sum                   84,949,700     214,131,236      299,080,936

4 Answers 4

7

The columns in Task Manager can give misleading figures -- for accurate memory usage per process, you could use perfmon (Performance Monitor in Control Panel) and look at the "private bytes" figures.

To show this, go into perfmon, click to add the counter (I'm a Ctrl+I kind of person). The "Performance object" would be "Process", with "Private bytes" being in the counters list -- obviously you'd need to select the relevant process from the right hand list.

5
  • Hi. I tried this but had no luck finding anything called Private Bytes. Can you give a step-by-step?
    – dggoldst
    Aug 4, 2009 at 7:49
  • Have added... Aug 4, 2009 at 7:58
  • Thanks, this is very helpful. I've added the analysis to the question. Still can't figure out why it doesn't sum to 750 though.
    – dggoldst
    Aug 4, 2009 at 10:08
  • Very odd. I could point out that PrivateBytes is a subset of VirtualBytes (Virtual bytes is the proportion of address space allocated, whilst private bytes is that memory that hasn't been freed yet - you can get fragmentation of memory with a small memory leak, and have applications die with not enough memory, even when there is plenty available). It may be that the virtualisation driver is allocating the memory in a way that means it won't show up, which would makes sense as the memory should be immune from paging out to disk. Aug 4, 2009 at 13:01
  • Of the four counters you put in your table, only "PoolNonPagedBytes" is a count of nonpageable virtual memory, hence that amount of physical memory will be used.The others are all virtual. Like any other virtual memory size the actual RAM it uses is almost always much less, That's one of the whole points of virtual memory. Sep 26, 2017 at 21:55
4

With some virtualisation solutions under Linux, the way they allocate memory makes it appear to the host kernel as a special memory-mapped file (much like the /proc/kcore special file) so it is counted in the "cached" count in the output from free, not the "used" count.

I presume something similar is happening with your Windows environment: the 45Mb will be used by the management processes of VirtualBox, and the 750 allocated to the VM itself will be counted elsewhere.

0

It could be virtual memory, memory-mapped files, or something similar.

Have you tried displaying other columns in Task Manager?

0

Don't believe Task manager. It can't see everything.

This issue is more commmonly seen with SQL Server, for example With Sql, I have never found anyone who told me a way of getting accurate info from Task Manager which would lead me to believe that the figure isn't hidden away in one of the other columns.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .