tcmalloc 资源及使用过程
Posted TaiJi1985
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tcmalloc 资源及使用过程相关的知识,希望对你有一定的参考价值。
资源下载
https://download.csdn.net/download/TaiJi1985/12530542
编译安装
unzip tcmalloc.zip
tar -zxvf gperftools-2.1.tar.gz
cd gperftools-2.1
./configure --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker --disable-debugalloc --enable-minimal
make -j4
make install
执行完以后,看一下结果
[root@localhost tc]# ls /usr/local/lib/ -l |grep tc
-rw-r--r--. 1 root root 5024514 5月 29 23:41 libtcmalloc.a
-rw-r--r--. 1 root root 5995946 5月 29 23:41 libtcmalloc_debug.a
-rwxr-xr-x. 1 root root 1022 5月 29 23:41 libtcmalloc_debug.la
lrwxrwxrwx. 1 root root 26 5月 29 23:41 libtcmalloc_debug.so -> libtcmalloc_debug.so.4.3.0
lrwxrwxrwx. 1 root root 26 5月 29 23:41 libtcmalloc_debug.so.4 -> libtcmalloc_debug.so.4.3.0
-rwxr-xr-x. 1 root root 2612072 5月 29 23:41 libtcmalloc_debug.so.4.3.0
-rwxr-xr-x. 1 root root 980 5月 29 23:41 libtcmalloc.la
-rw-r--r--. 1 root root 2533652 6月 17 17:52 libtcmalloc_minimal.a
-rw-r--r--. 1 root root 3320834 5月 29 23:41 libtcmalloc_minimal_debug.a
-rwxr-xr-x. 1 root root 1068 5月 29 23:41 libtcmalloc_minimal_debug.la
lrwxrwxrwx. 1 root root 34 5月 29 23:41 libtcmalloc_minimal_debug.so -> libtcmalloc_minimal_debug.so.4.3.0
lrwxrwxrwx. 1 root root 34 5月 29 23:41 libtcmalloc_minimal_debug.so.4 -> libtcmalloc_minimal_debug.so.4.3.0
-rwxr-xr-x. 1 root root 1423456 5月 29 23:41 libtcmalloc_minimal_debug.so.4.3.0
-rwxr-xr-x. 1 root root 1037 6月 17 17:52 libtcmalloc_minimal.la
lrwxrwxrwx. 1 root root 28 6月 17 17:52 libtcmalloc_minimal.so -> libtcmalloc_minimal.so.4.1.2
lrwxrwxrwx. 1 root root 28 6月 17 17:52 libtcmalloc_minimal.so.4 -> libtcmalloc_minimal.so.4.3.0
-rwxr-xr-x. 1 root root 1114208 6月 17 17:52 libtcmalloc_minimal.so.4.1.2
-rwxr-xr-x. 1 root root 1050016 5月 29 23:41 libtcmalloc_minimal.so.4.3.0
lrwxrwxrwx. 1 root root 20 5月 29 23:41 libtcmalloc.so -> libtcmalloc.so.4.3.0
lrwxrwxrwx. 1 root root 20 5月 29 23:41 libtcmalloc.so.4 -> libtcmalloc.so.4.3.0
-rwxr-xr-x. 1 root root 2234648 5月 29 23:41 libtcmalloc.so.4.3.0
使其生效
在/etc/profile 最后添加一行
export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
然后reboot 重启系统。
验证成果
重启后查看是否生效。 可以看到已经生效。
[root@localhost ~]# lsof -n | grep tcmalloc
Xvnc 1645 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
llvmpipe- 1645 1957 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
llvmpipe- 1645 1958 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
llvmpipe- 1645 1959 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
llvmpipe- 1645 1960 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
xstartup 1757 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
dbus-laun 1972 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
dbus-daem 1976 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
dbus-daem 1976 1977 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
imsetting 2030 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gmain 2030 2031 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gdbus 2030 2032 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
dconf 2030 2052 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gvfsd 2035 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gmain 2035 2036 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gdbus 2035 2037 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gvfsd-fus 2040 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gvfsd-fus 2040 2043 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gvfsd-fus 2040 2044 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gmain 2040 2045 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gdbus 2040 2048 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
gvfs-fuse 2040 2051 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
at-spi-bu 2108 root mem REG 253,0 2234648 844073 /usr/local/lib/libtcmalloc.so.4.3.0
以上是关于tcmalloc 资源及使用过程的主要内容,如果未能解决你的问题,请参考以下文章