Skip to content

Conversation

@afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented Oct 19, 2025

Issue #4220

Usage:
  limactl memory [command]

Available Commands:
  get         Get current memory
  set         Set target memory

The get command is supposed to return a reasonable value for instance memory, with the current workload.

Note: the values reported in "total" and "used" memory within the guest might or might not include the balloon

Example with VZ (4 GiB), the balloon (2GiB) is included in the "used" memory and also in the "total" memory:

               total        used        free      shared  buff/cache   available
Mem:            3901        2413         831           1         802        1488
Swap:              0           0           0
$ limactl memory get default
WARN[0000] `limactl memory` is experimental             
592

Example with QEMU (4 GiB), the balloon (2 GiB) is not in the "used" memory but subtracted from "total" memory:

               total        used        free      shared  buff/cache   available
Mem:            1850         400         846           1         747        1449
Swap:              0           0           0
$ limactl memory get qemu
 WARN[0000] `limactl memory` is experimental             
578

The set command sets the target memory size, so if you want to use only half of default it would say "2048".

Note: currently this only inflates the balloon inside the guest, but doesn't actually return any memory to the host

$ limactl memory set default 2048
WARN[0000] `limactl memory` is experimental             
$ limactl memory set qemu 2048
WARN[0000] `limactl memory` is experimental             

Includes workaround for issue:

More information on balloons:
https://rwmj.wordpress.com/2010/07/17/virtio-balloon/

@afbjorklund afbjorklund reopened this Oct 20, 2025
@afbjorklund afbjorklund force-pushed the vz-memory branch 3 times, most recently from 537f206 to fec63ad Compare October 20, 2025 21:58
Make it possible to set target memory size, for an instance.

This way it should be possible to return memory to the host.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant