wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
tar zxf libunwind-1.1.tar.gz
cd libunwind-1.1
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
cd ../ gperftools的安装:
wget http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz
tar xzf gperftools-2.1.tar.gz
cd gperftools-2.1
可以加入参数只编译tcmalloc(./configure –enable-minimal、–disable-cpu-profiler、–disable-heap-profiler、–disable- heap-checker、–disable-debugalloc),64位操作系统不安装libunwind也不会报错,注意生成的库文件是 libtcmalloc_minimal.*
64位操作系统,如下
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@'/usr/local/mysql/bin/mysqld_safe
service mysqld restart
验证加载tcmalloc在MySQL中是否生效,如下:
cd lnmp/src/nginx-1.4.2
make clean
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module
make && make install
为添加线程目录:
cd lnmp/src/redis-2.6.16
make USE_TCMALLOC=yes FORCE_LIBC_MALLOC=yes
/bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server}/usr/local/redis/bin
原文:http://blog.linuxeye.com/355.html