I have installed Ubuntu in VirtualBox under OS X on a MacBook Pro.

The laptop has 16 GB RAM, and I assigned about 11 GB to Ubuntu, because I thought that most work would be done in Ubuntu anyway.

But some said that I have to give OS X sufficient RAM, to maintain Host regular operations.

Is 5 GB too little for OS X?

I noticed that when the guest Ubuntu is running, waking up of OS X from sleep can take 30 secs or so. If OS X can have more RAM, will it wake up sooner?

  • To start an answer, it would be helpful to know two things. 1. What is your level of comfort running VM_stat on Linux to check for virtual memory paging activity and swap file usage? 2. Are you using your phone to as a main desktop machine where it's fullscreen and lots of apps will be running. Or are you going to have multiple guest operating systems running in the background and doing most of the work on the Mac?
    – bmike
    Jun 12, 2016 at 15:06
  • 1. I am comfortable with command line interface and bash. 2. I am not sure if I will have another virtual machine or guest os alongside the guest Ubuntu, and right now I don't see I will need one. Most of my development work will be done in the guest Ubuntu, and some lightweight work such as internet browsing or MS Office software might be done in Mac or might not. So I would like to know the range of ram assigned to a guest os or virtual machine under Virtualbox, considering the amount of ram reserved for the host os i.e. OS X.
    – Tim
    Jun 12, 2016 at 15:19
  • Wonderful - this might be candidate for closing as too broad - let's try an answer and you can ping me in the Ask Different Chat or we can find some related questions to go over concepts for you.
    – bmike
    Jun 12, 2016 at 15:25

1 Answer 1


My best practice is to think about how to get the best use of your RAM and not make configuration decisions that lock down memory and instead monitor for problems on each OS and then make small adjustments.

On the Mac - open Activity monitor and watch the memory pressure. I would try to keep things in Green. If you are in the orange, that's ok, but you might want to try changing the reservations (less RAM to ubuntu guest or quit apps on either OS that take most active memory). In the red, you will be swapping and slowing down the response times.

enter image description here

So - you have 16 GB of RAM and one OS X running the hardware with Ubuntu running in Virtual Box. Virtual box makes a file or files to act as the storage for Ubuntu but OS X is handling all the actual reads/writes.

Second - both Ubuntu and OS X use virtual memory so that you could allocate 1 GB of Ram to the guest OS and it will use a swap file to make more memory as needed.

To initially monitor things, I would open terminal on both the host and guest and run something like vm_stat 5 - pay attention initially to only two numbers - the free and the swap out. Also pay attention to the memory pressure on OS X.

Over time, you can shift to logging things more slowly with vm_stat 60 / vmstat 60 or even time stamp the usage.

Since free memory is a waste on both OS X and Ubuntu - you will want to allocate all the RAM to OS X so it can cache all the file input and output for both OS X and virtual box. Allocating too much memory on ubuntu will make the OS X starved for RAM to cache the guest OS. Add memory to the guest OS when the applications you run there start to swap out to disk.

Here are some links to get started on tuning and learning:

  • Thanks. Is the amount of memory that I specified when creating the virtual machine for the guest Ubuntu reserved for the guest Ubuntu, and not available for host OS X to use, even when most of it is not used by the guest Ubuntu yet?
    – Tim
    Jun 12, 2016 at 16:49
  • What do App Memory, Wired Memory, and Compressed mean?
    – Tim
    Jun 12, 2016 at 16:58
  • Is it correct that the RAM for a virtual machine adjustable?
    – Tim
    Jun 12, 2016 at 16:59
  • In Ubuntu, it is vmstat not vm_stat. I used free before.
    – Tim
    Jun 12, 2016 at 17:04
  • Yes - that's why I put "with vm_stat 60 / vmstat 60 " to show the differences. It's too broad to explain all of virtual memory here. Basically, when you configure the VM to get 11 GB you remove that completely from OS X side so make that smaller and only change it up when ubuntu is slow or has memory errors / swapping.
    – bmike
    Jun 12, 2016 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .