Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit fc9b1db

Browse files
committed
Merge branch 'dev'
Conflicts: ChangeLog include/jemalloc/internal/chunk.h src/chunk.c src/huge.c src/jemalloc.c test/rallocm.c
2 parents fc1bb70 + cbb71ca commit fc9b1db

Some content is hidden

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

74 files changed

+10840
-8056
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/lib/
1212
/Makefile
1313
/include/jemalloc/internal/jemalloc_internal\.h
14+
/include/jemalloc/internal/size_classes\.h
1415
/include/jemalloc/jemalloc\.h
1516
/include/jemalloc/jemalloc_defs\.h
1617
/test/jemalloc_test\.h
@@ -21,3 +22,4 @@
2122
!test/*.c
2223
!test/*.exp
2324
/VERSION
25+
/bin/jemalloc.sh

COPYING

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Unless otherwise specified, files in the jemalloc source distribution are
2-
subject to the following licenses:
2+
subject to the following license:
33
--------------------------------------------------------------------------------
4-
Copyright (C) 2002-2010 Jason Evans <jasone@canonware.com>.
4+
Copyright (C) 2002-2012 Jason Evans <jasone@canonware.com>.
55
All rights reserved.
6-
Copyright (C) 2007-2010 Mozilla Foundation. All rights reserved.
6+
Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
7+
Copyright (C) 2009-2012 Facebook, Inc. All rights reserved.
78

89
Redistribution and use in source and binary forms, with or without
910
modification, are permitted provided that the following conditions are met:
@@ -24,28 +25,3 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2425
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2526
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2627
--------------------------------------------------------------------------------
27-
Copyright (C) 2009-2010 Facebook, Inc.
28-
All rights reserved.
29-
30-
Redistribution and use in source and binary forms, with or without modification,
31-
are permitted provided that the following conditions are met:
32-
* Redistributions of source code must retain the above copyright notice, this
33-
list of conditions and the following disclaimer.
34-
* Redistributions in binary form must reproduce the above copyright notice, this
35-
list of conditions and the following disclaimer in the documentation and/or
36-
other materials provided with the distribution.
37-
* Neither the name of Facebook, Inc. nor the names of its contributors may be
38-
used to endorse or promote products derived from this software without
39-
specific prior written permission.
40-
41-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
42-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
43-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
45-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
46-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
48-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51-
--------------------------------------------------------------------------------

ChangeLog

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,95 @@ found in the git revision history:
66
http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git
77
git://canonware.com/jemalloc.git
88

9+
* 3.0.0 (May 11, 2012)
10+
11+
Although this version adds some major new features, the primary focus is on
12+
internal code cleanup that facilitates maintainability and portability, most
13+
of which is not reflected in the ChangeLog. This is the first release to
14+
incorporate substantial contributions from numerous other developers, and the
15+
result is a more broadly useful allocator (see the git revision history for
16+
contribution details). Note that the license has been unified, thanks to
17+
Facebook granting a license under the same terms as the other copyright
18+
holders (see COPYING).
19+
20+
New features:
21+
- Implement Valgrind support, redzones, and quarantine.
22+
- Add support for additional platforms:
23+
+ FreeBSD
24+
+ Mac OS X Lion
25+
+ MinGW
26+
+ Windows (no support yet for replacing the system malloc)
27+
- Add support for additional architectures:
28+
+ MIPS
29+
+ SH4
30+
+ Tilera
31+
- Add support for cross compiling.
32+
- Add nallocm(), which rounds a request size up to the nearest size class
33+
without actually allocating.
34+
- Implement aligned_alloc() (blame C11).
35+
- Add the "thread.tcache.enabled" mallctl.
36+
- Add the "opt.prof_final" mallctl.
37+
- Update pprof (from gperftools 2.0).
38+
- Add the --with-mangling option.
39+
- Add the --disable-experimental option.
40+
- Add the --disable-munmap option, and make it the default on Linux.
41+
- Add the --enable-mremap option, which disables use of mremap(2) by default.
42+
43+
Incompatible changes:
44+
- Enable stats by default.
45+
- Enable fill by default.
46+
- Disable lazy locking by default.
47+
- Rename the "tcache.flush" mallctl to "thread.tcache.flush".
48+
- Rename the "arenas.pagesize" mallctl to "arenas.page".
49+
- Change the "opt.lg_prof_sample" default from 0 to 19 (1 B to 512 KiB).
50+
- Change the "opt.prof_accum" default from true to false.
51+
52+
Removed features:
53+
- Remove the swap feature, including the "config.swap", "swap.avail",
54+
"swap.prezeroed", "swap.nfds", and "swap.fds" mallctls.
55+
- Remove highruns statistics, including the
56+
"stats.arenas.<i>.bins.<j>.highruns" and
57+
"stats.arenas.<i>.lruns.<j>.highruns" mallctls.
58+
- As part of small size class refactoring, remove the "opt.lg_[qc]space_max",
59+
"arenas.cacheline", "arenas.subpage", "arenas.[tqcs]space_{min,max}", and
60+
"arenas.[tqcs]bins" mallctls.
61+
- Remove the "arenas.chunksize" mallctl.
62+
- Remove the "opt.lg_prof_tcmax" option.
63+
- Remove the "opt.lg_prof_bt_max" option.
64+
- Remove the "opt.lg_tcache_gc_sweep" option.
65+
- Remove the --disable-tiny option, including the "config.tiny" mallctl.
66+
- Remove the --enable-dynamic-page-shift configure option.
67+
- Remove the --enable-sysv configure option.
68+
69+
Bug fixes:
70+
- Fix a statistics-related bug in the "thread.arena" mallctl that could cause
71+
invalid statistics and crashes.
72+
- Work around TLS deallocation via free() on Linux. This bug could cause
73+
write-after-free memory corruption.
74+
- Fix a potential deadlock that could occur during interval- and
75+
growth-triggered heap profile dumps.
76+
- Fix large calloc() zeroing bugs due to dropping chunk map unzeroed flags.
77+
- Fix chunk_alloc_dss() to stop claiming memory is zeroed. This bug could
78+
cause memory corruption and crashes with --enable-dss specified.
79+
- Fix fork-related bugs that could cause deadlock in children between fork
80+
and exec.
81+
- Fix malloc_stats_print() to honor 'b' and 'l' in the opts parameter.
82+
- Fix realloc(p, 0) to act like free(p).
83+
- Do not enforce minimum alignment in memalign().
84+
- Check for NULL pointer in malloc_usable_size().
85+
- Fix an off-by-one heap profile statistics bug that could be observed in
86+
interval- and growth-triggered heap profiles.
87+
- Fix the "epoch" mallctl to update cached stats even if the passed in epoch
88+
is 0.
89+
- Fix bin->runcur management to fix a layout policy bug. This bug did not
90+
affect correctness.
91+
- Fix a bug in choose_arena_hard() that potentially caused more arenas to be
92+
initialized than necessary.
93+
- Add missing "opt.lg_tcache_max" mallctl implementation.
94+
- Use glibc allocator hooks to make mixed allocator usage less likely.
95+
- Fix build issues for --disable-tcache.
96+
- Don't mangle pthread_create() when --with-private-namespace is specified.
97+
998
* 2.2.5 (November 14, 2011)
1099

11100
Bug fixes:

INSTALL

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ any of the following arguments (not a definitive list) to 'configure':
2626
Embed one or more library paths, so that libjemalloc can find the libraries
2727
it is linked to. This works only on ELF-based systems.
2828

29+
--with-mangling=<map>
30+
Mangle public symbols specified in <map> which is a comma-separated list of
31+
name:mangled pairs.
32+
33+
For example, to use ld's --wrap option as an alternative method for
34+
overriding libc's malloc implementation, specify something like:
35+
36+
--with-mangling=malloc:__wrap_malloc,free:__wrap_free[...]
37+
38+
Note that mangling happens prior to application of the prefix specified by
39+
--with-jemalloc-prefix, and mangled symbols are then ignored when applying
40+
the prefix.
41+
2942
--with-jemalloc-prefix=<prefix>
3043
Prefix all public APIs with <prefix>. For example, if <prefix> is
3144
"prefix_", API changes like the following occur:
@@ -62,8 +75,8 @@ any of the following arguments (not a definitive list) to 'configure':
6275
Enable assertions and validation code. This incurs a substantial
6376
performance hit, but is very useful during application development.
6477

65-
--enable-stats
66-
Enable statistics gathering functionality. See the "opt.stats_print"
78+
--disable-stats
79+
Disable statistics gathering functionality. See the "opt.stats_print"
6780
option documentation for usage details.
6881

6982
--enable-prof
@@ -90,51 +103,50 @@ any of the following arguments (not a definitive list) to 'configure':
90103
Statically link against the specified libunwind.a rather than dynamically
91104
linking with -lunwind.
92105

93-
--disable-tiny
94-
Disable tiny (sub-quantum-sized) object support. Technically it is not
95-
legal for a malloc implementation to allocate objects with less than
96-
quantum alignment (8 or 16 bytes, depending on architecture), but in
97-
practice it never causes any problems if, for example, 4-byte allocations
98-
are 4-byte-aligned.
99-
100106
--disable-tcache
101107
Disable thread-specific caches for small objects. Objects are cached and
102108
released in bulk, thus reducing the total number of mutex operations. See
103109
the "opt.tcache" option for usage details.
104110

105-
--enable-swap
106-
Enable mmap()ed swap file support. When this feature is built in, it is
107-
possible to specify one or more files that act as backing store. This
108-
effectively allows for per application swap files.
111+
--enable-mremap
112+
Enable huge realloc() via mremap(2). mremap() is disabled by default
113+
because the flavor used is specific to Linux, which has a quirk in its
114+
virtual memory allocation algorithm that causes semi-permanent VM map holes
115+
under normal jemalloc operation.
116+
117+
--disable-munmap
118+
Disable virtual memory deallocation via munmap(2); instead keep track of
119+
the virtual memory for later use. munmap() is disabled by default (i.e.
120+
--disable-munmap is implied) on Linux, which has a quirk in its virtual
121+
memory allocation algorithm that causes semi-permanent VM map holes under
122+
normal jemalloc operation.
109123

110124
--enable-dss
111125
Enable support for page allocation/deallocation via sbrk(2), in addition to
112126
mmap(2).
113127

114-
--enable-fill
115-
Enable support for junk/zero filling of memory. See the "opt.junk"/
116-
"opt.zero" option documentation for usage details.
128+
--disable-fill
129+
Disable support for junk/zero filling of memory, quarantine, and redzones.
130+
See the "opt.junk", "opt.zero", "opt.quarantine", and "opt.redzone" option
131+
documentation for usage details.
132+
133+
--disable-valgrind
134+
Disable support for Valgrind.
135+
136+
--disable-experimental
137+
Disable support for the experimental API (*allocm()).
138+
139+
--enable-utrace
140+
Enable utrace(2)-based allocation tracing. This feature is not broadly
141+
portable (FreeBSD has it, but Linux and OS X do not).
117142

118143
--enable-xmalloc
119144
Enable support for optional immediate termination due to out-of-memory
120145
errors, as is commonly implemented by "xmalloc" wrapper function for malloc.
121146
See the "opt.xmalloc" option documentation for usage details.
122147

123-
--enable-sysv
124-
Enable support for System V semantics, wherein malloc(0) returns NULL
125-
rather than a minimal allocation. See the "opt.sysv" option documentation
126-
for usage details.
127-
128-
--enable-dynamic-page-shift
129-
Under most conditions, the system page size never changes (usually 4KiB or
130-
8KiB, depending on architecture and configuration), and unless this option
131-
is enabled, jemalloc assumes that page size can safely be determined during
132-
configuration and hard-coded. Enabling dynamic page size determination has
133-
a measurable impact on performance, since the compiler is forced to load
134-
the page size from memory rather than embedding immediate values.
135-
136-
--disable-lazy-lock
137-
Disable code that wraps pthread_create() to detect when an application
148+
--enable-lazy-lock
149+
Enable code that wraps pthread_create() to detect when an application
138150
switches from single-threaded to multi-threaded mode, so that it can avoid
139151
mutex locking/unlocking operations while in single-threaded mode. In
140152
practice, this feature usually has little impact on performance unless
@@ -181,11 +193,24 @@ PATH="?"
181193

182194
=== Advanced compilation =======================================================
183195

196+
To build only parts of jemalloc, use the following targets:
197+
198+
build_lib_shared
199+
build_lib_static
200+
build_lib
201+
build_doc_html
202+
build_doc_man
203+
build_doc
204+
184205
To install only parts of jemalloc, use the following targets:
185206

186207
install_bin
187208
install_include
209+
install_lib_shared
210+
install_lib_static
188211
install_lib
212+
install_doc_html
213+
install_doc_man
189214
install_doc
190215

191216
To clean up build results to varying degrees, use the following make targets:
@@ -248,10 +273,6 @@ directory, issue configuration and build commands:
248273

249274
The manual page is generated in both html and roff formats. Any web browser
250275
can be used to view the html manual. The roff manual page can be formatted
251-
prior to installation via any of the following commands:
276+
prior to installation via the following command:
252277

253278
nroff -man -t doc/jemalloc.3
254-
255-
groff -man -t -Tps doc/jemalloc.3 | ps2pdf - doc/jemalloc.3.pdf
256-
257-
(cd doc; groff -man -man-ext -t -Thtml jemalloc.3 > jemalloc.3.html)

0 commit comments

Comments
 (0)