Docker Community Forums

Share and learn in the Docker community.

Docker stats memory anomaly

(Nirlay Kundu) #1

When I do

docker stats --no-stream=true , I get this

object-main 348.57% 96.52 GB/96.64 GB 99.88% 0 B/0 B

This shows 96.52 GB is being used.

But when I do free -m I get the following

montana@cluster0 ~ $ free -g
total used free shared buffers cached
Mem: 125 111 14 9 0 42
-/+ buffers/cache: 68 57
Swap: 0 0 0

This shows 68GB is used and 57 GB is free.

something is not adding up

(David Maze) #2

That looks consistent to me: your container is using 96.52 GB, or 99.88% of its limit of 96.64 GB.

How did you start your container? Did you specify something along the lines of `docker run -m 100G’? has the details.

Hmm…the docker stats documentation points at, which hints that the number is the resident set size (RSS), which should map to actual physical memory usage. That is kind of odd. (I don’t think memory you allocate but never use counts against your RSS, though it does count against your virtual memory size if top or ps report that; the Go runtime in particular preallocates tons of memory expecting the OS to only actually dole it out as needed.)