Multithreaded Memory Allocators for C/C++

后端 未结 8 1883
挽巷
挽巷 2020-11-29 18:55

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:

8条回答
  •  日久生厌
    2020-11-29 19:32

    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).

    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.

提交回复
热议问题