Cgo内存管理
作者:互联网
Cgo内存管理
Valgrind安装和使用
方法一
wget http://valgrind.org/downloads/valgrind-3.9.0.tar.bz2
tar xvf valgrind-3.9.0.tar.bz2
cd valgrind-3.9.0/
./configure
make
make install
方法二:
sudo apt-get install valgrind
使用:
valgrind --tool=memcheck --leak-check=full valgrind_demo
valgrind --leak-check=full ./xxx
打印内存信息:
var m runtime.MemStats
runtime.ReadMemStats(&m)
log.Printf("Alloc = %v TotalAlloc = %v Sys = %v NumGC = %v\n", m.Alloc/1024, m.TotalAlloc/1024, m.Sys/1024, m.NumGC)
相关链接
https://pengrl.com/p/29054/
https://www.jianshu.com/p/7ce24f278b0e
https://shengping.space/2018/08/30/012_golang之cgo/
https://www.cnblogs.com/magicsoar/p/7002467.html
https://m.php.cn/be/go/455798.html
https://smileusd.github.io/2018/07/02/golang-map/
标签:1024,Cgo,tar,管理,--,valgrind,内存,https,3.9 来源: https://www.cnblogs.com/tomtellyou/p/14621516.html