本文介绍了多线程内存分配器的C / C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司目前拥有大量多线程服务器应用程序,我正在挑选一种良好的多线程内存分配器。

I currently have heavily multi-threaded server application, and I'm shopping around for a good multi-threaded memory allocator.

到目前为止,我左右为难:

So far I'm torn between:


  • Sun的umem

  • 谷歌的tcmalloc

  • 英特尔线程构建模块分配器

  • 埃默里Berger的囤

从我发现囤积可能是最快的,但我没有听说过今天之前,所以我怀疑,如果它真的好,因为它看起来。任何人都有亲身经历尝试这些分配程序?

From what I've found hoard might be the fastest, but I hadn't heard of it before today, so I'm skeptical if its really as good as it seems. Anyone have personal experience trying out these allocators?

推荐答案

我用tcmalloc和阅读有关囤积居奇。都具有类似的实现方式和既实现相对于螺纹/ CPU的数目大致线性性能缩放(根据其各自的位点的曲线)。

I've used tcmalloc and read about Hoard. Both have similar implementations and both achieve roughly linear performance scaling with respect to the number of threads/CPUs (according to the graphs on their respective sites).

因此​​:如果性能真的是令人难以置信的关键,然后做性能/负载测试。否则,只需推出一个骰子,并挑选上市的一个(由易用性加权目标平台上)。

So: if performance is really that incredibly crucial, then do performance/load testing. Otherwise, just roll a dice and pick one of the listed (weighted by ease of use on your target platform).

和来自,它看起来像囤积居奇,tcmalloc和ptmalloc都是大致可比的速度。总体而言,TT看起来像ptmalloc是采取尽可能少的房间尽可能优化,囤积的速度+内存使用情况的权衡优化,tcmalloc为纯粹的速度进行了优化。

And from trshiv's link, it looks like Hoard, tcmalloc, and ptmalloc are all roughly comparable for speed. Overall, tt looks like ptmalloc is optimized for taking as little room as possible, Hoard is optimized for a trade-off of speed + memory usage, and tcmalloc is optimized for pure speed.

这篇关于多线程内存分配器的C / C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 00:50