What is Dynamic Memory?
Dynamic Memory is a Microsoft Hyper-V setting that lets the host change how much RAM a virtual machine has while it runs. Instead of reserving a fixed amount, the VM boots with a set amount, and Hyper-V adds memory when the guest needs more and takes it back when the guest is idle, always within limits you choose. Memory freed from one VM can go to other VMs on the same host.
The settings
| Setting | What it controls |
|---|---|
| Startup RAM | Memory the VM gets when it boots |
| Minimum RAM | The least Hyper-V will shrink it to while running |
| Maximum RAM | The most it can be given |
| Memory buffer | Extra memory, as a percentage of current demand, kept assigned as headroom |
| Memory weight | Priority for memory when the host runs short |
For example, a lab VM might boot with 2 GB, drop to 1 GB when idle, and grow toward 8 GB during updates. The settings are on the VM's Memory page in Hyper-V Manager, or in PowerShell with Set-VMMemory. Dynamic Memory can be turned on or off only while the VM is shut down.
How it works
The guest operating system needs Hyper-V integration services, which are built into supported Windows versions and into the Linux kernel. Hyper-V adds memory by hot-adding it to the guest and reclaims memory through a balloon driver inside the guest, which hands unused memory back to the host. The host can't give out more physical RAM than it has: when several VMs want more at once, the ones with higher memory weight are served first.
When to use it, and when not to
- Good fit: several light or bursty VMs on one host, such as test labs, virtual desktops, or small servers that sit idle most of the day.
- Poor fit: workloads that size themselves at startup or manage their own memory, such as some database servers. Some vendors call for static memory; Microsoft's guidance for Exchange Server is one example.
- Plan the host: leave enough physical RAM for the host itself, and make sure the VMs' realistic combined demand fits, not just their startup amounts.
Other hypervisors use related techniques, such as memory ballooning in VMware ESXi, but Dynamic Memory is Hyper-V's name for the feature.
For the CompTIA A+ exam
Core 1 (220-1201) objective 4.1 covers virtualization concepts, including the requirements a VM puts on its host. Dynamic Memory isn't named in the objectives, but this course's VM requirements lesson mentions it. When sizing a host, plan RAM for the host plus every VM that runs at the same time, and know that Hyper-V can grow and shrink a VM's RAM within set limits.