Multithreaded Memory Allocators for C/C++

后端 未结 8 1841
挽巷
挽巷 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:31

    The locklessinc allocator is very good and the developer is responsive if you have questions. There's an article he wrote about some of the optimization tricks used, it's an interesting read: http://locklessinc.com/articles/allocator_tricks/. I've used it in the past with excellent results.

    enter image description here

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题