moby / libnetwork

networking for containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

splitNetworks leaking memory?

cpuguy83 opened this issue · comments

Doing a heap anaylsis of dockerd, I noticed that splitNetworks is holding on to memory unexpectedly:

root@03aaeddd73f2:/go/src/github.com/docker/docker# go tool pprof --inuse_space --lines http://127.0.0.1:80/debug/pprof/heap
Fetching profile over HTTP from http://127.0.0.1:80/debug/pprof/heap
DEBU[2021-01-14T18:49:40.287720452Z] Calling GET /debug/pprof/heap                
Saved profile in /root/pprof/pprof.dockerd.alloc_objects.alloc_space.inuse_objects.inuse_space.008.pb.gz
File: dockerd
Build ID: 5f027b8acdeb123c3ad701993a92522c1f689ee1
Type: inuse_space
Time: Jan 14, 2021 at 6:49pm (UTC)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top
Showing nodes accounting for 1834.63kB, 100% of 1834.63kB total
Showing top 10 nodes out of 25
      flat  flat%   sum%        cum   cum%
  809.97kB 44.15% 44.15%   809.97kB 44.15%  github.com/docker/docker/vendor/github.com/docker/libnetwork/ipamutils.splitNetworks /go/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/ipamutils/utils.go:104

This relates to this line:

localPools = append(localPools, splitNetwork(p.Size, b)...)