Search code examples
macosdockerdocker-for-mac

Why is docker consuming so much VIRT memory?


I am running docker on my Mac OS X: 2,5 GHz Intel Core i7, 16 GB 1600 MHz DDR3.

The point is that it seems to be consuming TOO much VIRT memory, if I am reading the htop output correctly.

enter image description here

Is this normal? Or is there any problem behind it? My laptop is very slow.


Solution

  • This is illustrated by moby/moby issue 31594.
    That issue actually asks to run contrib/check-config.sh as a way to know more about the docker configuration being used.

    The same issue is illustrated since 2015 in #15020

    It appears that Docker somehow does not respect MALLOC_ARENA_MAX and will regardless allow the amount of virtual memory to grow to a number correlating to the number of CPUs being allocated to it.
    (host is running macOS 10.13.2)

    As commented:

    docker itself does nothing with that environment variable (or memory management of the processes inside the container); it sets up namespaces and cgroups for the process, which is all part of the kernel.