Use this when a VM swaps or balloons although the host has free memory.
Memory Limits
A memory limit caps the physical RAM a VM can use below its configured size; anything above the limit is ballooned or swapped even if the host has free memory. It is a common hidden cause of slow VMs.
1. A memory limit below configured memory forces ballooning/swap.
2. Rarely useful; often a mistake from templates.
3. Check for hidden limits when a VM swaps.
4. Size memory instead.
5. Remove unnecessary limits.
configured memory → limit → reclaim
Context & applicabilityCommon mistakes · platform/version boundaries
- Limits set lower than configured memory on templates.
- Using limits to simulate smaller VMs instead of resizing them.
- Not checking limits when a VM swaps on an idle host.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Finding memory limits Verify boundary
Get-VM | Get-VMResourceConfiguration | Where-Object { $_.MemLimitMB -ne -1 } | Select VM,MemLimitMB
In esxtop (m), compare MEMSZ with the limit; ballooning or swapping on a VM while the host has free memory points to a limit.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Remove memory limits unless there is a documented reason.
virsh setmem / virsh memtune <vm> --hard-limit— libvirt hard limitSet-VMMemory <vm> -MaximumBytes 8GB— Hyper-V dynamic maxGet-VMResourceConfiguration (PowerCLI)— vSphere memory limit
ReferenceWhy it matters1 section · depth on demand
Why limits are dangerous
A limit below the configured RAM forces ballooning or swapping even when the host has free memory, and the guest cannot see why. Leftover limits from templates are a classic cause of slow VMs. Check VM resource settings and remove limits unless they are deliberate (for example to model capacity).
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
A memory limit caps how much host memory backs a VM, regardless of its configured size. If the guest uses more than the limit, the hypervisor balloons or swaps the excess — the guest still believes it has its configured RAM, so performance degrades badly.
On VMware, memory limits are rarely appropriate; reduce configured memory instead. Hyper-V's equivalent is the dynamic memory maximum, which the guest sees correctly.
ReferenceConfiguration & state1 section · depth on demand
Removing limits
Get-VM vm01 | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemLimitMB $null
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Resource Management → Memory Limits. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/html/libvirt-libvirt-domain.html · confidence 94%