Clone this wiki locally
jemalloc started out as the memory allocator for a programming language runtime Jason Evans was developing in 2005, but language design changes made the allocator superfluous. At the time, FreeBSD was in need of an SMP-scalable allocator, so he integrated jemalloc into FreeBSD's libc, and then made a long series of improvements to scalability and fragmentation behavior.
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. Many general jemalloc enhancements resulted from Firefox-related efforts. More recently, in 2010 Mozilla sponsored integration of Apple Mac OS X support into the stand-alone jemalloc, and in 2012 contributed MinGW Windows support.
Starting in 2009, Jason Evans adapted jemalloc to handle the extreme loads Facebook servers commonly operate under, and added numerous features that support development and monitoring. 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 jemalloc features.
jemalloc is a general purpose
malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. It is intended for use as the system-provided memory allocator, as in FreeBSD's libc library, as well as for linking into C/C++ applications. jemalloc provides many introspection, memory management, and tuning features beyond the standard allocator functionality. As an extreme example, arenas can be used as pool allocators; i.e. an arena can be used for general purpose allocation, and then the entire arena destroyed as a single operation.
Major uses of jemalloc include:
The following documentation is dated or otherwise unsuited to wiki form:
- jemalloc(3) manual page: The manual page for the latest release fully describes the API and options supported by jemalloc, and includes a brief summary of its internals.
- Applicative 2015 presentation: This talk (video) presented the background and initial design ideas that lead to decay-based unused dirty page purging, first available in the 4.1.0 release.
- Facebook Engineering post: This article was written in 2011 and corresponds to jemalloc 2.1.0.
- BSDcan paper: This paper was presented at the BSDcan conference in 2006 and roughly corresponds to the version of jemalloc that appeared in FreeBSD 7.