Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been running several VM's with VirtualBox, and the memory usage reported from various perspectives, and I'm having trouble figuring how much memory my VMs actually use. Here is an example:

  • I have a VM running Windows 7 (as the Guest OS) on my windows XP Host machine.
  • The Host Machine Has 3 GB of RAM
  • The Guest VM is setup to have a base memory of 1 GB
  • If I run Task Manger on the Guest OS, I see memory usage of 430 MB
  • If I run Task Manger on the host OS, I see 3 processes that seem to belong to VirtualBox:
    1. VirtualBox.exe (1), using 60 MB of memory (This one seems to have the most CPU usage)
    2. VirtualBox.exe (2), using 20 MB of memory
    3. VBoxSvc.exe, using 11.5 MB of memory
  • While running the VM, the Host OS's memory usage is about 2 GB
  • When I shut down the VM, the Host OS's it goes back to memory usage goes down to about 900 MB

So clearly, there are some huge differences here. I really don't understand how the GuestOS can use 400+ MB, while the Host OS only shows about 75 MB allocated to the VM. Are there other processes used by VirtualBox that aren't as obviously named?

Also, I'd like to know if I run a machine with 1 GB, is that going to take 1 GB away from my host OS, or only the amount of memory the Guest machine is currently using?

Update:

Someone expressed distrust over my memory usage numbers, and I'm not sure if that distrust was directed at me, or my Host OS's Task Manager's reporting (which is perhaps the culprit), but for any skeptics, here is a screenshot of those processes on the host machine:

VirtualBox task manager

share|improve this question
    
I was wondering the exact same thing earlier today when running two VBox VMs at once. –  CodeByMoonlight Nov 6 '09 at 22:03
    
In Task manager, turn on some of the other memory columns (View->Select Columns...). Memory is counted in many different ways in Windows. For instance, "commit size" can be dramatically higher than "Memory Usage." Exactly which to use and how to interpret them is a different story. –  lilbyrdie Nov 6 '10 at 14:43

7 Answers 7

To understand the process architecture of VirtualBox see
The VirtualBox architecture :

Once you start a virtual machine (VM) from the GUI, you have two windows (the main window and the VM), but three processes running. Looking at your system from Task Manager (on Windows) or some system monitor (on Linux), you will see these:
1. VirtualBox, the GUI for the main window;
2. Another VirtualBox process that was started with the -startvm parameter, which means that its GUI process acts as a shell for a VM;
3. VBoxSVC, the service mentioned above, which is running in the background to keep track of all the processes involved. This was automatically started by the first GUI process.

As regarding memory, the User Manual states:

Base memory
This sets the amount of RAM that is allocated and given to the VM when it is running. The specified amount of memory will be requested from the host operating system, so it must be available or made available as free memory on the host when attempting to start the VM and will not be available to the host while the VM is running. This is the same setting that was specified in the "New Virtual Machine" wizard, as described with guidelines under the section called “Creating a virtual machine” above.

This means that the guest takes out of the host:
- As much memory as it was declared with
- Each VM is also a VirtualBox executable, so you need to add its memory.

It's always possible that the VirtualBox manual is several versions behind, and that the latest memory optimizations technique are not documented.

In addition, VirtualBox may be optimizing memory usage by not allocating the entire defined VM memory. Allocating memory as required is an optimization that can save a lot on physical memory, but memory-intensive processes in the VM may be slowed down by the frequent need by VirtualBox to request more host memory.

share|improve this answer
5  
It's not VirtualBox specific - see this : serverfault.com/questions/19935/… –  CodeByMoonlight Nov 6 '09 at 22:05
    
@harrymc, so what you are saying is that task manager does NOT show in the process list how much memory virtual box is using? –  Trevor Boyd Smith May 31 '11 at 14:43
    
@TrevorBoydSmith: All I am saying is that there is more than one process involved and to choose correctly the columns in task manager. –  harrymc May 31 '11 at 15:41
1  
my vm takes up 1.2 GB. on task manager it only shows 60MB. so therefore i would claim that task manager doesn't show all the memory that my vm is using. unless you can somehow show me how to tweak task manager to show 1.2gb. –  Trevor Boyd Smith May 31 '11 at 16:42
    
@TrevorBoydSmith: Which column in task manager is the 60MB in ? You could click the column twice to sort in descending order to locate the real process. –  harrymc May 31 '11 at 19:26

The only place in Task Manager that seems to reflect the full amount is on the performance tab - the Total Commit Charge value roughly keeps pace with the amount allocated to the VM. I just closed one with 1536MB allocated, and the commit charge went down from about 2.4GB to 0.8GB. You can monitor to some extent this against Virtual Box using the Performance Monitor, and choosing the Process : Private Bytes counters for VirtualBox, VBoxSvc, and also VirtualBox#1, #2, etc (one for each running VM). There's also the Memory : Committed Bytes counter for everything.

share|improve this answer

Could be related to the VirtualBox Guest Additions.

My Ubuntu install is currently using ~20MB as reported by WinXP. This is with VBoxAdditions.

My Lubuntu install is currently using ~90MB as reported by WinXP. Just installed it; VBoxAdditions haven't been installed.

Memory usage does vary by what the VM is doing. I have my Ubuntu install running ziproxy; when I do something that talks to ziproxy, memory usage spikes a few megabytes as the VM comes into use.

In general, though, virtualization has advanced far enough that the specs apparent to the guest don't need to be wholly allocated from the host. Seems to use dynamic allocation, and strong paging.

share|improve this answer

A series of articles by Mark Russinovich on Sysinternals explaining how memory is handled in windows may be of interest: Pushing the Limits of Windows: Physical Memory

share|improve this answer

Those entries you see in TaskManager are not for your virtual machine, they are for the VirtualBox GUI. The performance tab will clearly show you how much of your total memory is being used, but with no granularity regarding processes. I personally would like to see VBox use only what it needs, but agree it's important for it to be able to use as much as it expects, hence the ring-fencing.

share|improve this answer

This looks to be a Windows problem. View the third post here: http://forum.sysinternals.com/pe-is-not-showing-all-memory-used-by-virtualbox_topic23886.html

Using a program like VMMap definitely does show that the memory you tell VBox to use is actually being used. No idea why it's not visible to task manager or process explorer.

share|improve this answer

I am also constantly amazed at how litte memory virtualbox uses, and this was true even under XP where I felt I "understood" how the memory values worked very well.

I suspect it does have some nice optimizations to enable this. I know it probably uses the full address space of the guest.

share|improve this answer

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.