为什么 docker 消耗了这么多 VIRT 内存?

Why is docker consuming so much VIRT memory?

我 运行 docker 我的 Mac OS X:2.5 GHz Intel Core i7, 16 GB 1600 MHz DDR3。

关键是,如果我正确读取 htop 输出,它似乎消耗了太多 VIRT 内存。

这正常吗?还是背后有什么问题?我的笔记本电脑很慢。

这由 moby/moby issue 31594 说明。
该问题实际上要求 运行 contrib/check-config.sh 作为了解更多有关正在使用的 docker 配置的方式。

自 2015 年以来在 #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)

如评论:

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.