Hello everyone. I have a problem and its that when im using virtual machines, after a while the operation becomes slow and there are some virtual machines that i cannot open due to lack of memory.
Im using Kubuntu 24.10
I have checked with the command vmstat -s -S M and the following appears: 32013 M total memory 11191 M used memory 6278 M active memory 18262 M inactive memory 1145 M free memory
When I run sudo sh -c ‘echo 3 > /proc/sys/vm/drop_caches’ to free up memory, it appears like this:
32013 M total memory 1991 M used memory 1672 M active memory 669 M inactive memory 28946 M free memory
Once I have executed the previous command, a lot of memory is freed and the operation is smoother again, but I do not think this is an acceptable solution.
As you can see, the problem is that a lot of memory is left idle.
Why can this happen?
I have used Windows for a long time with these same virtual machines and I have had absolutely no problems.
However, here it becomes really heavy and horrible.
Thank you for your help and sorry for the inconvenience.
Thank you for providing the detailed memory statistics. Let me help break down what we’re seeing and ask for some additional information that will help diagnose the issue.
First, let’s address what we can see:
Your system has about 32GB total RAM
Linux is behaving as designed - it’s using available memory for disk caching (what you see as “inactive memory”)
When you force-clear the cache with drop_caches, you’re clearing useful disk caches that actually help performance
The “inactive” memory isn’t really waste - it’s memory Linux keeps around to speed up your system, but will immediately give up if programs need it
However, to properly diagnose your VM performance issues, we need some additional information:
What virtualization software are you using? (VirtualBox, VMware, KVM/QEMU, etc.)
How many VMs are you trying to run simultaneously?
How much RAM have you allocated to each VM?
Are you seeing any specific error messages when VMs fail to start?
What kind of workload are you running in these VMs?
The hibernation setup probably isn’t related to this issue, but it would be good to know:
6. How much swap space do you have configured? (You can check with free -h)
Unlike Windows, Linux tries to use available RAM for caching, which is why you see high memory usage even when programs aren’t actively using it. This is actually beneficial for performance. The error you’re seeing about not being able to open VMs is more likely related to how your VMs are configured rather than system memory management.
Could you provide these details so we can better assist you?
Hello Popey, thank you for your message. I will try to provide you with as much information as possible.
What virtualization software are you using? (VirtualBox, VMware, KVM/QEMU, etc.)
Im using Virtual Box.
How many VMs are you trying to run simultaneously?
Im using 2-3 Vms, Virtual Box software.
How much RAM have you allocated to each VM?
Im using 6 gb for 1 VM, 4 gb for 1 VM and 2 GB for all VMs.
Sometime i used 2 VMs, sometimes i used 3 VMs
Are you seeing any specific error messages when VMs fail to start?
Right now I dont have the error available because i havent found it in the logs, but i remember that it was something like insufficient memory.
What kind of workload are you running in these VMs?
Little workload, practically none.
How much swap space do you have configured? (You can check with free -h)
Inter: 11Gi (total) 1,3Gi (used) 10Gi (free)