简体   繁体   English

go工具pprof -inuse_space比linux顶部显示的小得多

[英]go tool pprof -inuse_space much smaller than linux top shows

My program runs in background. 我的程序在后台运行。 I use linux top command, it shows 16g memory. 我使用linux top命令,它显示16g内存。 But when I want to use go pprof -inuse_space to check the point, I gives only 200M . 但是,当我想使用go pprof -inuse_space检查该点时,我只给出200M Where do the other memory go? 其他记忆去哪儿了?

Generally, the memory used in os(shown by top VIRT) is larger than pprof. 通常,在os中使用的内存(由顶部VIRT显示)大于pprof。 One reason is gc will happen when heap size > ($GOGC% + 1) * (reachable nodes size): https://blog.golang.org/go15gc . 原因之一是堆大小>($ GOGC%+ 1)*(可达到的节点大小)时会发生gc: 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. 默认情况下,$ GOGC为100,这意味着内存大小将是pprof显示的堆大小的两倍。 But you seem not to be in this case. 但是您似乎不是这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM