Dynamic Memory in action with Hyper-V 2012/R2 – Part 2

|

Published on | Updated on February 28, 2021

2 Min. Read

Hello Folks,

In Part 1 we covered Understanding Dynamic Memory in Hyper-V 2012/R2.

Today’s post will show Dynamic memory in Action :)

So let’s get started…

We have a Virtual Machine here set with 2GB as Startup RAM, minimum 512MB and maximum is 4GB RAM.

DynMemory-Demo1

What can I see right now, this is actually been assigned with 640MB that actually shrunk from the startup amount 2GB.

DynMemory-Demo2

If we actually look inside the guest Operating System in Task Manager, what we can see is it still thinks it has 2GB because you can’t really take memory away from the virtual machine.

DynMemory-Demo4

What happens is that balloon driver (kernel device driver) tells the OS give me some memory, and that basically balloons driver consumes that memory, and then tells the Hypervisor hey, here is the memory block you can take this back :)

We can’t directly look at that, but with the RAMMap tool from Sysinternals can show that the Driver Locked is consuming around 1.5GB, which is roughly the difference between 2GB startup and the amount that actually is allocated right now (615MB + Memory buffer).

DynMemory-Demo3

But this Virtual Machine can actually grow up to 4GB Maximum RAM, so what I want to do is going to apply some memory pressure to this Virtual Machine.

Let’s consume Physical Memory…

DynMemory-Demo5

What this actually is doing putting it under pressure.

If we look at the Hyper-V is assigned that full amount 4GB :), as you can see now and it is in a Warning state because the memory demand actually want this amount [4,423MB].

DynMemory-Demo6

When we cancel the memory pressure, the memory won’t be reclaimed straight away. You can see now is demand dropped right down, so now we have a huge amount of free memory.

DynMemory-Demo7

If we look at the balloon driver and refresh, note that the driver locked basically went away, because that balloon shrunk right down and effectively reclaimed that memory from Hyper-V and gave it back to the Operating System.

DynMemory-Demo8

What will see is, eventually a cleanup will actually happen and now it’s need this amount + 20%.

Will see the Assigned Memory will dropped and that balloon driver locked will actually go up again.

DynMemory-Demo9

Give it some time… Going back to the guest OS and refresh, you can see all that memory is now assigned to the Driver Locked cause that balloon driver took it and the Hypervisor reclaimed it.

DynMemory-Demo10

Now note the memory will always stays @ 4GB because you can never truly take memory away as far as the Operating System is concerned, it is still thinks it has 4GB but out of that a huge chunk of it is being consumed by this greedy Kernel device driver :)

DynMemory-Demo11

Hope this has been useful.

Until next time… Enjoy your day!

Charbel,

 

Previous

Understanding Dynamic Memory in Hyper-V 2012/R2 – Part 1

Moving operation error using Cross-Version Live Migration in Hyper-V 2012/R2 with Constrained Delegation enabled

Next

Let me know what you think, or ask a question...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Stay in Touch

Never miss out on your favorite posts and our latest announcements!

The content of this website is copyrighted from being plagiarized! You can copy from the 'Code Blocks' in Black.

Please send your feedback to the author using this form for any 'Code' you like.

Thank you for visiting!