[root@wallet01 ~]# yum -y install gcc make gcc-c++ libunwind libunwind-devel
[root@wallet01 ~]# wget https://github.com/gperftools/gperftools/releases/download/gperftools-2.9.1/gperftools-2.9.1.tar.gz
[root@wallet01 ~]# tar zxvf gperftools-2.9.1.tar.gz
[root@wallet01 ~]# cd gperftools-2.9.1
[root@wallet01 gperftools-2.9.1]# ./configure
[root@wallet01 gperftools-2.9.1]# make
[root@wallet01 gperftools-2.9.1]# make install
[root@wallet01 ~]# cat /usr/lib/systemd/system/mysqld.service
# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql
[root@wallet01 ~]# echo ‘LD_PRELOAD=/usr/local/lib/libtcmalloc.so‘ > /etc/sysconfig/mysql
[root@wallet01 ~]# systemctl restart mysqld
[root@wallet01 ~]# lsof -n | grep tcmalloc
mysqld 7191 mysql mem REG 253,0 2644888 272976126 /usr/local/lib/libtcmalloc.so.4.5.9
mysqld 7191 7192 mysql mem REG 253,0 2644888 272976126 /usr/local/lib/libtcmalloc.so.4.5.9
mysqld 7191 7193 mysql mem REG 253,0 2644888 272976126 /usr/local/lib/libtcmalloc.so.4.5.9
【MySQL】MySQL 5.7通过tcmalloc管理内存