Stand-alone jemalloc
jemalloc is a general-purpose scalable concurrent malloc(3) implementation. There are several divergent versions of jemalloc in active use, including:
-
FreeBSD's default system allocator (malloc.c, manual page). This was the first public use of jemalloc, and it is still author-maintained.
-
NetBSD's default system allocator (jemalloc.c).
-
Mozilla Firefox's allocator (source code), specifically for Microsoft Windows-related platforms, Solaris, and Linux. There is Apple Mac OS X support code as well, but it has never been used in a release.
-
The stand-alone jemalloc, which currently targets only Linux. Thus far I have had no driving need to integrate support for other operating systems into this version of jemalloc, but it is probable that the stand-alone jemalloc library's platform support will broaden over time.
Documentation
jemalloc was originally described in a paper I presented at the BSDcan conference in 2006. Much has changed since then, but in combination with a current version of the jemalloc(3) manual page, the basic design should be apparent without consulting the source code.Versioning and history
jemalloc has been is wide use since 2006, yet it has only recently been developed as a stand-alone library. Therefore the version numbers are misleadingly low.
jemalloc started out as the memory allocator for a programming language runtime in 2005, but language design changes made the allocator superfluous. At the time, FreeBSD was in need of an SMP-scalable allocator, so I integrated jemalloc into FreeBSD's libc, and then the real work began as I discovered the hard way how difficult a problem fragmentation is.
In late 2007, the Mozilla Project was hard at work improving Firefox's memory usage for the 3.0 release, and jemalloc was used to solve fragmentation problems for Firefox on Microsoft Windows platforms. You can read here about the fruits of that labor. I made many enhancements to jemalloc while developing for Mozilla, and all of the generic algorithmic improvements were incorporated into FreeBSD's jemalloc.
Since 2009 I have adapted jemalloc to handle the extreme loads Facebook servers commonly operate under. Facebook uses jemalloc in many components that are integral to serving its website. Facebook supports numerous open source projects, and is to thank for sponsoring many of the features that are unique to the stand-alone jemalloc.
Copyright © 2010 Jason Evans <jasone@canonware.com>.
Last updated 2010/04/12.