My program runs in background. I use linux top command, it shows 16g
memory. But when I want to use go pprof -inuse_space
to check the point, I gives only 200M
. Where do the other memory go?
Generally, the memory used in os(shown by top VIRT) is larger than pprof. One reason is gc will happen when heap size > ($GOGC% + 1) * (reachable nodes size): https://blog.golang.org/go15gc. By default, $GOGC is 100, that means the memory size will be twice of the heap size shown by pprof. But you seem not to be in this case.