准备工作
发现我膜拜的项目中竟然直接应用了hoard的代码555,所以拿来看看到底哪里厉害!
Hoard项目的官方网站在http://www.hoard.org/
它自己配了一部分英文简介,很容易看懂。
The Hoard memory allocator is a fast, scalable, and memory-efficient memory allocator for Linux, Solaris, Mac OS X, and Windows. Hoard is a drop-in replacement formalloc that candramatically improve application performance, especially for multithreaded programs running on multiprocessors and multicore CPUs. No source code changes necessary: just link it in or set one environment variable
另外,它提供了tar包的下载,不过不要选官网上的,到git-hub上clone一个最好,官网上的tar包有redefination错误。
简介
这个项目是出自于ASPLOS 2000年的一篇文章 Hoard: A Scalable Memory Allocator for Multithreaded Applications
为了更好理解,我大概看了一下文章。
Hoard: A Scalable Memory Allocator for Multithreaded Applications
摘要:
hoard就是一个为并行多线程C或者是C++程序设计的内存分配器。
之前为串行程序设计的串行分配器的扩展性不行,现有的并行分配器的性能不好,而且有的分配器对堆的管理会引入假共享(false sharing )
Worse, many allocators exhibit a dramatic increase in memory consumption when confronted with a producer-consumer pattern of object allocation and freeing. This increase in memory consumption can range from a factor of P (the number of processors) to unbounded memory consumption.
这篇文章,自称 Hoard, a fast, highly scalable allocator that largely avoids false sharing and is memory efficient.
而且Hoard combines one global heap and per-processor heaps with a novel discipline that provably bounds memory consumption and has very low synchronization costs in the common case.