使用google-perftools的tcmalloc

使用google-perftools的tcmalloc
安装
使用
export LD_PRELOAD="/usr/local/lib/libtcmalloc.so"

cat testMalloc.cpp & g++ testMalloc.cpp & ./a.out

#include <stdio.h>
#include <memory.h>
#include <stdlib.h>

int main()
{
        void *p=malloc(100);
        printf("stop here\n");
        getchar();
        free(p);
}

使用lsof命令查看tcmalloc是否起效
cutepig@ubuntu:~$ lsof -n |grep tcmalloc
a.out      5501    cutepig  mem       REG        8,1  1645060     206764 /usr/local/lib/libtcmalloc.so

posted on 2012-01-14 00:20 cutepig 阅读(31) 评论(0) 编辑 收藏

导航

<2012年1月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

公告

昵称:cutepig
园龄:4年8个月
粉丝:11
关注:0

搜索

 
 

常用链接

随笔分类(58)

随笔档案(536)

文章档案(1)

我的链接

积分与排名

  • 积分 - 193028
  • 排名 - 443

最新评论

阅读排行榜