查內存泄漏備忘
阿新 • • 發佈:2018-02-03
ken pattern malloc figure free allow onf com install
文章
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
查內存泄漏備忘