Slobodan Predolac 3d07f2b597 Move dallocx() flags != 0 path out of line
je_dallocx() kept the flags != 0 path inline, so the whole function got
one stack frame and register assignment sized for the slow path, and the
flags == 0 fast path paid for it: callee-saved register spills, and with
clang after the emap_alloc_ctx_lookup() L1 inlining, an extra register
move.

Move the flags != 0 body into a noinline dallocx_default(), matching
free_default(), sdallocx_default() and mallocx_default().
dallocx(ptr, 0) now has the same fast path as free(): no frame setup and
no spills.  flags != 0 callers pay one extra call.

Instructions retired per mallocx() + dallocx(ptr, 0) pair on aarch64:
  gcc -O3, libjemalloc.so:             103.6 -> 98.6
  clang ThinLTO, libjemalloc.so:       117.5 -> 105.5
  clang ThinLTO, statically linked:    106.5 -> 82.5
On x86-64 with clang ThinLTO, the dallocx(ptr, 0) path goes from 57 to
37 instructions.
2026-10-05 14:59:31 -04:00
2019-11-22 10:14:16 -08:00
2026-09-17 18:57:36 -04:00
2014-09-02 17:49:29 -07:00
2026-07-30 09:43:34 -07:00
2026-09-16 15:01:03 -07:00
2026-09-27 15:34:23 -07:00
2019-01-25 13:25:20 -08:00
2023-03-09 11:44:02 -08:00
2023-03-09 11:44:02 -08:00

jemalloc is a general purpose malloc(3) implementation that emphasizes
fragmentation avoidance and scalable concurrency support.  jemalloc first came
into use as the FreeBSD libc allocator in 2005, and since then it has found its
way into numerous applications that rely on its predictable behavior.  In 2010
jemalloc development efforts broadened to include developer support features
such as heap profiling and extensive monitoring/tuning hooks.  Modern jemalloc
releases continue to be integrated back into FreeBSD, and therefore versatility
remains critical.  Ongoing development efforts trend toward making jemalloc
among the best allocators for a broad range of demanding applications, and
eliminating/mitigating weaknesses that have practical repercussions for real
world applications.

The COPYING file contains copyright and licensing information.

The INSTALL file contains information on how to configure, build, and install
jemalloc.

The ChangeLog file contains a brief summary of changes for each release.

URL: https://jemalloc.net/
Languages
C 88.4%
Perl 4.7%
M4 3.1%
Python 1.2%
Shell 1%
Other 1.6%