【MySQL】MySQL 5.7通过jemalloc管理内存

[root@wallet01 ~]# wget https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2
[root@wallet01 ~]# tar -jxvf jemalloc-5.2.1.tar.bz2 
[root@wallet01 ~]# cd jemalloc-5.2.1

[root@wallet01 jemalloc-5.2.1]# ./configure
[root@wallet01 jemalloc-5.2.1]# make
[root@wallet01 jemalloc-5.2.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/libjemalloc.so' > /etc/sysconfig/mysql   

[root@wallet01 ~]# systemctl restart mysqld

[root@wallet01 ~]# lsof -n | grep jemalloc
mysqld     6272         mysql  mem       REG              253,0    4397600  273167915 /usr/local/lib/libjemalloc.so.2
mysqld     6272  6273   mysql  mem       REG              253,0    4397600  273167915 /usr/local/lib/libjemalloc.so.2
mysqld     6272  6274   mysql  mem       REG              253,0    4397600  273167915 /usr/local/lib/libjemalloc.so.2
上一篇:从 smooth&最优化 角度理解softmax


下一篇:利用jemalloc分析内存泄漏以及LD_PRELOAD--转载--可以为定位内存问题的雏形