Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Hyper-V 2012 R2 server running a number of virtual machines with Dynamic Memory enabled. They all exhibit this behaviour, but here is an example:

One of the VM's is a Windows Server 2012 R2 guest, and it's not doing much. Basically sitting there idling. It was doing a lot of work (it had launched a number of processes which allocated a bunch of memory, used some CPU, and then quit), but has now completed.

Task manager inside the VM shows the following memory statistics:

  • In Use: 5.5 GB
  • Available: 302 MB
  • Committed: 5.6/6.9 GB
  • Cached: 299 MB

The "Memory Composition" graph says that 5629 MB is "In Use" by applications, drivers, etc (i.e. it's not being used as file system cache). I've also run perfmon and the counters there line up with the task manager ones.

Switching to the list of processes in task manager inside the VM, there is nothing using anything close to 5 GB of memory. Summing them all up comes to well under 1 GB.

For more information, Hyper-V manager on the host system shows that this VM has

  • Assigned Memory: 706 MB
  • Memory Demand: 593 MB

This fits with the memory usage I get by summing up the process list in task manager in the VM.

So the question is:

Why does task manager inside my VM think that it is using 5.5 GB, when no processes appear to use this memory, and the Hyper-V host knows that it only needs 593 MB? What has happened?

share|improve this question
add comment

1 Answer

The Integration Components you installed when you built your VM included a driver which removes memory from the VM when that memory isn't needed. The way it removes it is that it allocates it from the memory manager within the guest OS and then gives it back to Hyper-V. It then looks, from within the VM, like it's "in use" because it has been allocated. This is referred to generally as "ballooning" and most hypervisors can do it, and even some physical systems do this too, using memory compression engines in hardware.

share|improve this answer
    
Except being factually wrong. When you run a smart guest (Server 2012 R2) then the drive ractualyl removes the memory from being SEEN by the OS.... the amount of total memory changes dynamically. No joke - it is quite funny to see a VM's available memory (task manager, resource view) to increase. –  TomTom Oct 8 '13 at 20:41
    
@TomTom - both the server and the guest are Server 2012 R2, so it should be a "smart" guest. I've seen the guest memory go UP, but I've never seen it go down... Interesting –  Orion Edwards Oct 8 '13 at 21:51
    
Well, that mostly depends what you do - on servers memory rarely goes down because you dont shut down servers. I have seen that mostly on WIndows VM's (clients) where people close their applications and log out and then the memory implodes. I rarely shut down servers without rebooting them immediately ;) –  TomTom Oct 9 '13 at 5:09
    
TomTom, I'm quite certain about how it works. (The guy who wrote the code is sitting two doors down from me at the moment.) Adding of memory beyond the "startup" value does, in fact add new memory to the VM. That memory can't be removed from Windows entirely, at least not without causing all the device drivers to be rewritten. So it's ballooned. –  Jake Oshins Oct 9 '13 at 19:53
add comment

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.