Understanding memory usage in Docker Desktop on
There have been many reports of possible memory leaks and apparent high memory usage of
Docker Desktop since the upgrade to macOS 10.14 (Mojave). This document summarises the
investigation into these reports and includes recommendations to help users better understand
the memory usage of the system.
1. The memory used by Docker Desktop does not grow over time, i.e., there is no memory
2. The system is able to recover memory from Docker Desktop and give it to other
processes if the system is under memory pressure. This is not reflected in the headline
memory figure in the Activity Monitor, but can be seen by looking at the Real Memory.
3. The headline memory figure also has a double-counting bug in MacOS Mojave, causing
it to report double the actual memory allocated. We have reported this bug to Apple.
1. Add and then monitor the “Real Mem” column in Activity Monitor which counts exactly
how much physical memory a process is taking right now. This value will move up and
down depending on which part of the system needs the memory most.
Ignore the “Memory” column (the default column) in Activity Monitor which counts VM
memory twice due to a bug in macOS 10.14 (Mojave) which has been reported to Apple.
Understanding memory on the Mac
Modern operating systems like macOS use “virtual” memory. Each process has its own separate
“address space” which can be much larger than the amount of physical memory in the machine.
When a process allocates memory (e.g. via calling malloc(3)), macOS will simply mark a range
of virtual addresses as used but it will not actually allocate any physical memory. Physical
memory is allocated on-demand, when the virtual memory is first read or written. When some
physical memory hasn’t been used for a while and the machine is under “memory pressure” (i.e.
it is nearly full), macOS will save the contents of the memory to disk (a process known as
“swapping”) so the physical memory can be recycled. If the pro