文章
http://yalung929.blog.163.com/blog/static/203898225201212981731971/
http://huqunxing.site/2017/03/31/linux内存占用分析/
http://blog.yufeng.info/archives/2456
https://jameshunt.us/writings/smaps.html
gperftools
安装 gperftools
https://github.com/gperftools/gperftools
编译:
执行自动生成的时候出现错误提示:
sh autogen.sh
configure.ac:163: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation
需要安装库 libtool
sudo apt-get install libtool
编译静态库
./configure --disable-shared CXXFLAGS=-g && make
使用时加上编译选项
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
查看内存工具
cat proc/$PID/maps
cat proc/$PID/smaps