当前位置: 首页 > 工具软件 > jemalloc > 使用案例 >

jemalloc 使用

计向晨
2023-12-01

安装

cd /opt
wget https://github.com/jemalloc/jemalloc/archive/refs/tags/5.2.1.tar.gz

tar -zxvf 5.2.1.tar.gz
mv jemalloc-5.2.1 jemalloc
cd jemalloc
yum -y install autoconf
./autogen.sh

./configure --enable-debug --enable-prof

make
make install

echo '/usr/local/lib' > /etc/ld.so.conf.d/malloc.conf
ldconfig 

注意:不要在虚拟机共享目录下编译,否则make会报错。因为windows系统不支持软链接或者硬链接。参考文章

ln: failed to create symbolic link ‘lib/libjemalloc.so’: Operation not supported

环境配置

JEMALLOC_PATH=/usr/local
PATH=${JEMALLOC_PATH}/bin:${PATH}
MALLOC_CONF=prof_leak:true,lg_prof_sample:0,prof_final:true \
LD_PRELOAD=${JEMALLOC_PATH}/lib/libjemalloc.so.2 w
jeprof --show_bytes `which w` jeprof.24803.0.f.heap
jeprof --show_bytes --pdf `which w` jeprof.24803.0.f.heap > w.pdf

#report error
sh: dot: command not found
sh: ps2pdf: command not found

#install graphviz、ghostscript resovle
yum -y install ghostscript
yum -y install graphviz

 类似资料: