tcmalloc安装及使用

来源:互联网 发布:印度山地师 知乎 编辑:程序博客网 时间:2024/05/21 18:07
-----------------------------------------------------------------------------
                                #####   tcmalloc  安装   ######


wget ftp://ftp.tw.freebsd.org/pub/ports/distfiles/gperftools-2.1.tar.gz
tar zxvf tar zxvf gperftools-2.1.tar.gz 
cd gperftools-2.1
./configure
make
make install


//64位系统需要
wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz 
tar zxvf libunwind-1.1.tar.gz
cd libunwind-1.1
./configure
make
make install


                             #####   TCMalloc库加载到Linux系统中   ######
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig




-----------------------------------------------------------------------------
                               #####   tcmalloc  使用  ######


只需要将-ltcmalloc链接在Makefile的动态库最后


注意:这里为了进行内存泄漏分析,一定要将-ltcmalloc链接在Makefile最后,官方文档里说:堆栈检查器可能误解列在它后面的链接库的一些内存


-----------------------------------------------------------------------------
0 0