Jump to content

User:Egberts/Comparison of malloc algorithms

From Wikipedia, the free encyclopedia

In computer programming, malloc and its related memory allocation functions are fundamental components of dynamic memory management in C and C-derived languages. Over time, numerous implementations and variants of malloc have been developed, each with different performance characteristics, memory usage patterns, and concurrency strategies. T

This article compares major malloc variants—including standard library implementations, custom allocators, and platform-specific versions—highlighting their design goals, internal mechanisms, and use cases in modern computing environments.

Malloc Taxonomy

[edit]
width=100%

Major Variants

[edit]

The following table gives basic details the prominent variants of malloc function set.


Details
Malloc variant name
Programming Language License Developer(s) year developed Website Repository Whitepaper
bmalloc C#? Proprietary Apple / WebKit contributors 2013 [github.com/WebKit]
bsmalloc C MIT Eli Rosenthal 2017 [github.com/ezrosent/allocators-rs]
ctmalloc C++ BSD-3-Clause Sanjay Ghemawat et al. (Google) 2008  Tor Browser Bundle[1]
dangless-malloc C BSD-3-Clause Gabor Ózar (with collaborators) 2022 [gaborozar.me/] [github.com/shdnx/dangless-malloc]  DangZero: Efficient Use-After-Free Detection[2]
dlmalloc C MIT Doug Lea 1996 [dmalloc.com] [github.com/DenizThatMenace/dlmalloc]  Dmalloc Tutorial[3]
elfmalloc Rust MIT
Apache 2.0
Eli Rosenthal 2017 [github.com/ezrosent] [github.com/ezrosent/allocators-rs]  elfmalloc Design[4]
hardened_malloc C MIT Daniel Micay for GrapheneOS 2024 [github.com/GrapheneOS/hardened_malloc]
hmalloc Tianlin Li, Yiping Yao, Wenjie Tang, Zhongwei Lin 2019  A Hybrid Scalable and Lock-Free Memory[5]
Hoard C Apache 2.0 Emery D. Berger, Kathryn S. McKinley, Robert D. Blumofe, Paul R. Wilson 1999 [hoard.org] [github.com/emeryberger/Hoard]  Hoard: a scalable memory allocator for multithreaded applications[6]
italloc C++ BSD-3-Clause Google 2013 https://github.com/r-lyeh-archived/ltalloc https://code.google.com/archive/p/ltalloc/
jemalloc C GPL-3 with the GCC exception Jason Evans of Facebook 2005 [github.com/jemalloc/]  A Scalable Concurrent malloc(3) Implementation for FreeBSD[7]
jemalloc2 C MIT Jason Evans of Facebook 2014 [ https://github.com/jemalloc/jemalloc]  A Scalable Concurrent malloc(3) Implementation for FreeBSD[8]
kmalloc C BSD-2-Clause Chris Kingsley 1982 [github.com/emeryberger/Malloc-Implementation]  EARL: An Integrated Circuit Design Language[9]
libumem C CDDL Jonathan Adams, Jeff Bonwick (kernel slab), Sun Microsystems, Inc. (SMI) 2001 [[1]] [[2]]  Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources[10]
llmalloc C++ MIT Paul Liétar, Theodore Butler, Sylvan Clebsch, Sophia Drossopoulou, Juliana Franco, Matthew J. Parkinson, Alex Shamis, Christoph M. Wintersteiger, David Chisnall 2019 https://www.reddit.com/r/cpp/comments/1ihjmmc/llmalloc_a_low_latency_oriented_thread_caching/ [github.com/akhin/llmalloc]

 snmalloc: a message passing allocator[11]

lrmalloc C++ MIT Ricardo Leite, Ricardo Rocha 2018 [website] [github.com/ricleite/lrmalloc]  A Modern and Competitive

Lock-Free Dynamic Memory Allocator[12]

Malloc-ng C Apache 2.0 Apple 2015 [github.com/apple/opensource]
mimalloc C MIT Daan Leijen 2015 [microsoft.github.io/mimalloc] [github.com/microsoft/mimalloc]  Mimalloc: Free List Sharding in Action[13]
Mmap-malloc C MIT
Apache 2.0
Eli Rosenthal 2017 https://github.com/ezrosent/allocators-rs/tree/master/mmap-alloc
mspace C MIT Doug Lea 1997 https://gee.cs.oswego.edu/dl/html/malloc.html https://android.googlesource.com/platform/bionic/%2B/d206b56/libc/upstream-dlmalloc/malloc.c https://gee.cs.oswego.edu/dl/html/malloc.html
mtmalloc C Proprietary IBM 2005 https://www.research.ibm.com/mtmalloc https://research.ibm.com/publications/scalable-lock-free-dynamic-memory-allocation--1
NBBS C ??? Romolo Marotta, Mauro Ianni, Alessandro Pellegrini, Francesco Quaglia 2022 https://github.com/wuwenbin/buddy2 https://github.com/HPDCS/NBBS https://dl.acm.org/doi/10.1109/TC.2021.3060393
nbmalloc C
Ada
GPLv2 Anders Gidenstam 2004 https://pdfs.semanticscholar.org/befb/47996062d62ca4d3f77a194e66d3215d85d9.pdf https://github.com/andgi/NBAda/blob/master-Ada95/src/Lock-Free_Sets/nbada-lock_free_sets.adb https://www.cse.chalmers.se/~tsigas/papers/Allocating%20Memory%20in%20a%20Lock-Free%20Manner%20-%20ESA05.pdf
nedmalloc C Zlib Niall Douglas 2003 https://github.com/ned14/nedmalloc https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/nedmalloc https://github.com/ned14/nedmalloc/blob/master/compat/nedmalloc/Readme.txt
Nextgen-malloc C MIT Ruihao Li, Qinzhe Wu, Krishna Kavi, Gayatri Mehta, Neeraja J. Yadwadkar, and Lizy K. John 2023 https://digital.library.unt.edu/ark%3A/67531/metadc2201586/ https://github.com/richfelker/mallocng-draft https://sigops.org/s/conferences/hotos/2023/papers/li.pdf
omalloc C Beerware Otto Moerbeek 2008 https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/omalloc
ottomalloc C++ MIT Amit L. Gupta, Google 2018 https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/ottomalloc https://www.openbsd.org/papers/eurobsdcon2009/otto-malloc.pdf
partitionalloc C BSD-3-Clause David Blaikie, Google 2019 https://www.chromium.org/developers/base-newsletters/2022q3/#standalone-partitionalloc https://github.com/chromium/chromium/tree/main/third_party/partition_alloc https://www.chromium.org/developers/design-documents/memory-management
phkmalloc Poul-Henning Kamp 1993 https://svnweb.freebsd.org/base/head/lib/libc/stdlib/malloc.c?view=markup https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/phkmalloc
Pim-malloc C/C++ Apache 2.0 Dongjae Lee, Bongjoon Hyun, Minsoo Rhu 2018 https://pmem.io/pmdk/ https://github.com/intel/pmdk https://arxiv.org/html/2505.13002v1
portableumem C BSD-3-Clause Minsoo Rhu, Bongjoon Hyun 2015 https://github.com/pmem/portableumem
ptmalloc C MIT Wolfram Gloger 2001 https://github.com/hustfisher/ptmalloc
ptmalloc2 C GPL-2 Wolfram Gloger 2004 https://github.com/hustfisher/ptmalloc https://github.com/bminor/glibc
ptmalloc3 C GPL-2 Wolfram Gloger 2010 https://github.com/bminor/glibc https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/ptmalloc
rpmalloc C MIT Mattias Johnson 2015 https://github.com/mjansson/rpmalloc
rustmalloc Rust MIT Rust community 2019 https://github.com/gnzlbg/malloc
s2malloc C++ Apache2
Affero
Ruizhe Wang, Meng Xu, N. Asokan 2024 https://dustri.org/b/paper-notes-s2malloc.html https://ssg-research.github.io/platsec/memallo https://arxiv.org/pdf/2402.01894
scalloc C BSD-2-Clause Martin Aigner 2015 http://scalloc.cs.uni-salzburg.at/ https://github.com/cksystemsgroup/scalloc/tree/master/src https://www.cs.uni-salzburg.at/~ck/content/publications/conferences/OOPSLA15-Scalloc.pdf
scudo C++ Apache 2.0 Christoph Kirsch 2015 https://github.com/google/scudo
secure_malloc C MIT Ana Sokolova 2013 http://thread.gmane.org/ gmane.comp.encryption.openssl.user/51243?resub=1
semalloc C++ Apache2
Affero
Michael Lippautz 2024 https://uwspace.uwaterloo.ca/items/fcf3efc1-93bb-4a90-96d3-b5d0e30650c6 https://github.com/ssg-research/semalloc https://ssg-research.github.io/platsec/memallo
sfmalloc C MIT Sangmin Seo, SNU Korea 2017 https://github.com/jeffhammond/sfmalloc https://github.com/lloyd/sfmalloc https://ieeexplore.ieee.org/document/
SlimGuard C MIT Stella Bitchebe, Yves Kone, Pierre Olivier, Jalil Boukhobza, David Bromberg, Daniel Hagimont, Alain Tchana 2017 https://ssrg-vt.github.io/SlimGuard/ https://github.com/ssrg-vt/SlimGuard/ https://www.ssrg.ece.vt.edu/papers/middleware19-slimguard.pdf
smmalloc C++ MIT Sergey Makeev 2016 https://github.com/terrelln/smmalloc https://github.com/SergeyMakeev/smmalloc
snmalloc C MIT Nathan Kurz, Marthew Parkinson 2015 https://www.microsoft.com/en-us/research/group/azure-security-privacy/open-source/ https://github.com/microsoft/snmalloc https://github.com/microsoft/snmalloc/blob/main/snmalloc.pdf
spmalloc C GPLv2 Stephen Peijnik 2005 https://savannah.nongnu.org/projects/spmalloc/
ssmalloc C MIT Ran Liu & Haibo Chen 2012 github.com/Naruil/SSMalloc https://apsys2012.kaist.ac.kr/media/papers/apsys2012-final27.pdf
Streamflow C++ MIT Christos Antonopoulos, Scott Schneider 2017 http://www.cs.wm.edu/streamflow https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/old/streamflow https://dl.acm.org/doi/abs/10.1145/1133956.1133968
Super-malloc C MIT Anthony Lee (and collaborators) 2018 https://www.cse.wustl.edu/~angelee/archive/cse539/spr18/papers/supermalloc.pdf
tbbmalloc C++ Apache 2.0 Intel 2007 https://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Memory_Allocator.html https://github.com/oneapi-src/oneTBB https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html
tcmalloc C++ Apache 2.0 Sanjay Ghemawat and Paul Menage (Google) 2006 https://github.com/google/tcmalloc https://github.com/emeryberger/Malloc-Implementations/tree/master/allocators/tcmalloc/google-perftools-0.91
TLSF C GPL2
LGPL
Miguel Masmano Tello, Herman ten Brugge, Adam Scislowicz 2008 https://medium.com/@andrew_johnson_4/malloc-algorithms-memory-management-in-lm-5531cde74bc8 https://github.com/japaric/tlsf http://www.gii.upv.es/tlsf/files/papers/spe_2008.pdf
xmalloc Xiaohuang Huang, Christopher I. Rodrigues, Stephen Jones, Ian Buck, Wen-mei Hwu 2010 http://impact.crhc.illinois.edu/Shared/Papers/Huang-2011.pdf

History

[edit]

Speed Comparison

[edit]

==

References

[edit]
  1. ^ github.com/iSECPartners "Tor Browser Bundle". {{cite web}}: Check |url= value (help)
  2. ^ "DangZero: Efficient Use-After-Free Detection" (PDF).
  3. ^ "Dmalloc Tutorial".
  4. ^ "elfmalloc Design".
  5. ^ "A Hybrid Scalable and Lock-Free Memory".
  6. ^ "Hoard: a scalable memory allocator for multithreaded applications".
  7. ^ "A Scalable Concurrent malloc(3) Implementation for FreeBSD" (PDF).
  8. ^ "A Scalable Concurrent malloc(3) Implementation for FreeBSD" (PDF).
  9. ^ "EARL: An Integrated Circuit Design Language" (PDF).
  10. ^ "Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources".
  11. ^ "snmalloc: a message passing allocator".
  12. ^ "A Modern and Competitive Lock-Free Dynamic Memory Allocator". {{cite web}}: line feed character in |title= at position 25 (help)
  13. ^ "Mimalloc: Free List Sharding in Action".
[edit]

Template:Malloc algorithms


[[Category:Computing comparisons|Malloc algorithms]