The Hoard Memory Allocator
hoard.org
hoard.org
libumem is the user space slab memory allocator first available in Solaris 9 (SunOS 5.4) now the default allocator on Solaris (and Illumos, SmartOS, OpenIndiana, etc.). There is a fork of libumem that has been ported to other popular operating systems, such as Linux, Windows and *BSD systems (including Darwin/OSX) by OmniTI (https://labs.omniti.com/labs/portableumem). I maintain a fork of portable libumem (https://github.com/gburd/libumem) that includes changes made by Joyent as part of their ongoing work to improve SmartOS.
I have deployed this allocator to dozens of production systems to improve the performance of highly concurrent memory-intensive applications (such as Riak) and found it to be an excellent, stable and fast allocator.
In addition to fast allocations it includes excellent statistics and memory leak detection (https://blogs.oracle.com/pnayak/entry/finding_memory_leaks_w...) as well as a few different allocator heap-fit algorithm choices.
It is licensed under the CDDL.
Here's what I'll be reading on allocators tonight, any further suggestions (following all the links in comments is part of the deal)?
http://en.wikipedia.org/wiki/C_dynamic_memory_allocation
http://www.facebook.com/notes/facebook-engineering/scalable-...
http://locklessinc.com/benchmarks_allocator.shtml
http://blog.reverberate.org/2009/02/20/one-malloc-to-rule-th...
A practical problem we have with Hoard is that it lacks diagnostics. By diagnostics I mean extensive heap reports, fragmentation information, free space, what's the largest block I can safely allocate, give me a callback for every malloc so I can do stats tracking, etc.
This was a problem we ran into with the Streamflow project (http://people.cs.vt.edu/~scschnei/streamflow/). There was no benchmark suite for multithreaded allocators, so we had to pull from HPC benchmark suites, but what's the first optimization many people do when improving an application's performance? Remove dynamic memory allocation.
We were motivated to do our work because of runtimes for multithreaded programming that need to dynamically allocate memory to represent parallel tasks. And I think that motivation remains, but that pain wasn't felt until recently.
I think that our techniques worked very well, but TCMalloc is a better engineered allocator. That is, it's production quality code. People have used our allocator in their research projects when they wanted a low-latency, highly scalable allocator, but I'm not aware of anyone using it for production - and I no longer maintain it, so that's probably for the best.
There was recently a paper in PACT last year that extended on our design. Myself and my advisor would like to release a tech report with a more full description of our algorithms and designs, but both of us are busy with our current work.
An alternative is tcmalloc by Google:
The main issue with that is that you have some problems with accepting external contributions - you need a copyright assignment process, which is difficult to do internationally and a hurdle for contributors to overcome.
All patch contributors who initially chose GPL side of dual licensing model should sign copyright disclaimer for their patches, otherwise their code won't be accepted into the main repository. Alternatively, patchmaker may execute his/her GPL rights and fork the project (e.g. Percona).
If you are the sole copyright holder (because you are the only person who worked on a project, or because all others assigned their rights to you) then you are allowed to provide any additional licenses besides the GPL. A lot of open source projects (see Qt, MySQL and a bunch of others) work this way, only accepting patches from the community if the patches come with a copyright assignment. This allows them to charge for closed source use of the library while at the same time allowing the open source community to benefit.
Since "commercial use" can include cases where GPLv2 is acceptable to the user (either because you don't care about handing out the source code e.g. because you're selling expensive hardware or consulting, or because you're running it on a server so the GPL doesn't apply to you) you can't forbid those uses and offer GPL, but you can offer things beyond the GPL (i.e. keeping modifications closed, which is what they're trying to imply with "commercial use").