Skip to content

Commit b0b3e49

Browse files
committed
Merge branch 'dev'
2 parents 61efbda + f7489dc commit b0b3e49

File tree

134 files changed

+8331
-2270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+8331
-2270
lines changed

.cirrus.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
env:
2+
CIRRUS_CLONE_DEPTH: 1
3+
ARCH: amd64
4+
5+
task:
6+
freebsd_instance:
7+
matrix:
8+
image: freebsd-12-0-release-amd64
9+
image: freebsd-11-2-release-amd64
10+
install_script:
11+
- sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
12+
- pkg upgrade -y
13+
- pkg install -y autoconf gmake
14+
script:
15+
- autoconf
16+
#- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS
17+
- ./configure
18+
- export JFLAG=`sysctl -n kern.smp.cpus`
19+
- gmake -j${JFLAG}
20+
- gmake -j${JFLAG} tests
21+
- gmake check

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
/include/jemalloc/internal/public_namespace.h
3131
/include/jemalloc/internal/public_symbols.txt
3232
/include/jemalloc/internal/public_unnamespace.h
33-
/include/jemalloc/internal/size_classes.h
3433
/include/jemalloc/jemalloc.h
3534
/include/jemalloc/jemalloc_defs.h
3635
/include/jemalloc/jemalloc_macros.h

.travis.yml

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ matrix:
1111
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
1212
- os: linux
1313
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
14-
addons:
14+
addons: &gcc_multilib
1515
apt:
1616
packages:
1717
- gcc-multilib
@@ -21,6 +21,8 @@ matrix:
2121
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
2222
- os: linux
2323
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
24+
- os: linux
25+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
2426
- os: linux
2527
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
2628
- os: linux
@@ -37,20 +39,21 @@ matrix:
3739
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
3840
- os: osx
3941
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
42+
- os: osx
43+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
4044
- os: osx
4145
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
4246
- os: linux
4347
env: CC=clang CXX=clang++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
44-
addons:
45-
apt:
46-
packages:
47-
- gcc-multilib
48+
addons: *gcc_multilib
4849
- os: linux
4950
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
5051
- os: linux
5152
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
5253
- os: linux
5354
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
55+
- os: linux
56+
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
5457
- os: linux
5558
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
5659
- os: linux
@@ -61,50 +64,34 @@ matrix:
6164
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
6265
- os: linux
6366
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
64-
addons:
65-
apt:
66-
packages:
67-
- gcc-multilib
67+
addons: *gcc_multilib
6868
- os: linux
6969
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
70-
addons:
71-
apt:
72-
packages:
73-
- gcc-multilib
70+
addons: *gcc_multilib
7471
- os: linux
7572
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
76-
addons:
77-
apt:
78-
packages:
79-
- gcc-multilib
73+
addons: *gcc_multilib
74+
- os: linux
75+
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
76+
addons: *gcc_multilib
8077
- os: linux
8178
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
82-
addons:
83-
apt:
84-
packages:
85-
- gcc-multilib
79+
addons: *gcc_multilib
8680
- os: linux
8781
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
88-
addons:
89-
apt:
90-
packages:
91-
- gcc-multilib
82+
addons: *gcc_multilib
9283
- os: linux
9384
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
94-
addons:
95-
apt:
96-
packages:
97-
- gcc-multilib
85+
addons: *gcc_multilib
9886
- os: linux
9987
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
100-
addons:
101-
apt:
102-
packages:
103-
- gcc-multilib
88+
addons: *gcc_multilib
10489
- os: linux
10590
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
10691
- os: linux
10792
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
93+
- os: linux
94+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
10895
- os: linux
10996
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
11097
- os: linux
@@ -115,6 +102,8 @@ matrix:
115102
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
116103
- os: linux
117104
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
105+
- os: linux
106+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
118107
- os: linux
119108
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
120109
- os: linux
@@ -123,6 +112,8 @@ matrix:
123112
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
124113
- os: linux
125114
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
115+
- os: linux
116+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
126117
- os: linux
127118
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
128119
- os: linux
@@ -131,6 +122,14 @@ matrix:
131122
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
132123
- os: linux
133124
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
125+
- os: linux
126+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
127+
- os: linux
128+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
129+
- os: linux
130+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
131+
- os: linux
132+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
134133
- os: linux
135134
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
136135
- os: linux
@@ -143,10 +142,25 @@ matrix:
143142
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
144143
- os: linux
145144
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
145+
# Development build
146+
- os: linux
147+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
148+
# --enable-expermental-smallocx:
149+
- os: linux
150+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
151+
152+
# Valgrind
153+
- os: linux
154+
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" JEMALLOC_TEST_PREFIX="valgrind"
155+
addons:
156+
apt:
157+
packages:
158+
- valgrind
146159

147160

148161
before_script:
149162
- autoconf
163+
- scripts/gen_travis.py > travis_script && diff .travis.yml travis_script
150164
- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS
151165
- make -j3
152166
- make -j3 tests

COPYING

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Unless otherwise specified, files in the jemalloc source distribution are
22
subject to the following license:
33
--------------------------------------------------------------------------------
4-
Copyright (C) 2002-2018 Jason Evans <[email protected]>.
4+
Copyright (C) 2002-present Jason Evans <[email protected]>.
55
All rights reserved.
66
Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
7-
Copyright (C) 2009-2018 Facebook, Inc. All rights reserved.
7+
Copyright (C) 2009-present Facebook, Inc. All rights reserved.
88

99
Redistribution and use in source and binary forms, with or without
1010
modification, are permitted provided that the following conditions are met:

ChangeLog

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,110 @@ brevity. Much more detail can be found in the git revision history:
44

55
https://github.com/jemalloc/jemalloc
66

7-
* 5.1.0 (May 4th, 2018)
7+
* 5.2.0 (April 2, 2019)
8+
9+
This release includes a few notable improvements, which are summarized below:
10+
1) improved fast-path performance from the optimizations by @djwatson; 2)
11+
reduced virtual memory fragmentation and metadata usage; and 3) bug fixes on
12+
setting the number of background threads. In addition, peak / spike memory
13+
usage is improved with certain allocation patterns. As usual, the release and
14+
prior dev versions have gone through large-scale production testing.
15+
16+
New features:
17+
- Implement oversize_threshold, which uses a dedicated arena for allocations
18+
crossing the specified threshold to reduce fragmentation. (@interwq)
19+
- Add extents usage information to stats. (@tyleretzel)
20+
- Log time information for sampled allocations. (@tyleretzel)
21+
- Support 0 size in sdallocx. (@djwatson)
22+
- Output rate for certain counters in malloc_stats. (@zinoale)
23+
- Add configure option --enable-readlinkat, which allows the use of readlinkat
24+
over readlink. (@davidtgoldblatt)
25+
- Add configure options --{enable,disable}-{static,shared} to allow not
26+
building unwanted libraries. (@Ericson2314)
27+
- Add configure option --disable-libdl to enable fully static builds.
28+
(@interwq)
29+
- Add mallctl interfaces:
30+
+ opt.oversize_threshold (@interwq)
31+
+ stats.arenas.<i>.extent_avail (@tyleretzel)
32+
+ stats.arenas.<i>.extents.<j>.n{dirty,muzzy,retained} (@tyleretzel)
33+
+ stats.arenas.<i>.extents.<j>.{dirty,muzzy,retained}_bytes
34+
(@tyleretzel)
35+
36+
Portability improvements:
37+
- Update MSVC builds. (@maksqwe, @rustyx)
38+
- Workaround a compiler optimizer bug on s390x. (@rkmisra)
39+
- Make use of pthread_set_name_np(3) on FreeBSD. (@trasz)
40+
- Implement malloc_getcpu() to enable percpu_arena for windows. (@santagada)
41+
- Link against -pthread instead of -lpthread. (@paravoid)
42+
- Make background_thread not dependent on libdl. (@interwq)
43+
- Add stringify to fix a linker directive issue on MSVC. (@daverigby)
44+
- Detect and fall back when 8-bit atomics are unavailable. (@interwq)
45+
- Fall back to the default pthread_create if dlsym(3) fails. (@interwq)
46+
47+
Optimizations and refactors:
48+
- Refactor the TSD module. (@davidtgoldblatt)
49+
- Avoid taking extents_muzzy mutex when muzzy is disabled. (@interwq)
50+
- Avoid taking large_mtx for auto arenas on the tcache flush path. (@interwq)
51+
- Optimize ixalloc by avoiding a size lookup. (@interwq)
52+
- Implement opt.oversize_threshold which uses a dedicated arena for requests
53+
crossing the threshold, also eagerly purges the oversize extents. Default
54+
the threshold to 8 MiB. (@interwq)
55+
- Clean compilation with -Wextra. (@gnzlbg, @jasone)
56+
- Refactor the size class module. (@davidtgoldblatt)
57+
- Refactor the stats emitter. (@tyleretzel)
58+
- Optimize pow2_ceil. (@rkmisra)
59+
- Avoid runtime detection of lazy purging on FreeBSD. (@trasz)
60+
- Optimize mmap(2) alignment handling on FreeBSD. (@trasz)
61+
- Improve error handling for THP state initialization. (@jsteemann)
62+
- Rework the malloc() fast path. (@djwatson)
63+
- Rework the free() fast path. (@djwatson)
64+
- Refactor and optimize the tcache fill / flush paths. (@djwatson)
65+
- Optimize sync / lwsync on PowerPC. (@chmeeedalf)
66+
- Bypass extent_dalloc() when retain is enabled. (@interwq)
67+
- Optimize the locking on large deallocation. (@interwq)
68+
- Reduce the number of pages committed from sanity checking in debug build.
69+
(@trasz, @interwq)
70+
- Deprecate OSSpinLock. (@interwq)
71+
- Lower the default number of background threads to 4 (when the feature
72+
is enabled). (@interwq)
73+
- Optimize the trylock spin wait. (@djwatson)
74+
- Use arena index for arena-matching checks. (@interwq)
75+
- Avoid forced decay on thread termination when using background threads.
76+
(@interwq)
77+
- Disable muzzy decay by default. (@djwatson, @interwq)
78+
- Only initialize libgcc unwinder when profiling is enabled. (@paravoid,
79+
@interwq)
80+
81+
Bug fixes (all only relevant to jemalloc 5.x):
82+
- Fix background thread index issues with max_background_threads. (@djwatson,
83+
@interwq)
84+
- Fix stats output for opt.lg_extent_max_active_fit. (@interwq)
85+
- Fix opt.prof_prefix initialization. (@davidtgoldblatt)
86+
- Properly trigger decay on tcache destroy. (@interwq, @amosbird)
87+
- Fix tcache.flush. (@interwq)
88+
- Detect whether explicit extent zero out is necessary with huge pages or
89+
custom extent hooks, which may change the purge semantics. (@interwq)
90+
- Fix a side effect caused by extent_max_active_fit combined with decay-based
91+
purging, where freed extents can accumulate and not be reused for an
92+
extended period of time. (@interwq, @mpghf)
93+
- Fix a missing unlock on extent register error handling. (@zoulasc)
94+
95+
Testing:
96+
- Simplify the Travis script output. (@gnzlbg)
97+
- Update the test scripts for FreeBSD. (@devnexen)
98+
- Add unit tests for the producer-consumer pattern. (@interwq)
99+
- Add Cirrus-CI config for FreeBSD builds. (@jasone)
100+
- Add size-matching sanity checks on tcache flush. (@davidtgoldblatt,
101+
@interwq)
102+
103+
Incompatible changes:
104+
- Remove --with-lg-page-sizes. (@davidtgoldblatt)
105+
106+
Documentation:
107+
- Attempt to build docs by default, however skip doc building when xsltproc
108+
is missing. (@interwq, @cmuellner)
109+
110+
* 5.1.0 (May 4, 2018)
8111

9112
This release is primarily about fine-tuning, ranging from several new features
10113
to numerous notable performance and portability enhancements. The release and

INSTALL.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@ any of the following arguments (not a definitive list) to 'configure':
221221
system page size may change between configuration and execution, e.g. when
222222
cross compiling.
223223

224-
* `--with-lg-page-sizes=<lg-page-sizes>`
225-
226-
Specify the comma-separated base 2 logs of the page sizes to support. This
227-
option may be useful when cross compiling in combination with
228-
`--with-lg-page`, but its primary use case is for integration with FreeBSD's
229-
libc, wherein jemalloc is embedded.
230-
231224
* `--with-lg-hugepage=<lg-hugepage>`
232225

233226
Specify the base 2 log of the system huge page size. This option is useful
@@ -276,6 +269,11 @@ any of the following arguments (not a definitive list) to 'configure':
276269
in the same process, which will almost certainly result in confusing runtime
277270
crashes if pointers leak from one implementation to the other.
278271

272+
* `--disable-libdl`
273+
274+
Disable the usage of libdl, namely dlsym(3) which is required by the lazy
275+
lock option. This can allow building static binaries.
276+
279277
The following environment variables (not a definitive list) impact configure's
280278
behavior:
281279

0 commit comments

Comments
 (0)