几种内存操作性能比较

Comparisation

TLSF  Two-Level Segregate Fit, mainly on RTOS
jemalloc  Jason Evans's malloc, used by firefox
dlmalloc  Doug Lea’s malloc, been around forever

ptmalloc2  Doug Lea’s malloc, extended to support per-thread arenas. Default allocator for glibc2.3

TCMalloc  Google’s malloc, claims to be 6x faster than ptmalloc2

nedmalloc  claims to be faster than tcmalloc

Hoard  also claims to be very fast

 

jemalloc安装和使用:

wget http://www.canonware.com/download/jemalloc/jemalloc-2.0.1.tar.bz2

tar xvf jemalloc-2.0.1.tar.bz2

cd jemalloc-2.0.1/ && ./configure && make && make install

ldconfig

gcc -o test test.c -ljemalloc 

 

tcmalloc安装和使用:
wget http://google-perftools.googlecode.com/files/google-perftools-0.99.2.tar.gz
tar zxvf google-perftools-0.99.2.tar.gz
cd google-perftools-0.99.2/
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig

使用tcmalloc代替glibc缺省malloc:

gcc -o test test.c -ltcmalloc

 

nedmalloc安装和使用:

 Refer to the Readme.txt

 

hoard安装和使用: 

make linux-gcc-x86

cp libhoard.so /usr/local/lib/

ldconfig

gcc -o test test.c -lhoard

 

valgrind --tool=memcheck --leak-check=full ./test

valgrind检查不出jemalloc/tcmalloc的内存泄露,可以检测dlmalloc/ptmalloc/hoard

 

 

To be continued

References:
 Benchmarks http://locklessinc.com/benchmarks.shtml

http://www.canonware.com/jemalloc/index.html


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值