When creating a virtual machine, you are asked to allocate some memory to it. When allocating the memory to the VM, it’s necessary to consider the actual system memory. We have noticed that VirtualBox is unable to allocate and lock memory as the host doesn’t have enough system memory. In this post, we will discuss in detail how to resolve this issue.
An error has occurred during virtual machine execution! The error details are shown below. You may try to correct the error and resume the virtual machine execution.
Unable to allocate and lock memory. The virtual machine will be paused. Please close applications to free up memory or close the VM.
Error ID: HostMemoryLow
Severity: Non-Fatal Error
Fix VirtualBox unable to allocate and lock memory
If VirtualBox is unable to allocate and lock memory, follow the solutions mentioned below.
- Check and ensure no other virtual machine is currently running on your system
- Check if an application is taking a lot of memory
- Reboot your system and then start your virtual machine
- Increase Virtual Memory or Page File Size
- Allocate less RAM to your virtual machine
- Add some RAM to your system
Let us discuss them in detail.
1] Check and ensure no other virtual machine is currently running on your system
If a virtual machine is running on your computer, naturally, your host computer will allocate some memory to it. Due to this, the host will not have enough RAM to grant to the VM that you are trying to start. So, make sure that all the VMs are in the “Powered Off” state before booting up a VM.
2] Check if an application is taking a lot of memory
Not just a VM, but an application can too consume a lot of memory leaving little to no RAM for your virtual machine. So, we need to open the Task Manager and enquire which are all the apps taking a huge chunk of your RAM. If you conclude that a process is taking way too much memory, go ahead and terminate its task. You can right-click on the process and select End task. Once you have terminated all the memory-consuming apps, launch your virtual machine and check if the issue persists.
In case, you are unable to figure out what’s consuming high memory, do a clean boot without disabling VirtualBox-related services, and find out the culprit.
3] Reboot your system and then start your virtual machine
Sometimes, the host system might have enough memory but it is not a big block of memory instead, it is a collection of small fragments. In order to get this issue resolved, we recommend you reboot your device and once it starts, straightaway boot up your virtual machine. It should do the trick for you.
4] Increase Virtual Memory or Page File Size
A Pagefile, also known as a paging file, is a reserved portion of a storage drive used as an extension of random access memory (RAM) for data that hasn’t been used recently. Since there is a shortage of memory, we will go ahead and increase the Page File size. To do so, follow the steps given below.
- Search out “Advanced System Settings”.
- Go to System Properties > Advanced > Settings (from the Performance section).
- Then, go to the Advanced tab > Virtual Memory > Change.
- Uncheck Automatically manage paging file size for all drives
- Check the system drive and select Custom size
- Change the Initial size value and the Maximum size value to a higher value and then click Set
- Finally, Click Apply/OK.
It should do the trick for you.
5] Allocate less RAM to your virtual machine
If no VMs or apps are consuming your system resources but you are unable to launch a machine due to the lack of system memory, we should reconsider allocating a large portion of our system memory to the VM. In order to resolve this issue, we will make some changes to the configuration of your virtual machine and reduce the Base Memory by 1 to 2 GBs. Follow the steps given below to do the same.
- Open Oracle VirtualBox.
- Right-click on the problematic VM and select Settings.
- Now, go to the Systems tab and then change the Base memory using the slider.
- Finally, click Ok.
You can now, reboot the host computer and check if the issue is resolved.
6] Add some RAM to your system
You might be able to resolve the issue after changing the Virtual Memory and the Base Memory of your VM, but the experience won’t be something to rave about. Hence, we recommend you increase the memory of your system and not change the Base memory of your VM as that can exacerbate your experience.
That’s it!
Read: Why is my RAM usage so high when nothing is running?
How to allocate more RAM to VM VirtualBox?
To allocate more RAM to your VM, just change the Base Memory of your machine. To do so, open the settings of your machine, go to System, and then change the Base Memory. Finally, save the changes and you will be good to go.
Is 1GB RAM enough for VirtualBox?
1GB is the bare minimum RAM you need to allocate to your VirtualBox. Still, we recommend you at least allocate 2 to 3GB of RAM if you don’t want your VM to be stopping in the middle of a session.
Also Read: Fix VirtualBox Error VERR_ALREADY_EXISTS error.