I have a bunch of vms in my laptop and need regularly to change their ram size because I have only 8 GB ram. As I said before I use linux kvm for virtualization. Virsh is my tool to manage vms that runs on kvm hypervisor. There is the value to configure ram size the first one is the max size which limits the size of ram and the other is size which currently used by vm. But there is some tricks where max size can only be change while vm is off but size is only change when vm is running. So first the vm max size should be set.
Here we need root privileges to use virsh and than use setmaxmem command for vm named debian and give value 4 GB
$ sudo virsh setmaxmem debian 4G
After starting vm run the similar command except max word like this.
$ sudo virsh setmem debian 1G