一: Tcmalloc 安装
1. libunwind 安装
#如果你是在 64 位系统安装 Tcmalloc ,强烈建议先安装 libunwind,详细原因请见:
https://github.com/gperftools/gperftools/blob/master/INSTALL
1) 下载 libunwind
wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-beta.tar.gz
2)编译安装 libunwind
tar -xvf libunwind-0.99-beta.tar.gz
cd libunwind-0.99-beta/
./configure
make && make install
#也可以通过 yum 安装,但请注意版本
yum install libunwind libunwind-devel -y
#查看 yum 安装的包
rpm -qa|grep -i libunwind
libunwind-devel-1.2-2.el7.x86_64
libunwind-1.2-2.el7.x86_64
#删除 yum 安装的相关包
rpm -e libunwind-devel
rpm -e libunwind
2. gperftools 安装
wget https://github.com/gperftools/gperftools/releases/download/gperftools-2.10/gperftools-2.10.tar.gz
tar -zxvf gperftools-2.10.tar.gz
cd gperftools-2.10
./configure --prefix=/usr
make && make install
##注意这里要指定编译路径,否则mysql启动的时候会报如下错误
mysqld_safe --malloc-lib must be located in one of the directories: /usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/l