IssueRaiser

Docker process doesn't free up memory - macOS, Apple Silicon, Virtualization.framework

With Virtualization.framework enabled the Docker process (not Virtual Machine Service) grows in memory-usage and doesn't free it up properly. After some testing I noticed, that it seems to be related to transfers between host and docker-container. Easiest example: copy a 1GB file using "docker cp" and the memory-usage will grow by 1GB. But happens with other stuff too (like importing a db with local client over a host-bind port). Example: ``` dd if=/dev/zero of=output.dat bs=1m count=1024 docker run -d --rm --name mem_test alpine tail -f /dev/null docker cp output.dat mem_test:/tmp/ # Watch Memory grow in Activity Monitor ``` I've seen the discussion about "Memory" and "Real Mem" in Activity Monitor and first thought "okay, Real Mem returns to normal after some time so it will be fine" but then I noticed, that MacOS starts swapping when "Memory" value gets to big even "Real Mem" is just some MB. <img width="688" alt="image" src="https://user-images.githubusercontent.com/6104256/147954171-31543408-433b-4ccb-b22d-b00ae9b482a3.png"> <img width="595" alt="image" src="https://user-images.githubusercontent.com/6104256/147954209-9b305792-8aaf-42ac-9ee8-f4ea6366c693.png"> After restarting Docker (from docker context menu) everything goes back to normal again.. So I'm currently restarting Docker every time memory usage gets to huge.. I've usually 20+GB of free memory and no swap usage if I don't forget to restart Docker, so it's deff it. I'm using the most recent version: Do

Posted by z1r0- on Jan 3, 2022, 5:38 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Other)

Docker process doesn't free up memory - macOS, Apple Silicon, Virtualization.framework

z1r0-Jan 3, 2022, 5:38 PM

With Virtualization.framework enabled the Docker process (not Virtual Machine Service) grows in memory-usage and doesn't free it up properly. After some testing I noticed, that it seems to be related to transfers between host and docker-container. Easiest example: copy a 1GB file using "docker cp" and the memory-usage will grow by 1GB. But happens with other stuff too (like importing a db with local client over a host-bind port). Example: ``` dd if=/dev/zero of=output.dat bs=1m count=1024 docker run -d --rm --name mem_test alpine tail -f /dev/null docker cp output.dat mem_test:/tmp/ # Watch Memory grow in Activity Monitor ``` I've seen the discussion about "Memory" and "Real Mem" in Activity Monitor and first thought "okay, Real Mem returns to normal after some time so it will be fine" but then I noticed, that MacOS starts swapping when "Memory" value gets to big even "Real Mem" is just some MB. <img width="688" alt="image" src="https://user-images.githubusercontent.com/6104256/147954171-31543408-433b-4ccb-b22d-b00ae9b482a3.png"> <img width="595" alt="image" src="https://user-images.githubusercontent.com/6104256/147954209-9b305792-8aaf-42ac-9ee8-f4ea6366c693.png"> After restarting Docker (from docker context menu) everything goes back to normal again.. So I'm currently restarting Docker every time memory usage gets to huge.. I've usually 20+GB of free memory and no swap usage if I don't forget to restart Docker, so it's deff it. I'm using the most recent version: Do

Comments (0)

No comments yet. Start the discussion.

Comment on this issue