Commit 36c1acc2 authored by antirez's avatar antirez
Browse files

Jemalloc updated to 4.4.0.

The original jemalloc source tree was modified to:

1. Remove the configure error that prevents nested builds.
2. Insert the Redis private Jemalloc API in order to allow the
Redis fragmentation function to work.
parent 37b4c954
version: '{build}'
environment:
matrix:
- MSYSTEM: MINGW64
CPU: x86_64
MSVC: amd64
- MSYSTEM: MINGW32
CPU: i686
MSVC: x86
- MSYSTEM: MINGW64
CPU: x86_64
- MSYSTEM: MINGW32
CPU: i686
install:
- set PATH=c:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH%
- if defined MSVC call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %MSVC%
- if defined MSVC pacman --noconfirm -Rsc mingw-w64-%CPU%-gcc gcc
- pacman --noconfirm -Suy mingw-w64-%CPU%-make
build_script:
- bash -c "autoconf"
- bash -c "./configure"
- mingw32-make -j3
- file lib/jemalloc.dll
- mingw32-make -j3 tests
- mingw32-make -k check
...@@ -73,3 +73,19 @@ test/include/test/jemalloc_test_defs.h ...@@ -73,3 +73,19 @@ test/include/test/jemalloc_test_defs.h
/test/unit/*.out /test/unit/*.out
/VERSION /VERSION
*.pdb
*.sdf
*.opendb
*.opensdf
*.cachefile
*.suo
*.user
*.sln.docstates
*.tmp
/msvc/Win32/
/msvc/x64/
/msvc/projects/*/*/Debug*/
/msvc/projects/*/*/Release*/
/msvc/projects/*/*/Win32/
/msvc/projects/*/*/x64/
language: c
matrix:
include:
- os: linux
compiler: gcc
- os: linux
compiler: gcc
env:
- EXTRA_FLAGS=-m32
addons:
apt:
packages:
- gcc-multilib
- os: osx
compiler: clang
- os: osx
compiler: clang
env:
- EXTRA_FLAGS=-m32
before_script:
- autoconf
- ./configure${EXTRA_FLAGS:+ CC="$CC $EXTRA_FLAGS"}
- make -j3
- make -j3 tests
script:
- make check
Unless otherwise specified, files in the jemalloc source distribution are Unless otherwise specified, files in the jemalloc source distribution are
subject to the following license: subject to the following license:
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Copyright (C) 2002-2015 Jason Evans <jasone@canonware.com>. Copyright (C) 2002-2016 Jason Evans <jasone@canonware.com>.
All rights reserved. All rights reserved.
Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved. Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
Copyright (C) 2009-2015 Facebook, Inc. All rights reserved. Copyright (C) 2009-2016 Facebook, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
......
...@@ -4,6 +4,226 @@ brevity. Much more detail can be found in the git revision history: ...@@ -4,6 +4,226 @@ brevity. Much more detail can be found in the git revision history:
https://github.com/jemalloc/jemalloc https://github.com/jemalloc/jemalloc
* 4.4.0 (December 3, 2016)
New features:
- Add configure support for *-*-linux-android. (@cferris1000, @jasone)
- Add the --disable-syscall configure option, for use on systems that place
security-motivated limitations on syscall(2). (@jasone)
- Add support for Debian GNU/kFreeBSD. (@thesam)
Optimizations:
- Add extent serial numbers and use them where appropriate as a sort key that
is higher priority than address, so that the allocation policy prefers older
extents. This tends to improve locality (decrease fragmentation) when
memory grows downward. (@jasone)
- Refactor madvise(2) configuration so that MADV_FREE is detected and utilized
on Linux 4.5 and newer. (@jasone)
- Mark partially purged arena chunks as non-huge-page. This improves
interaction with Linux's transparent huge page functionality. (@jasone)
Bug fixes:
- Fix size class computations for edge conditions involving extremely large
allocations. This regression was first released in 4.0.0. (@jasone,
@ingvarha)
- Remove overly restrictive assertions related to the cactive statistic. This
regression was first released in 4.1.0. (@jasone)
- Implement a more reliable detection scheme for os_unfair_lock on macOS.
(@jszakmeister)
* 4.3.1 (November 7, 2016)
Bug fixes:
- Fix a severe virtual memory leak. This regression was first released in
4.3.0. (@interwq, @jasone)
- Refactor atomic and prng APIs to restore support for 32-bit platforms that
use pre-C11 toolchains, e.g. FreeBSD's mips. (@jasone)
* 4.3.0 (November 4, 2016)
This is the first release that passes the test suite for multiple Windows
configurations, thanks in large part to @glandium setting up continuous
integration via AppVeyor (and Travis CI for Linux and OS X).
New features:
- Add "J" (JSON) support to malloc_stats_print(). (@jasone)
- Add Cray compiler support. (@ronawho)
Optimizations:
- Add/use adaptive spinning for bootstrapping and radix tree node
initialization. (@jasone)
Bug fixes:
- Fix large allocation to search starting in the optimal size class heap,
which can substantially reduce virtual memory churn and fragmentation. This
regression was first released in 4.0.0. (@mjp41, @jasone)
- Fix stats.arenas.<i>.nthreads accounting. (@interwq)
- Fix and simplify decay-based purging. (@jasone)
- Make DSS (sbrk(2)-related) operations lockless, which resolves potential
deadlocks during thread exit. (@jasone)
- Fix over-sized allocation of radix tree leaf nodes. (@mjp41, @ogaun,
@jasone)
- Fix over-sized allocation of arena_t (plus associated stats) data
structures. (@jasone, @interwq)
- Fix EXTRA_CFLAGS to not affect configuration. (@jasone)
- Fix a Valgrind integration bug. (@ronawho)
- Disallow 0x5a junk filling when running in Valgrind. (@jasone)
- Fix a file descriptor leak on Linux. This regression was first released in
4.2.0. (@vsarunas, @jasone)
- Fix static linking of jemalloc with glibc. (@djwatson)
- Use syscall(2) rather than {open,read,close}(2) during boot on Linux. This
works around other libraries' system call wrappers performing reentrant
allocation. (@kspinka, @Whissi, @jasone)
- Fix OS X default zone replacement to work with OS X 10.12. (@glandium,
@jasone)
- Fix cached memory management to avoid needless commit/decommit operations
during purging, which resolves permanent virtual memory map fragmentation
issues on Windows. (@mjp41, @jasone)
- Fix TSD fetches to avoid (recursive) allocation. This is relevant to
non-TLS and Windows configurations. (@jasone)
- Fix malloc_conf overriding to work on Windows. (@jasone)
- Forcibly disable lazy-lock on Windows (was forcibly *enabled*). (@jasone)
* 4.2.1 (June 8, 2016)
Bug fixes:
- Fix bootstrapping issues for configurations that require allocation during
tsd initialization (e.g. --disable-tls). (@cferris1000, @jasone)
- Fix gettimeofday() version of nstime_update(). (@ronawho)
- Fix Valgrind regressions in calloc() and chunk_alloc_wrapper(). (@ronawho)
- Fix potential VM map fragmentation regression. (@jasone)
- Fix opt_zero-triggered in-place huge reallocation zeroing. (@jasone)
- Fix heap profiling context leaks in reallocation edge cases. (@jasone)
* 4.2.0 (May 12, 2016)
New features:
- Add the arena.<i>.reset mallctl, which makes it possible to discard all of
an arena's allocations in a single operation. (@jasone)
- Add the stats.retained and stats.arenas.<i>.retained statistics. (@jasone)
- Add the --with-version configure option. (@jasone)
- Support --with-lg-page values larger than actual page size. (@jasone)
Optimizations:
- Use pairing heaps rather than red-black trees for various hot data
structures. (@djwatson, @jasone)
- Streamline fast paths of rtree operations. (@jasone)
- Optimize the fast paths of calloc() and [m,d,sd]allocx(). (@jasone)
- Decommit unused virtual memory if the OS does not overcommit. (@jasone)
- Specify MAP_NORESERVE on Linux if [heuristic] overcommit is active, in order
to avoid unfortunate interactions during fork(2). (@jasone)
Bug fixes:
- Fix chunk accounting related to triggering gdump profiles. (@jasone)
- Link against librt for clock_gettime(2) if glibc < 2.17. (@jasone)
- Scale leak report summary according to sampling probability. (@jasone)
* 4.1.1 (May 3, 2016)
This bugfix release resolves a variety of mostly minor issues, though the
bitmap fix is critical for 64-bit Windows.
Bug fixes:
- Fix the linear scan version of bitmap_sfu() to shift by the proper amount
even when sizeof(long) is not the same as sizeof(void *), as on 64-bit
Windows. (@jasone)
- Fix hashing functions to avoid unaligned memory accesses (and resulting
crashes). This is relevant at least to some ARM-based platforms.
(@rkmisra)
- Fix fork()-related lock rank ordering reversals. These reversals were
unlikely to cause deadlocks in practice except when heap profiling was
enabled and active. (@jasone)
- Fix various chunk leaks in OOM code paths. (@jasone)
- Fix malloc_stats_print() to print opt.narenas correctly. (@jasone)
- Fix MSVC-specific build/test issues. (@rustyx, @yuslepukhin)
- Fix a variety of test failures that were due to test fragility rather than
core bugs. (@jasone)
* 4.1.0 (February 28, 2016)
This release is primarily about optimizations, but it also incorporates a lot
of portability-motivated refactoring and enhancements. Many people worked on
this release, to an extent that even with the omission here of minor changes
(see git revision history), and of the people who reported and diagnosed
issues, so much of the work was contributed that starting with this release,
changes are annotated with author credits to help reflect the collaborative
effort involved.
New features:
- Implement decay-based unused dirty page purging, a major optimization with
mallctl API impact. This is an alternative to the existing ratio-based
unused dirty page purging, and is intended to eventually become the sole
purging mechanism. New mallctls:
+ opt.purge
+ opt.decay_time
+ arena.<i>.decay
+ arena.<i>.decay_time
+ arenas.decay_time
+ stats.arenas.<i>.decay_time
(@jasone, @cevans87)
- Add --with-malloc-conf, which makes it possible to embed a default
options string during configuration. This was motivated by the desire to
specify --with-malloc-conf=purge:decay , since the default must remain
purge:ratio until the 5.0.0 release. (@jasone)
- Add MS Visual Studio 2015 support. (@rustyx, @yuslepukhin)
- Make *allocx() size class overflow behavior defined. The maximum
size class is now less than PTRDIFF_MAX to protect applications against
numerical overflow, and all allocation functions are guaranteed to indicate
errors rather than potentially crashing if the request size exceeds the
maximum size class. (@jasone)
- jeprof:
+ Add raw heap profile support. (@jasone)
+ Add --retain and --exclude for backtrace symbol filtering. (@jasone)
Optimizations:
- Optimize the fast path to combine various bootstrapping and configuration
checks and execute more streamlined code in the common case. (@interwq)
- Use linear scan for small bitmaps (used for small object tracking). In
addition to speeding up bitmap operations on 64-bit systems, this reduces
allocator metadata overhead by approximately 0.2%. (@djwatson)
- Separate arena_avail trees, which substantially speeds up run tree
operations. (@djwatson)
- Use memoization (boot-time-computed table) for run quantization. Separate
arena_avail trees reduced the importance of this optimization. (@jasone)
- Attempt mmap-based in-place huge reallocation. This can dramatically speed
up incremental huge reallocation. (@jasone)
Incompatible changes:
- Make opt.narenas unsigned rather than size_t. (@jasone)
Bug fixes:
- Fix stats.cactive accounting regression. (@rustyx, @jasone)
- Handle unaligned keys in hash(). This caused problems for some ARM systems.
(@jasone, @cferris1000)
- Refactor arenas array. In addition to fixing a fork-related deadlock, this
makes arena lookups faster and simpler. (@jasone)
- Move retained memory allocation out of the default chunk allocation
function, to a location that gets executed even if the application installs
a custom chunk allocation function. This resolves a virtual memory leak.
(@buchgr)
- Fix a potential tsd cleanup leak. (@cferris1000, @jasone)
- Fix run quantization. In practice this bug had no impact unless
applications requested memory with alignment exceeding one page.
(@jasone, @djwatson)
- Fix LinuxThreads-specific bootstrapping deadlock. (Cosmin Paraschiv)
- jeprof:
+ Don't discard curl options if timeout is not defined. (@djwatson)
+ Detect failed profile fetches. (@djwatson)
- Fix stats.arenas.<i>.{dss,lg_dirty_mult,decay_time,pactive,pdirty} for
--disable-stats case. (@jasone)
* 4.0.4 (October 24, 2015)
This bugfix release fixes another xallocx() regression. No other regressions
have come to light in over a month, so this is likely a good starting point
for people who prefer to wait for "dot one" releases with all the major issues
shaken out.
Bug fixes:
- Fix xallocx(..., MALLOCX_ZERO to zero the last full trailing page of large
allocations that have been randomly assigned an offset of 0 when
--enable-cache-oblivious configure option is enabled.
* 4.0.3 (September 24, 2015) * 4.0.3 (September 24, 2015)
This bugfix release continues the trend of xallocx() and heap profiling fixes. This bugfix release continues the trend of xallocx() and heap profiling fixes.
......
...@@ -35,6 +35,10 @@ any of the following arguments (not a definitive list) to 'configure': ...@@ -35,6 +35,10 @@ any of the following arguments (not a definitive list) to 'configure':
will cause files to be installed into /usr/local/include, /usr/local/lib, will cause files to be installed into /usr/local/include, /usr/local/lib,
and /usr/local/man. and /usr/local/man.
--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>
Use the specified version string rather than trying to generate one (if in
a git repository) or use existing the VERSION file (if present).
--with-rpath=<colon-separated-rpath> --with-rpath=<colon-separated-rpath>
Embed one or more library paths, so that libjemalloc can find the libraries Embed one or more library paths, so that libjemalloc can find the libraries
it is linked to. This works only on ELF-based systems. it is linked to. This works only on ELF-based systems.
...@@ -84,6 +88,14 @@ any of the following arguments (not a definitive list) to 'configure': ...@@ -84,6 +88,14 @@ any of the following arguments (not a definitive list) to 'configure':
versions of jemalloc can coexist in the same installation directory. For versions of jemalloc can coexist in the same installation directory. For
example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0. example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0.
--with-malloc-conf=<malloc_conf>
Embed <malloc_conf> as a run-time options string that is processed prior to
the malloc_conf global variable, the /etc/malloc.conf symlink, and the
MALLOC_CONF environment variable. For example, to change the default chunk
size to 256 KiB:
--with-malloc-conf=lg_chunk:18
--disable-cc-silence --disable-cc-silence
Disable code that silences non-useful compiler warnings. This is mainly Disable code that silences non-useful compiler warnings. This is mainly
useful during development when auditing the set of warnings that are being useful during development when auditing the set of warnings that are being
...@@ -194,6 +206,11 @@ any of the following arguments (not a definitive list) to 'configure': ...@@ -194,6 +206,11 @@ any of the following arguments (not a definitive list) to 'configure':
most extreme case increases physical memory usage for the 16 KiB size class most extreme case increases physical memory usage for the 16 KiB size class
to 20 KiB. to 20 KiB.
--disable-syscall
Disable use of syscall(2) rather than {open,read,write,close}(2). This is
intended as a workaround for systems that place security limitations on
syscall(2).
--with-xslroot=<path> --with-xslroot=<path>
Specify where to find DocBook XSL stylesheets when building the Specify where to find DocBook XSL stylesheets when building the
documentation. documentation.
...@@ -315,6 +332,15 @@ LDFLAGS="?" ...@@ -315,6 +332,15 @@ LDFLAGS="?"
PATH="?" PATH="?"
'configure' uses this to find programs. 'configure' uses this to find programs.
In some cases it may be necessary to work around configuration results that do
not match reality. For example, Linux 4.5 added support for the MADV_FREE flag
to madvise(2), which can cause problems if building on a host with MADV_FREE
support and deploying to a target without. To work around this, use a cache
file to override the relevant configuration variable defined in configure.ac,
e.g.:
echo "je_cv_madv_free=no" > config.cache && ./configure -C
=== Advanced compilation ======================================================= === Advanced compilation =======================================================
To build only parts of jemalloc, use the following targets: To build only parts of jemalloc, use the following targets:
......
...@@ -24,11 +24,11 @@ abs_objroot := @abs_objroot@ ...@@ -24,11 +24,11 @@ abs_objroot := @abs_objroot@
# Build parameters. # Build parameters.
CPPFLAGS := @CPPFLAGS@ -I$(srcroot)include -I$(objroot)include CPPFLAGS := @CPPFLAGS@ -I$(srcroot)include -I$(objroot)include
CFLAGS := @CFLAGS@ EXTRA_CFLAGS := @EXTRA_CFLAGS@
CFLAGS := @CFLAGS@ $(EXTRA_CFLAGS)
LDFLAGS := @LDFLAGS@ LDFLAGS := @LDFLAGS@
EXTRA_LDFLAGS := @EXTRA_LDFLAGS@ EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
LIBS := @LIBS@ LIBS := @LIBS@
TESTLIBS := @TESTLIBS@
RPATH_EXTRA := @RPATH_EXTRA@ RPATH_EXTRA := @RPATH_EXTRA@
SO := @so@ SO := @so@
IMPORTLIB := @importlib@ IMPORTLIB := @importlib@
...@@ -53,15 +53,19 @@ enable_prof := @enable_prof@ ...@@ -53,15 +53,19 @@ enable_prof := @enable_prof@
enable_valgrind := @enable_valgrind@ enable_valgrind := @enable_valgrind@
enable_zone_allocator := @enable_zone_allocator@ enable_zone_allocator := @enable_zone_allocator@
MALLOC_CONF := @JEMALLOC_CPREFIX@MALLOC_CONF MALLOC_CONF := @JEMALLOC_CPREFIX@MALLOC_CONF
link_whole_archive := @link_whole_archive@
DSO_LDFLAGS = @DSO_LDFLAGS@ DSO_LDFLAGS = @DSO_LDFLAGS@
SOREV = @SOREV@ SOREV = @SOREV@
PIC_CFLAGS = @PIC_CFLAGS@ PIC_CFLAGS = @PIC_CFLAGS@
CTARGET = @CTARGET@ CTARGET = @CTARGET@
LDTARGET = @LDTARGET@ LDTARGET = @LDTARGET@
TEST_LD_MODE = @TEST_LD_MODE@
MKLIB = @MKLIB@ MKLIB = @MKLIB@
AR = @AR@ AR = @AR@
ARFLAGS = @ARFLAGS@ ARFLAGS = @ARFLAGS@
CC_MM = @CC_MM@ CC_MM = @CC_MM@
LM := @LM@
INSTALL = @INSTALL@
ifeq (macho, $(ABI)) ifeq (macho, $(ABI))
TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib" TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
...@@ -78,15 +82,34 @@ LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix) ...@@ -78,15 +82,34 @@ LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
# Lists of files. # Lists of files.
BINS := $(objroot)bin/jemalloc-config $(objroot)bin/jemalloc.sh $(objroot)bin/jeprof BINS := $(objroot)bin/jemalloc-config $(objroot)bin/jemalloc.sh $(objroot)bin/jeprof
C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h
C_SRCS := $(srcroot)src/jemalloc.c $(srcroot)src/arena.c \ C_SRCS := $(srcroot)src/jemalloc.c \
$(srcroot)src/atomic.c $(srcroot)src/base.c $(srcroot)src/bitmap.c \ $(srcroot)src/arena.c \
$(srcroot)src/chunk.c $(srcroot)src/chunk_dss.c \ $(srcroot)src/atomic.c \
$(srcroot)src/chunk_mmap.c $(srcroot)src/ckh.c $(srcroot)src/ctl.c \ $(srcroot)src/base.c \
$(srcroot)src/extent.c $(srcroot)src/hash.c $(srcroot)src/huge.c \ $(srcroot)src/bitmap.c \
$(srcroot)src/mb.c $(srcroot)src/mutex.c $(srcroot)src/pages.c \ $(srcroot)src/chunk.c \
$(srcroot)src/prof.c $(srcroot)src/quarantine.c $(srcroot)src/rtree.c \ $(srcroot)src/chunk_dss.c \
$(srcroot)src/stats.c $(srcroot)src/tcache.c $(srcroot)src/util.c \ $(srcroot)src/chunk_mmap.c \
$(srcroot)src/tsd.c $(srcroot)src/ckh.c \
$(srcroot)src/ctl.c \
$(srcroot)src/extent.c \
$(srcroot)src/hash.c \
$(srcroot)src/huge.c \
$(srcroot)src/mb.c \
$(srcroot)src/mutex.c \
$(srcroot)src/nstime.c \
$(srcroot)src/pages.c \
$(srcroot)src/prng.c \
$(srcroot)src/prof.c \
$(srcroot)src/quarantine.c \
$(srcroot)src/rtree.c \
$(srcroot)src/stats.c \
$(srcroot)src/spin.c \
$(srcroot)src/tcache.c \
$(srcroot)src/ticker.c \
$(srcroot)src/tsd.c \
$(srcroot)src/util.c \
$(srcroot)src/witness.c
ifeq ($(enable_valgrind), 1) ifeq ($(enable_valgrind), 1)
C_SRCS += $(srcroot)src/valgrind.c C_SRCS += $(srcroot)src/valgrind.c
endif endif
...@@ -105,6 +128,11 @@ DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV) ...@@ -105,6 +128,11 @@ DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
ifneq ($(SOREV),$(SO)) ifneq ($(SOREV),$(SO))
DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO) DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
endif endif
ifeq (1, $(link_whole_archive))
LJEMALLOC := -Wl,--whole-archive -L$(objroot)lib -l$(LIBJEMALLOC) -Wl,--no-whole-archive
else
LJEMALLOC := $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
endif
PC := $(objroot)jemalloc.pc PC := $(objroot)jemalloc.pc
MAN3 := $(objroot)doc/jemalloc$(install_suffix).3 MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
...@@ -116,10 +144,19 @@ C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \ ...@@ -116,10 +144,19 @@ C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \
$(srcroot)test/src/mtx.c $(srcroot)test/src/mq.c \ $(srcroot)test/src/mtx.c $(srcroot)test/src/mq.c \
$(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \ $(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \
$(srcroot)test/src/thd.c $(srcroot)test/src/timer.c $(srcroot)test/src/thd.c $(srcroot)test/src/timer.c
C_UTIL_INTEGRATION_SRCS := $(srcroot)src/util.c ifeq (1, $(link_whole_archive))
TESTS_UNIT := $(srcroot)test/unit/atomic.c \ C_UTIL_INTEGRATION_SRCS :=
else
C_UTIL_INTEGRATION_SRCS := $(srcroot)src/nstime.c $(srcroot)src/util.c
endif
TESTS_UNIT := \
$(srcroot)test/unit/a0.c \
$(srcroot)test/unit/arena_reset.c \
$(srcroot)test/unit/atomic.c \
$(srcroot)test/unit/bitmap.c \ $(srcroot)test/unit/bitmap.c \
$(srcroot)test/unit/ckh.c \ $(srcroot)test/unit/ckh.c \
$(srcroot)test/unit/decay.c \
$(srcroot)test/unit/fork.c \
$(srcroot)test/unit/hash.c \ $(srcroot)test/unit/hash.c \
$(srcroot)test/unit/junk.c \ $(srcroot)test/unit/junk.c \
$(srcroot)test/unit/junk_alloc.c \ $(srcroot)test/unit/junk_alloc.c \
...@@ -129,6 +166,10 @@ TESTS_UNIT := $(srcroot)test/unit/atomic.c \ ...@@ -129,6 +166,10 @@ TESTS_UNIT := $(srcroot)test/unit/atomic.c \
$(srcroot)test/unit/math.c \ $(srcroot)test/unit/math.c \
$(srcroot)test/unit/mq.c \ $(srcroot)test/unit/mq.c \
$(srcroot)test/unit/mtx.c \ $(srcroot)test/unit/mtx.c \
$(srcroot)test/unit/pack.c \
$(srcroot)test/unit/pages.c \
$(srcroot)test/unit/ph.c \
$(srcroot)test/unit/prng.c \
$(srcroot)test/unit/prof_accum.c \ $(srcroot)test/unit/prof_accum.c \
$(srcroot)test/unit/prof_active.c \ $(srcroot)test/unit/prof_active.c \
$(srcroot)test/unit/prof_gdump.c \ $(srcroot)test/unit/prof_gdump.c \
...@@ -140,11 +181,16 @@ TESTS_UNIT := $(srcroot)test/unit/atomic.c \ ...@@ -140,11 +181,16 @@ TESTS_UNIT := $(srcroot)test/unit/atomic.c \
$(srcroot)test/unit/quarantine.c \ $(srcroot)test/unit/quarantine.c \
$(srcroot)test/unit/rb.c \ $(srcroot)test/unit/rb.c \
$(srcroot)test/unit/rtree.c \ $(srcroot)test/unit/rtree.c \
$(srcroot)test/unit/run_quantize.c \
$(srcroot)test/unit/SFMT.c \ $(srcroot)test/unit/SFMT.c \
$(srcroot)test/unit/size_classes.c \ $(srcroot)test/unit/size_classes.c \
$(srcroot)test/unit/smoothstep.c \
$(srcroot)test/unit/stats.c \ $(srcroot)test/unit/stats.c \
$(srcroot)test/unit/ticker.c \
$(srcroot)test/unit/nstime.c \
$(srcroot)test/unit/tsd.c \ $(srcroot)test/unit/tsd.c \
$(srcroot)test/unit/util.c \ $(srcroot)test/unit/util.c \
$(srcroot)test/unit/witness.c \
$(srcroot)test/unit/zero.c $(srcroot)test/unit/zero.c
TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \ TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
$(srcroot)test/integration/allocated.c \ $(srcroot)test/integration/allocated.c \
...@@ -266,69 +312,69 @@ $(STATIC_LIBS): ...@@ -266,69 +312,69 @@ $(STATIC_LIBS):
$(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(TESTS_UNIT_LINK_OBJS) $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS) $(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(TESTS_UNIT_LINK_OBJS) $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(TESTLIBS) $(EXTRA_LDFLAGS) $(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
$(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(filter -lpthread,$(LIBS))) -lm $(TESTLIBS) $(EXTRA_LDFLAGS) $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -lpthread,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
$(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(TESTLIBS) $(EXTRA_LDFLAGS) $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
build_lib_shared: $(DSOS) build_lib_shared: $(DSOS)
build_lib_static: $(STATIC_LIBS) build_lib_static: $(STATIC_LIBS)
build_lib: build_lib_shared build_lib_static build_lib: build_lib_shared build_lib_static
install_bin: install_bin:
install -d $(BINDIR) $(INSTALL) -d $(BINDIR)
@for b in $(BINS); do \ @for b in $(BINS); do \
echo "install -m 755 $$b $(BINDIR)"; \ echo "$(INSTALL) -m 755 $$b $(BINDIR)"; \
install -m 755 $$b $(BINDIR); \ $(INSTALL) -m 755 $$b $(BINDIR); \
done done
install_include: install_include:
install -d $(INCLUDEDIR)/jemalloc $(INSTALL) -d $(INCLUDEDIR)/jemalloc
@for h in $(C_HDRS); do \ @for h in $(C_HDRS); do \
echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \ echo "$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
install -m 644 $$h $(INCLUDEDIR)/jemalloc; \ $(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc; \
done done
install_lib_shared: $(DSOS) install_lib_shared: $(DSOS)
install -d $(LIBDIR) $(INSTALL) -d $(LIBDIR)
install -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR) $(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
ifneq ($(SOREV),$(SO)) ifneq ($(SOREV),$(SO))
ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO) ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
endif endif
install_lib_static: $(STATIC_LIBS) install_lib_static: $(STATIC_LIBS)
install -d $(LIBDIR) $(INSTALL) -d $(LIBDIR)
@for l in $(STATIC_LIBS); do \ @for l in $(STATIC_LIBS); do \
echo "install -m 755 $$l $(LIBDIR)"; \ echo "$(INSTALL) -m 755 $$l $(LIBDIR)"; \
install -m 755 $$l $(LIBDIR); \ $(INSTALL) -m 755 $$l $(LIBDIR); \
done done
install_lib_pc: $(PC) install_lib_pc: $(PC)
install -d $(LIBDIR)/pkgconfig $(INSTALL) -d $(LIBDIR)/pkgconfig
@for l in $(PC); do \ @for l in $(PC); do \
echo "install -m 644 $$l $(LIBDIR)/pkgconfig"; \ echo "$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig"; \
install -m 644 $$l $(LIBDIR)/pkgconfig; \ $(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig; \
done done
install_lib: install_lib_shared install_lib_static install_lib_pc install_lib: install_lib_shared install_lib_static install_lib_pc
install_doc_html: install_doc_html:
install -d $(DATADIR)/doc/jemalloc$(install_suffix) $(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
@for d in $(DOCS_HTML); do \ @for d in $(DOCS_HTML); do \
echo "install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \ echo "$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \ $(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
done done
install_doc_man: install_doc_man:
install -d $(MANDIR)/man3 $(INSTALL) -d $(MANDIR)/man3
@for d in $(DOCS_MAN3); do \ @for d in $(DOCS_MAN3); do \
echo "install -m 644 $$d $(MANDIR)/man3"; \ echo "$(INSTALL) -m 644 $$d $(MANDIR)/man3"; \
install -m 644 $$d $(MANDIR)/man3; \ $(INSTALL) -m 644 $$d $(MANDIR)/man3; \
done done
install_doc: install_doc_html install_doc_man install_doc: install_doc_html install_doc_man
...@@ -349,18 +395,22 @@ stress_dir: ...@@ -349,18 +395,22 @@ stress_dir:
check_dir: check_unit_dir check_integration_dir check_dir: check_unit_dir check_integration_dir
check_unit: tests_unit check_unit_dir check_unit: tests_unit check_unit_dir
$(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%) $(MALLOC_CONF)="purge:ratio" $(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
$(MALLOC_CONF)="purge:decay" $(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
check_integration_prof: tests_integration check_integration_dir check_integration_prof: tests_integration check_integration_dir
ifeq ($(enable_prof), 1) ifeq ($(enable_prof), 1)
$(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
$(MALLOC_CONF)="prof:true,prof_active:false" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(MALLOC_CONF)="prof:true,prof_active:false" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
endif endif
check_integration_decay: tests_integration check_integration_dir
$(MALLOC_CONF)="purge:decay,decay_time:-1" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
$(MALLOC_CONF)="purge:decay,decay_time:0" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
$(MALLOC_CONF)="purge:decay" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
check_integration: tests_integration check_integration_dir check_integration: tests_integration check_integration_dir
$(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
stress: tests_stress stress_dir stress: tests_stress stress_dir
$(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%) $(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%)
check: tests check_dir check_integration_prof check: check_unit check_integration check_integration_decay check_integration_prof
$(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
ifeq ($(enable_code_coverage), 1) ifeq ($(enable_code_coverage), 1)
coverage_unit: check_unit coverage_unit: check_unit
......
...@@ -17,4 +17,4 @@ jemalloc. ...@@ -17,4 +17,4 @@ jemalloc.
The ChangeLog file contains a brief summary of changes for each release. The ChangeLog file contains a brief summary of changes for each release.
URL: http://www.canonware.com/jemalloc/ URL: http://jemalloc.net/
4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c 4.4.0-0-gf1f76357313e7dcad7262f17a48ff0a2e005fcdc
...@@ -95,7 +95,7 @@ my @EVINCE = ("evince"); # could also be xpdf or perhaps acroread ...@@ -95,7 +95,7 @@ my @EVINCE = ("evince"); # could also be xpdf or perhaps acroread
my @KCACHEGRIND = ("kcachegrind"); my @KCACHEGRIND = ("kcachegrind");
my @PS2PDF = ("ps2pdf"); my @PS2PDF = ("ps2pdf");
# These are used for dynamic profiles # These are used for dynamic profiles
my @URL_FETCHER = ("curl", "-s"); my @URL_FETCHER = ("curl", "-s", "--fail");
# These are the web pages that servers need to support for dynamic profiles # These are the web pages that servers need to support for dynamic profiles
my $HEAP_PAGE = "/pprof/heap"; my $HEAP_PAGE = "/pprof/heap";
...@@ -223,12 +223,14 @@ Call-graph Options: ...@@ -223,12 +223,14 @@ Call-graph Options:
--nodefraction=<f> Hide nodes below <f>*total [default=.005] --nodefraction=<f> Hide nodes below <f>*total [default=.005]
--edgefraction=<f> Hide edges below <f>*total [default=.001] --edgefraction=<f> Hide edges below <f>*total [default=.001]
--maxdegree=<n> Max incoming/outgoing edges per node [default=8] --maxdegree=<n> Max incoming/outgoing edges per node [default=8]
--focus=<regexp> Focus on nodes matching <regexp> --focus=<regexp> Focus on backtraces with nodes matching <regexp>
--thread=<n> Show profile for thread <n> --thread=<n> Show profile for thread <n>
--ignore=<regexp> Ignore nodes matching <regexp> --ignore=<regexp> Ignore backtraces with nodes matching <regexp>
--scale=<n> Set GV scaling [default=0] --scale=<n> Set GV scaling [default=0]
--heapcheck Make nodes with non-0 object counts --heapcheck Make nodes with non-0 object counts
(i.e. direct leak generators) more visible (i.e. direct leak generators) more visible
--retain=<regexp> Retain only nodes that match <regexp>
--exclude=<regexp> Exclude all nodes that match <regexp>
Miscellaneous: Miscellaneous:
--tools=<prefix or binary:fullpath>[,...] \$PATH for object tool pathnames --tools=<prefix or binary:fullpath>[,...] \$PATH for object tool pathnames
...@@ -339,6 +341,8 @@ sub Init() { ...@@ -339,6 +341,8 @@ sub Init() {
$main::opt_ignore = ''; $main::opt_ignore = '';
$main::opt_scale = 0; $main::opt_scale = 0;
$main::opt_heapcheck = 0; $main::opt_heapcheck = 0;
$main::opt_retain = '';
$main::opt_exclude = '';
$main::opt_seconds = 30; $main::opt_seconds = 30;
$main::opt_lib = ""; $main::opt_lib = "";
...@@ -410,6 +414,8 @@ sub Init() { ...@@ -410,6 +414,8 @@ sub Init() {
"ignore=s" => \$main::opt_ignore, "ignore=s" => \$main::opt_ignore,
"scale=i" => \$main::opt_scale, "scale=i" => \$main::opt_scale,
"heapcheck" => \$main::opt_heapcheck, "heapcheck" => \$main::opt_heapcheck,
"retain=s" => \$main::opt_retain,
"exclude=s" => \$main::opt_exclude,
"inuse_space!" => \$main::opt_inuse_space, "inuse_space!" => \$main::opt_inuse_space,
"inuse_objects!" => \$main::opt_inuse_objects, "inuse_objects!" => \$main::opt_inuse_objects,
"alloc_space!" => \$main::opt_alloc_space, "alloc_space!" => \$main::opt_alloc_space,
...@@ -1160,8 +1166,21 @@ sub PrintSymbolizedProfile { ...@@ -1160,8 +1166,21 @@ sub PrintSymbolizedProfile {
} }
print '---', "\n"; print '---', "\n";
my $profile_marker;
if ($main::profile_type eq 'heap') {
$HEAP_PAGE =~ m,[^/]+$,; # matches everything after the last slash
$profile_marker = $&;
} elsif ($main::profile_type eq 'growth') {
$GROWTH_PAGE =~ m,[^/]+$,; # matches everything after the last slash
$profile_marker = $&;
} elsif ($main::profile_type eq 'contention') {
$CONTENTION_PAGE =~ m,[^/]+$,; # matches everything after the last slash
$profile_marker = $&;
} else { # elsif ($main::profile_type eq 'cpu')
$PROFILE_PAGE =~ m,[^/]+$,; # matches everything after the last slash $PROFILE_PAGE =~ m,[^/]+$,; # matches everything after the last slash
my $profile_marker = $&; $profile_marker = $&;
}
print '--- ', $profile_marker, "\n"; print '--- ', $profile_marker, "\n";
if (defined($main::collected_profile)) { if (defined($main::collected_profile)) {
# if used with remote fetch, simply dump the collected profile to output. # if used with remote fetch, simply dump the collected profile to output.
...@@ -1171,6 +1190,12 @@ sub PrintSymbolizedProfile { ...@@ -1171,6 +1190,12 @@ sub PrintSymbolizedProfile {
} }
close(SRC); close(SRC);
} else { } else {
# --raw/http: For everything to work correctly for non-remote profiles, we
# would need to extend PrintProfileData() to handle all possible profile
# types, re-enable the code that is currently disabled in ReadCPUProfile()
# and FixCallerAddresses(), and remove the remote profile dumping code in
# the block above.
die "--raw/http: jeprof can only dump remote profiles for --raw\n";
# dump a cpu-format profile to standard out # dump a cpu-format profile to standard out
PrintProfileData($profile); PrintProfileData($profile);
} }
...@@ -2821,6 +2846,43 @@ sub ExtractCalls { ...@@ -2821,6 +2846,43 @@ sub ExtractCalls {
return $calls; return $calls;
} }
sub FilterFrames {
my $symbols = shift;
my $profile = shift;
if ($main::opt_retain eq '' && $main::opt_exclude eq '') {
return $profile;
}
my $result = {};
foreach my $k (keys(%{$profile})) {
my $count = $profile->{$k};
my @addrs = split(/\n/, $k);
my @path = ();
foreach my $a (@addrs) {
my $sym;
if (exists($symbols->{$a})) {
$sym = $symbols->{$a}->[0];
} else {
$sym = $a;
}
if ($main::opt_retain ne '' && $sym !~ m/$main::opt_retain/) {
next;
}
if ($main::opt_exclude ne '' && $sym =~ m/$main::opt_exclude/) {
next;
}
push(@path, $a);
}
if (scalar(@path) > 0) {
my $reduced_path = join("\n", @path);
AddEntry($result, $reduced_path, $count);
}
}
return $result;
}
sub RemoveUninterestingFrames { sub RemoveUninterestingFrames {
my $symbols = shift; my $symbols = shift;
my $profile = shift; my $profile = shift;
...@@ -2965,6 +3027,9 @@ sub RemoveUninterestingFrames { ...@@ -2965,6 +3027,9 @@ sub RemoveUninterestingFrames {
my $reduced_path = join("\n", @path); my $reduced_path = join("\n", @path);
AddEntry($result, $reduced_path, $count); AddEntry($result, $reduced_path, $count);
} }
$result = FilterFrames($symbols, $result);
return $result; return $result;
} }
...@@ -3274,7 +3339,7 @@ sub ResolveRedirectionForCurl { ...@@ -3274,7 +3339,7 @@ sub ResolveRedirectionForCurl {
# Add a timeout flat to URL_FETCHER. Returns a new list. # Add a timeout flat to URL_FETCHER. Returns a new list.
sub AddFetchTimeout { sub AddFetchTimeout {
my $timeout = shift; my $timeout = shift;
my @fetcher = shift; my @fetcher = @_;
if (defined($timeout)) { if (defined($timeout)) {
if (join(" ", @fetcher) =~ m/\bcurl -s/) { if (join(" ", @fetcher) =~ m/\bcurl -s/) {
push(@fetcher, "--max-time", sprintf("%d", $timeout)); push(@fetcher, "--max-time", sprintf("%d", $timeout));
...@@ -3320,6 +3385,27 @@ sub ReadSymbols { ...@@ -3320,6 +3385,27 @@ sub ReadSymbols {
return $map; return $map;
} }
sub URLEncode {
my $str = shift;
$str =~ s/([^A-Za-z0-9\-_.!~*'()])/ sprintf "%%%02x", ord $1 /eg;
return $str;
}
sub AppendSymbolFilterParams {
my $url = shift;
my @params = ();
if ($main::opt_retain ne '') {
push(@params, sprintf("retain=%s", URLEncode($main::opt_retain)));
}
if ($main::opt_exclude ne '') {
push(@params, sprintf("exclude=%s", URLEncode($main::opt_exclude)));
}
if (scalar @params > 0) {
$url = sprintf("%s?%s", $url, join("&", @params));
}
return $url;
}
# Fetches and processes symbols to prepare them for use in the profile output # Fetches and processes symbols to prepare them for use in the profile output
# code. If the optional 'symbol_map' arg is not given, fetches symbols from # code. If the optional 'symbol_map' arg is not given, fetches symbols from
# $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols # $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
...@@ -3344,9 +3430,11 @@ sub FetchSymbols { ...@@ -3344,9 +3430,11 @@ sub FetchSymbols {
my $command_line; my $command_line;
if (join(" ", @URL_FETCHER) =~ m/\bcurl -s/) { if (join(" ", @URL_FETCHER) =~ m/\bcurl -s/) {
$url = ResolveRedirectionForCurl($url); $url = ResolveRedirectionForCurl($url);
$url = AppendSymbolFilterParams($url);
$command_line = ShellEscape(@URL_FETCHER, "-d", "\@$main::tmpfile_sym", $command_line = ShellEscape(@URL_FETCHER, "-d", "\@$main::tmpfile_sym",
$url); $url);
} else { } else {
$url = AppendSymbolFilterParams($url);
$command_line = (ShellEscape(@URL_FETCHER, "--post", $url) $command_line = (ShellEscape(@URL_FETCHER, "--post", $url)
. " < " . ShellEscape($main::tmpfile_sym)); . " < " . ShellEscape($main::tmpfile_sym));
} }
...@@ -3427,12 +3515,22 @@ sub FetchDynamicProfile { ...@@ -3427,12 +3515,22 @@ sub FetchDynamicProfile {
} }
$url .= sprintf("seconds=%d", $main::opt_seconds); $url .= sprintf("seconds=%d", $main::opt_seconds);
$fetch_timeout = $main::opt_seconds * 1.01 + 60; $fetch_timeout = $main::opt_seconds * 1.01 + 60;
# Set $profile_type for consumption by PrintSymbolizedProfile.
$main::profile_type = 'cpu';
} else { } else {
# For non-CPU profiles, we add a type-extension to # For non-CPU profiles, we add a type-extension to
# the target profile file name. # the target profile file name.
my $suffix = $path; my $suffix = $path;
$suffix =~ s,/,.,g; $suffix =~ s,/,.,g;
$profile_file .= $suffix; $profile_file .= $suffix;
# Set $profile_type for consumption by PrintSymbolizedProfile.
if ($path =~ m/$HEAP_PAGE/) {
$main::profile_type = 'heap';
} elsif ($path =~ m/$GROWTH_PAGE/) {
$main::profile_type = 'growth';
} elsif ($path =~ m/$CONTENTION_PAGE/) {
$main::profile_type = 'contention';
}
} }
my $profile_dir = $ENV{"JEPROF_TMPDIR"} || ($ENV{HOME} . "/jeprof"); my $profile_dir = $ENV{"JEPROF_TMPDIR"} || ($ENV{HOME} . "/jeprof");
...@@ -3730,6 +3828,8 @@ sub ReadProfile { ...@@ -3730,6 +3828,8 @@ sub ReadProfile {
my $symbol_marker = $&; my $symbol_marker = $&;
$PROFILE_PAGE =~ m,[^/]+$,; # matches everything after the last slash $PROFILE_PAGE =~ m,[^/]+$,; # matches everything after the last slash
my $profile_marker = $&; my $profile_marker = $&;
$HEAP_PAGE =~ m,[^/]+$,; # matches everything after the last slash
my $heap_marker = $&;
# Look at first line to see if it is a heap or a CPU profile. # Look at first line to see if it is a heap or a CPU profile.
# CPU profile may start with no header at all, and just binary data # CPU profile may start with no header at all, and just binary data
...@@ -3756,7 +3856,13 @@ sub ReadProfile { ...@@ -3756,7 +3856,13 @@ sub ReadProfile {
$header = ReadProfileHeader(*PROFILE) || ""; $header = ReadProfileHeader(*PROFILE) || "";
} }
if ($header =~ m/^--- *($heap_marker|$growth_marker)/o) {
# Skip "--- ..." line for profile types that have their own headers.
$header = ReadProfileHeader(*PROFILE) || "";
}
$main::profile_type = ''; $main::profile_type = '';
if ($header =~ m/^heap profile:.*$growth_marker/o) { if ($header =~ m/^heap profile:.*$growth_marker/o) {
$main::profile_type = 'growth'; $main::profile_type = 'growth';
$result = ReadHeapProfile($prog, *PROFILE, $header); $result = ReadHeapProfile($prog, *PROFILE, $header);
...@@ -3808,9 +3914,9 @@ sub ReadProfile { ...@@ -3808,9 +3914,9 @@ sub ReadProfile {
# independent implementation. # independent implementation.
sub FixCallerAddresses { sub FixCallerAddresses {
my $stack = shift; my $stack = shift;
if ($main::use_symbolized_profile) { # --raw/http: Always subtract one from pc's, because PrintSymbolizedProfile()
return $stack; # dumps unadjusted profiles.
} else { {
$stack =~ /(\s)/; $stack =~ /(\s)/;
my $delimiter = $1; my $delimiter = $1;
my @addrs = split(' ', $stack); my @addrs = split(' ', $stack);
...@@ -3878,12 +3984,7 @@ sub ReadCPUProfile { ...@@ -3878,12 +3984,7 @@ sub ReadCPUProfile {
for (my $j = 0; $j < $d; $j++) { for (my $j = 0; $j < $d; $j++) {
my $pc = $slots->get($i+$j); my $pc = $slots->get($i+$j);
# Subtract one from caller pc so we map back to call instr. # Subtract one from caller pc so we map back to call instr.
# However, don't do this if we're reading a symbolized profile
# file, in which case the subtract-one was done when the file
# was written.
if ($j > 0 && !$main::use_symbolized_profile) {
$pc--; $pc--;
}
$pc = sprintf("%0*x", $address_length, $pc); $pc = sprintf("%0*x", $address_length, $pc);
$pcs->{$pc} = 1; $pcs->{$pc} = 1;
push @k, $pc; push @k, $pc;
......
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2014 Free Software Foundation, Inc. # Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2014-03-23' timestamp='2016-10-02'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -24,12 +24,12 @@ timestamp='2014-03-23' ...@@ -24,12 +24,12 @@ timestamp='2014-03-23'
# program. This Exception is an additional permission under section 7 # program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3"). # of the GNU General Public License, version 3 ("GPLv3").
# #
# Originally written by Per Bothner. # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
# #
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
# #
# Please send patches with a ChangeLog entry to config-patches@gnu.org. # Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
...@@ -50,7 +50,7 @@ version="\ ...@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright 1992-2014 Free Software Foundation, Inc. Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor # Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown". # portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch" sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)` /sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;; armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;; sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
# to ELF recently, or will in the future. # to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
...@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd os=netbsd
;; ;;
esac esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release # The OS release
# Debian GNU/NetBSD machines have a different userland, and # Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need # thus, need a distinct triplet. However, they do not need
...@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu' release='-gnu'
;; ;;
*) *)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;; ;;
esac esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}" echo "${machine}-${os}${release}${abi}"
exit ;; exit ;;
*:Bitrig:*:*) *:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
...@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;; exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*) *:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;; exit ;;
...@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*) *:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;; exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
case $UNAME_RELEASE in case $UNAME_RELEASE in
*4.0) *4.0)
...@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in case "$ALPHA_CPU_TYPE" in
"EV4 (21064)") "EV4 (21064)")
UNAME_MACHINE="alpha" ;; UNAME_MACHINE=alpha ;;
"EV4.5 (21064)") "EV4.5 (21064)")
UNAME_MACHINE="alpha" ;; UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)") "LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;; UNAME_MACHINE=alpha ;;
"EV5 (21164)") "EV5 (21164)")
UNAME_MACHINE="alphaev5" ;; UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)") "EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;; UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)") "EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;; UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)") "EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;; UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)") "EV6 (21264)")
UNAME_MACHINE="alphaev6" ;; UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)") "EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;; UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)") "EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;; UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)") "EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;; UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)") "EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;; UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)") "EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;; UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)") "EV7 (21364)")
UNAME_MACHINE="alphaev7" ;; UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)") "EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;; UNAME_MACHINE=alphaev79 ;;
esac esac
# A Pn.n version is a patched version. # A Pn.n version is a patched version.
# A Vn.n version is a released version. # A Vn.n version is a released version.
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code. # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$? exitcode=$?
trap '' 0 trap '' 0
...@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;; exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build eval $set_cc_for_build
SUN_ARCH="i386" SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects. # If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers. # This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null grep IS_64BIT_ARCH >/dev/null
then then
SUN_ARCH="x86_64" SUN_ARCH=x86_64
fi fi
fi fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
...@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;; exit ;;
sun*:*:4.2BSD:*) sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in case "`/bin/arch`" in
sun3) sun3)
echo m68k-sun-sunos${UNAME_RELEASE} echo m68k-sun-sunos${UNAME_RELEASE}
...@@ -579,8 +603,9 @@ EOF ...@@ -579,8 +603,9 @@ EOF
else else
IBM_ARCH=powerpc IBM_ARCH=powerpc
fi fi
if [ -x /usr/bin/oslevel ] ; then if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/oslevel` IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi fi
...@@ -617,13 +642,13 @@ EOF ...@@ -617,13 +642,13 @@ EOF
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0 532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;; 32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH="hppa2.0w" ;; 64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;; esac ;;
esac esac
fi fi
...@@ -662,11 +687,11 @@ EOF ...@@ -662,11 +687,11 @@ EOF
exit (0); exit (0);
} }
EOF EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;; fi ;;
esac esac
if [ ${HP_ARCH} = "hppa2.0w" ] if [ ${HP_ARCH} = hppa2.0w ]
then then
eval $set_cc_for_build eval $set_cc_for_build
...@@ -679,12 +704,12 @@ EOF ...@@ -679,12 +704,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23 # => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__ grep -q __LP64__
then then
HP_ARCH="hppa2.0w" HP_ARCH=hppa2.0w
else else
HP_ARCH="hppa64" HP_ARCH=hppa64
fi fi
fi fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV} echo ${HP_ARCH}-hp-hpux${HPUX_REV}
...@@ -789,14 +814,14 @@ EOF ...@@ -789,14 +814,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;; exit ;;
5000:UNIX_System_V:4.*:*) 5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;; exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
...@@ -878,7 +903,7 @@ EOF ...@@ -878,7 +903,7 @@ EOF
exit ;; exit ;;
*:GNU/*:*:*) *:GNU/*:*:*)
# other systems with GNU libc and userland # other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;; exit ;;
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
...@@ -901,7 +926,7 @@ EOF ...@@ -901,7 +926,7 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;; EV68*) UNAME_MACHINE=alphaev68 ;;
esac esac
objdump --private-headers /bin/sh | grep -q ld.so.1 objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
arc:Linux:*:* | arceb:Linux:*:*) arc:Linux:*:* | arceb:Linux:*:*)
...@@ -932,6 +957,9 @@ EOF ...@@ -932,6 +957,9 @@ EOF
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC} echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;; exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*) frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
...@@ -944,6 +972,9 @@ EOF ...@@ -944,6 +972,9 @@ EOF
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*) m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
...@@ -969,6 +1000,9 @@ EOF ...@@ -969,6 +1000,9 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;; ;;
mips64el:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
openrisc*:Linux:*:*) openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC} echo or1k-unknown-linux-${LIBC}
exit ;; exit ;;
...@@ -1001,6 +1035,9 @@ EOF ...@@ -1001,6 +1035,9 @@ EOF
ppcle:Linux:*:*) ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC} echo powerpcle-unknown-linux-${LIBC}
exit ;; exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC} echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;; exit ;;
...@@ -1020,7 +1057,7 @@ EOF ...@@ -1020,7 +1057,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-${LIBC} echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;; exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;; exit ;;
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
...@@ -1099,7 +1136,7 @@ EOF ...@@ -1099,7 +1136,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about # uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586. # the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub # Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that # prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build. # this is a cross-build.
echo i586-pc-msdosdjgpp echo i586-pc-msdosdjgpp
exit ;; exit ;;
...@@ -1248,6 +1285,9 @@ EOF ...@@ -1248,6 +1285,9 @@ EOF
SX-8R:SUPER-UX:*:*) SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE} echo sx8r-nec-superux${UNAME_RELEASE}
exit ;; exit ;;
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;; exit ;;
...@@ -1261,9 +1301,9 @@ EOF ...@@ -1261,9 +1301,9 @@ EOF
UNAME_PROCESSOR=powerpc UNAME_PROCESSOR=powerpc
fi fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null grep IS_64BIT_ARCH >/dev/null
then then
case $UNAME_PROCESSOR in case $UNAME_PROCESSOR in
...@@ -1285,7 +1325,7 @@ EOF ...@@ -1285,7 +1325,7 @@ EOF
exit ;; exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*) *:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p` UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386 UNAME_PROCESSOR=i386
UNAME_MACHINE=pc UNAME_MACHINE=pc
fi fi
...@@ -1316,7 +1356,7 @@ EOF ...@@ -1316,7 +1356,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386 # "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86 # is converted to i386 for consistency with other x86
# operating systems. # operating systems.
if test "$cputype" = "386"; then if test "$cputype" = 386; then
UNAME_MACHINE=i386 UNAME_MACHINE=i386
else else
UNAME_MACHINE="$cputype" UNAME_MACHINE="$cputype"
...@@ -1358,7 +1398,7 @@ EOF ...@@ -1358,7 +1398,7 @@ EOF
echo i386-pc-xenix echo i386-pc-xenix
exit ;; exit ;;
i*86:skyos:*:*) i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;; exit ;;
i*86:rdos:*:*) i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos echo ${UNAME_MACHINE}-pc-rdos
...@@ -1369,23 +1409,25 @@ EOF ...@@ -1369,23 +1409,25 @@ EOF
x86_64:VMkernel:*:*) x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx echo ${UNAME_MACHINE}-unknown-esx
exit ;; exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
esac esac
cat >&2 <<EOF cat >&2 <<EOF
$0: unable to guess system type $0: unable to guess system type
This script, last modified $timestamp, has failed to recognize This script (version $timestamp), has failed to recognize the
the operating system you are using. It is advised that you operating system you are using. If your script is old, overwrite
download the most up to date version of the config scripts from config.guess and config.sub with the latest versions from:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If the version you run ($0) is already up to date, please If $0 has already been updated, send the following data and any
send the following data and any information you think might be information you think might be pertinent to config-patches@gnu.org to
pertinent to <config-patches@gnu.org> in order to provide the needed provide the necessary information to handle your system.
information to handle your system.
config.guess timestamp = $timestamp config.guess timestamp = $timestamp
......
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2014 Free Software Foundation, Inc. # Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2014-05-01' timestamp='2016-11-04'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -25,7 +25,7 @@ timestamp='2014-05-01' ...@@ -25,7 +25,7 @@ timestamp='2014-05-01'
# of the GNU General Public License, version 3 ("GPLv3"). # of the GNU General Public License, version 3 ("GPLv3").
# Please send patches with a ChangeLog entry to config-patches@gnu.org. # Please send patches to <config-patches@gnu.org>.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
...@@ -33,7 +33,7 @@ timestamp='2014-05-01' ...@@ -33,7 +33,7 @@ timestamp='2014-05-01'
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
...@@ -53,8 +53,7 @@ timestamp='2014-05-01' ...@@ -53,8 +53,7 @@ timestamp='2014-05-01'
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
usage="\ usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
$0 [OPTION] ALIAS
Canonicalize a configuration name. Canonicalize a configuration name.
...@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>." ...@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright 1992-2014 Free Software Foundation, Inc. Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` ...@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
...@@ -255,12 +254,13 @@ case $basic_machine in ...@@ -255,12 +254,13 @@ case $basic_machine in
| arc | arceb \ | arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \ | avr | avr32 \
| ba \
| be32 | be64 \ | be32 | be64 \
| bfin \ | bfin \
| c4x | c8051 | clipper \ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| epiphany \ | e2k | epiphany \
| fido | fr30 | frv \ | fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \ | hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
...@@ -301,10 +301,12 @@ case $basic_machine in ...@@ -301,10 +301,12 @@ case $basic_machine in
| open8 | or1k | or1knd | or32 \ | open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \ | pyramid \
| riscv32 | riscv64 \
| rl78 | rx \ | rl78 | rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
...@@ -312,6 +314,7 @@ case $basic_machine in ...@@ -312,6 +314,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \ | ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \ | we32k \
| x86 | xc16x | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
...@@ -326,6 +329,9 @@ case $basic_machine in ...@@ -326,6 +329,9 @@ case $basic_machine in
c6x) c6x)
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
;; ;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
...@@ -371,12 +377,13 @@ case $basic_machine in ...@@ -371,12 +377,13 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \ | be32-* | be64-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
...@@ -422,13 +429,15 @@ case $basic_machine in ...@@ -422,13 +429,15 @@ case $basic_machine in
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pru-* \
| pyramid-* \ | pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \ | tile*-* \
...@@ -436,6 +445,7 @@ case $basic_machine in ...@@ -436,6 +445,7 @@ case $basic_machine in
| ubicom32-* \ | ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \ | vax-* \
| visium-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
...@@ -512,6 +522,9 @@ case $basic_machine in ...@@ -512,6 +522,9 @@ case $basic_machine in
basic_machine=i386-pc basic_machine=i386-pc
os=-aros os=-aros
;; ;;
asmjs)
basic_machine=asmjs-unknown
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
...@@ -632,6 +645,14 @@ case $basic_machine in ...@@ -632,6 +645,14 @@ case $basic_machine in
basic_machine=m68k-bull basic_machine=m68k-bull
os=-sysv3 os=-sysv3
;; ;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k) ebmon29k)
basic_machine=a29k-amd basic_machine=a29k-amd
os=-ebmon os=-ebmon
...@@ -773,6 +794,9 @@ case $basic_machine in ...@@ -773,6 +794,9 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu) m68knommu)
basic_machine=m68k-unknown basic_machine=m68k-unknown
os=-linux os=-linux
...@@ -828,6 +852,10 @@ case $basic_machine in ...@@ -828,6 +852,10 @@ case $basic_machine in
basic_machine=powerpc-unknown basic_machine=powerpc-unknown
os=-morphos os=-morphos
;; ;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos) msdos)
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
...@@ -1004,7 +1032,7 @@ case $basic_machine in ...@@ -1004,7 +1032,7 @@ case $basic_machine in
ppc-* | ppcbe-*) ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
;; ;;
ppcle-* | powerpclittle-*) ppcle-* | powerpclittle-*)
...@@ -1014,7 +1042,7 @@ case $basic_machine in ...@@ -1014,7 +1042,7 @@ case $basic_machine in
;; ;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little) ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown basic_machine=powerpc64le-unknown
;; ;;
ppc64le-* | powerpc64little-*) ppc64le-* | powerpc64little-*)
...@@ -1360,27 +1388,28 @@ case $os in ...@@ -1360,27 +1388,28 @@ case $os in
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \ | -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
...@@ -1404,9 +1433,6 @@ case $os in ...@@ -1404,9 +1433,6 @@ case $os in
-mac*) -mac*)
os=`echo $os | sed -e 's|mac|macos|'` os=`echo $os | sed -e 's|mac|macos|'`
;; ;;
# Apple iOS
-ios*)
;;
-linux-dietlibc) -linux-dietlibc)
os=-linux-dietlibc os=-linux-dietlibc
;; ;;
...@@ -1515,6 +1541,8 @@ case $os in ...@@ -1515,6 +1541,8 @@ case $os in
;; ;;
-nacl*) -nacl*)
;; ;;
-ios)
;;
-none) -none)
;; ;;
*) *)
......
...@@ -628,7 +628,6 @@ cfghdrs_in ...@@ -628,7 +628,6 @@ cfghdrs_in
enable_zone_allocator enable_zone_allocator
enable_tls enable_tls
enable_lazy_lock enable_lazy_lock
TESTLIBS
jemalloc_version_gid jemalloc_version_gid
jemalloc_version_nrev jemalloc_version_nrev
jemalloc_version_bugfix jemalloc_version_bugfix
...@@ -658,16 +657,19 @@ INSTALL_SCRIPT ...@@ -658,16 +657,19 @@ INSTALL_SCRIPT
INSTALL_PROGRAM INSTALL_PROGRAM
enable_autogen enable_autogen
RPATH_EXTRA RPATH_EXTRA
LM
CC_MM CC_MM
AROUT AROUT
ARFLAGS ARFLAGS
MKLIB MKLIB
TEST_LD_MODE
LDTARGET LDTARGET
CTARGET CTARGET
PIC_CFLAGS PIC_CFLAGS
SOREV SOREV
EXTRA_LDFLAGS EXTRA_LDFLAGS
DSO_LDFLAGS DSO_LDFLAGS
link_whole_archive
libprefix libprefix
exe exe
a a
...@@ -689,6 +691,7 @@ build ...@@ -689,6 +691,7 @@ build
EGREP EGREP
GREP GREP
CPP CPP
EXTRA_CFLAGS
OBJEXT OBJEXT
EXEEXT EXEEXT
ac_ct_CC ac_ct_CC
...@@ -729,6 +732,7 @@ infodir ...@@ -729,6 +732,7 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
...@@ -760,6 +764,7 @@ with_jemalloc_prefix ...@@ -760,6 +764,7 @@ with_jemalloc_prefix
with_export with_export
with_private_namespace with_private_namespace
with_install_suffix with_install_suffix
with_malloc_conf
enable_cc_silence enable_cc_silence
enable_debug enable_debug
enable_ivsalloc enable_ivsalloc
...@@ -781,6 +786,8 @@ with_lg_quantum ...@@ -781,6 +786,8 @@ with_lg_quantum
with_lg_page with_lg_page
with_lg_page_sizes with_lg_page_sizes
with_lg_size_class_group with_lg_size_class_group
with_version
enable_syscall
enable_lazy_lock enable_lazy_lock
enable_tls enable_tls
enable_zone_allocator enable_zone_allocator
...@@ -832,6 +839,7 @@ datadir='${datarootdir}' ...@@ -832,6 +839,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}' docdir='${datarootdir}/doc/${PACKAGE}'
...@@ -1084,6 +1092,15 @@ do ...@@ -1084,6 +1092,15 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
...@@ -1221,7 +1238,7 @@ fi ...@@ -1221,7 +1238,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir libdir localedir mandir runstatedir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
...@@ -1374,6 +1391,7 @@ Fine tuning of the installation directories: ...@@ -1374,6 +1391,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
...@@ -1425,6 +1443,7 @@ Optional Features: ...@@ -1425,6 +1443,7 @@ Optional Features:
--disable-cache-oblivious --disable-cache-oblivious
Disable support for cache-oblivious allocation Disable support for cache-oblivious allocation
alignment alignment
--disable-syscall Disable use of syscall(2)
--enable-lazy-lock Enable lazy locking (only lock when multi-threaded) --enable-lazy-lock Enable lazy locking (only lock when multi-threaded)
--disable-tls Disable thread-local storage (__thread keyword) --disable-tls Disable thread-local storage (__thread keyword)
--disable-zone-allocator --disable-zone-allocator
...@@ -1443,6 +1462,8 @@ Optional Packages: ...@@ -1443,6 +1462,8 @@ Optional Packages:
Prefix to prepend to all library-private APIs Prefix to prepend to all library-private APIs
--with-install-suffix=<suffix> --with-install-suffix=<suffix>
Suffix to append to all installed files Suffix to append to all installed files
--with-malloc-conf=<malloc_conf>
config.malloc_conf options string
--with-static-libunwind=<libunwind.a> --with-static-libunwind=<libunwind.a>
Path to static libunwind library; use rather than Path to static libunwind library; use rather than
dynamically linking dynamically linking
...@@ -1456,6 +1477,8 @@ Optional Packages: ...@@ -1456,6 +1477,8 @@ Optional Packages:
Base 2 logs of system page sizes to support Base 2 logs of system page sizes to support
--with-lg-size-class-group=<lg-size-class-group> --with-lg-size-class-group=<lg-size-class-group>
Base 2 log of size classes per doubling Base 2 log of size classes per doubling
--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>
Version string
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
...@@ -2484,6 +2507,36 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ...@@ -2484,6 +2507,36 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in build-aux "$srcdir"/build-aux; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
...@@ -3390,6 +3443,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ...@@ -3390,6 +3443,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "x$GCC" != "xyes" ; then if test "x$GCC" != "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is MSVC" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is MSVC" >&5
...@@ -3423,10 +3477,125 @@ fi ...@@ -3423,10 +3477,125 @@ fi
$as_echo "$je_cv_msvc" >&6; } $as_echo "$je_cv_msvc" >&6; }
fi fi
je_cv_cray_prgenv_wrapper=""
if test "x${PE_ENV}" != "x" ; then
case "${CC}" in
CC|cc)
je_cv_cray_prgenv_wrapper="yes"
;;
*)
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is cray" >&5
$as_echo_n "checking whether compiler is cray... " >&6; }
if ${je_cv_cray+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef _CRAYC
int fail-1;
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cray=yes
else
je_cv_cray=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_cray" >&5
$as_echo "$je_cv_cray" >&6; }
if test "x${je_cv_cray}" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cray compiler version is 8.4" >&5
$as_echo_n "checking whether cray compiler version is 8.4... " >&6; }
if ${je_cv_cray_84+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
int fail-1;
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cray_84=yes
else
je_cv_cray_84=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_cray_84" >&5
$as_echo "$je_cv_cray_84" >&6; }
fi
if test "x$CFLAGS" = "x" ; then if test "x$CFLAGS" = "x" ; then
no_CFLAGS="yes" no_CFLAGS="yes"
if test "x$GCC" = "xyes" ; then if test "x$GCC" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -std=gnu11" >&5
$as_echo_n "checking whether compiler supports -std=gnu11... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-std=gnu11"
else
CFLAGS="${CFLAGS} -std=gnu11"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-std=gnu11
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "x$je_cv_cflags_appended" = "x-std=gnu11" ; then
cat >>confdefs.h <<_ACEOF
#define JEMALLOC_HAS_RESTRICT 1
_ACEOF
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -std=gnu99" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -std=gnu99" >&5
$as_echo_n "checking whether compiler supports -std=gnu99... " >&6; } $as_echo_n "checking whether compiler supports -std=gnu99... " >&6; }
TCFLAGS="${CFLAGS}" TCFLAGS="${CFLAGS}"
...@@ -3468,6 +3637,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ...@@ -3468,6 +3637,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
_ACEOF _ACEOF
fi fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wall" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wall" >&5
$as_echo_n "checking whether compiler supports -Wall... " >&6; } $as_echo_n "checking whether compiler supports -Wall... " >&6; }
...@@ -3541,6 +3711,78 @@ fi ...@@ -3541,6 +3711,78 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wshorten-64-to-32" >&5
$as_echo_n "checking whether compiler supports -Wshorten-64-to-32... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-Wshorten-64-to-32"
else
CFLAGS="${CFLAGS} -Wshorten-64-to-32"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-Wshorten-64-to-32
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wsign-compare" >&5
$as_echo_n "checking whether compiler supports -Wsign-compare... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-Wsign-compare"
else
CFLAGS="${CFLAGS} -Wsign-compare"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-Wsign-compare
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -pipe" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -pipe" >&5
$as_echo_n "checking whether compiler supports -pipe... " >&6; } $as_echo_n "checking whether compiler supports -pipe... " >&6; }
TCFLAGS="${CFLAGS}" TCFLAGS="${CFLAGS}"
...@@ -3760,16 +4002,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ...@@ -3760,16 +4002,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat" CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
fi fi
fi if test "x$je_cv_cray" = "xyes" ; then
if test "x$EXTRA_CFLAGS" != "x" ; then if test "x$je_cv_cray_84" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports $EXTRA_CFLAGS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hipa2" >&5
$as_echo_n "checking whether compiler supports $EXTRA_CFLAGS... " >&6; } $as_echo_n "checking whether compiler supports -hipa2... " >&6; }
TCFLAGS="${CFLAGS}" TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then if test "x${CFLAGS}" = "x" ; then
CFLAGS="$EXTRA_CFLAGS" CFLAGS="-hipa2"
else else
CFLAGS="${CFLAGS} $EXTRA_CFLAGS" CFLAGS="${CFLAGS} -hipa2"
fi fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
...@@ -3786,7 +4028,7 @@ main () ...@@ -3786,7 +4028,7 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=$EXTRA_CFLAGS je_cv_cflags_appended=-hipa2
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
else else
...@@ -3798,82 +4040,195 @@ $as_echo "no" >&6; } ...@@ -3798,82 +4040,195 @@ $as_echo "no" >&6; }
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hnognu" >&5
$as_echo_n "checking whether compiler supports -hnognu... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-hnognu"
else else
# Broken: fails on valid input. CFLAGS="${CFLAGS} -hnognu"
continue
fi fi
rm -f conftest.err conftest.i conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done int
ac_cv_prog_CPP=$CPP main ()
{
fi return 0;
CPP=$ac_cv_prog_CPP
else ;
ac_cv_prog_CPP=$CPP return 0;
fi }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-hnognu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x$enable_cc_silence" != "xno" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hnomessage=128" >&5
$as_echo_n "checking whether compiler supports -hnomessage=128... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-hnomessage=128"
else
CFLAGS="${CFLAGS} -hnomessage=128"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-hnomessage=128
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hnomessage=1357" >&5
$as_echo_n "checking whether compiler supports -hnomessage=1357... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-hnomessage=1357"
else
CFLAGS="${CFLAGS} -hnomessage=1357"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-hnomessage=1357
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$CPP" >&6; } $as_echo "$CPP" >&6; }
ac_preproc_ok=false ac_preproc_ok=false
...@@ -4431,7 +4786,12 @@ if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then ...@@ -4431,7 +4786,12 @@ if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99" CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
fi fi
# The cast to long int works around a bug in the HP C Compiler if test "x${je_cv_msvc}" = "xyes" ; then
LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit" >&5
$as_echo "Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit" >&6; }
else
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364. # This bug is HP SR number 8606223364.
...@@ -4464,12 +4824,13 @@ cat >>confdefs.h <<_ACEOF ...@@ -4464,12 +4824,13 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
LG_SIZEOF_PTR=3 LG_SIZEOF_PTR=3
elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
LG_SIZEOF_PTR=2 LG_SIZEOF_PTR=2
else else
as_fn_error $? "Unsupported pointer size: ${ac_cv_sizeof_void_p}" "$LINENO" 5 as_fn_error $? "Unsupported pointer size: ${ac_cv_sizeof_void_p}" "$LINENO" 5
fi
fi fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define LG_SIZEOF_PTR $LG_SIZEOF_PTR #define LG_SIZEOF_PTR $LG_SIZEOF_PTR
...@@ -4566,6 +4927,51 @@ cat >>confdefs.h <<_ACEOF ...@@ -4566,6 +4927,51 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
$as_echo_n "checking size of long long... " >&6; }
if ${ac_cv_sizeof_long_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
else
if test "$ac_cv_type_long_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long long)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long_long=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
$as_echo "$ac_cv_sizeof_long_long" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
_ACEOF
if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
LG_SIZEOF_LONG_LONG=3
elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
LG_SIZEOF_LONG_LONG=2
else
as_fn_error $? "Unsupported long long size: ${ac_cv_sizeof_long_long}" "$LINENO" 5
fi
cat >>confdefs.h <<_ACEOF
#define LG_SIZEOF_LONG_LONG $LG_SIZEOF_LONG_LONG
_ACEOF
# The cast to long int works around a bug in the HP C Compiler # The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
...@@ -4613,35 +5019,6 @@ cat >>confdefs.h <<_ACEOF ...@@ -4613,35 +5019,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub. # Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
...@@ -4716,6 +5093,44 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ...@@ -4716,6 +5093,44 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
CPU_SPINWAIT="" CPU_SPINWAIT=""
case "${host_cpu}" in case "${host_cpu}" in
i686|x86_64) i686|x86_64)
if test "x${je_cv_msvc}" = "xyes" ; then
if ${je_cv_pause_msvc+:} false; then :
$as_echo_n "(cached) " >&6
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pause instruction MSVC is compilable" >&5
$as_echo_n "checking whether pause instruction MSVC is compilable... " >&6; }
if ${je_cv_pause_msvc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
_mm_pause(); return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_pause_msvc=yes
else
je_cv_pause_msvc=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_pause_msvc" >&5
$as_echo "$je_cv_pause_msvc" >&6; }
fi
if test "x${je_cv_pause_msvc}" = "xyes" ; then
CPU_SPINWAIT='_mm_pause()'
fi
else
if ${je_cv_pause+:} false; then : if ${je_cv_pause+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
...@@ -4752,6 +5167,7 @@ fi ...@@ -4752,6 +5167,7 @@ fi
if test "x${je_cv_pause}" = "xyes" ; then if test "x${je_cv_pause}" = "xyes" ; then
CPU_SPINWAIT='__asm__ volatile("pause")' CPU_SPINWAIT='__asm__ volatile("pause")'
fi fi
fi
;; ;;
powerpc) powerpc)
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -4774,17 +5190,27 @@ o="$ac_objext" ...@@ -4774,17 +5190,27 @@ o="$ac_objext"
a="a" a="a"
exe="$ac_exeext" exe="$ac_exeext"
libprefix="lib" libprefix="lib"
link_whole_archive="0"
DSO_LDFLAGS='-shared -Wl,-soname,$(@F)' DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
RPATH='-Wl,-rpath,$(1)' RPATH='-Wl,-rpath,$(1)'
SOREV="${so}.${rev}" SOREV="${so}.${rev}"
PIC_CFLAGS='-fPIC -DPIC' PIC_CFLAGS='-fPIC -DPIC'
CTARGET='-o $@' CTARGET='-o $@'
LDTARGET='-o $@' LDTARGET='-o $@'
TEST_LD_MODE=
EXTRA_LDFLAGS= EXTRA_LDFLAGS=
ARFLAGS='crus' ARFLAGS='crus'
AROUT=' $@' AROUT=' $@'
CC_MM=1 CC_MM=1
if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
TEST_LD_MODE='-dynamic'
fi
if test "x${je_cv_cray}" = "xyes" ; then
CC_MM=
fi
...@@ -4881,14 +5307,12 @@ else ...@@ -4881,14 +5307,12 @@ else
fi fi
CFLAGS="$CFLAGS"
default_munmap="1" default_munmap="1"
maps_coalesce="1" maps_coalesce="1"
case "${host}" in case "${host}" in
*-*-darwin* | *-*-ios*) *-*-darwin* | *-*-ios*)
CFLAGS="$CFLAGS"
abi="macho" abi="macho"
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
RPATH="" RPATH=""
LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
so="dylib" so="dylib"
...@@ -4899,38 +5323,41 @@ case "${host}" in ...@@ -4899,38 +5323,41 @@ case "${host}" in
sbrk_deprecated="1" sbrk_deprecated="1"
;; ;;
*-*-freebsd*) *-*-freebsd*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h $as_echo "#define JEMALLOC_SYSCTL_VM_OVERCOMMIT " >>confdefs.h
force_lazy_lock="1" force_lazy_lock="1"
;; ;;
*-*-dragonfly*) *-*-dragonfly*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
;; ;;
*-*-openbsd*) *-*-openbsd*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
force_tls="0" force_tls="0"
;; ;;
*-*-bitrig*) *-*-bitrig*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h ;;
*-*-linux-android)
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
abi="elf"
$as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h
$as_echo "#define JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY " >>confdefs.h
$as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h
$as_echo "#define JEMALLOC_C11ATOMICS 1" >>confdefs.h
force_tls="0"
default_munmap="0"
;; ;;
*-*-linux*) *-*-linux* | *-*-kfreebsd*)
CFLAGS="$CFLAGS"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
abi="elf" abi="elf"
$as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h $as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h
$as_echo "#define JEMALLOC_PURGE_MADVISE_DONTNEED " >>confdefs.h $as_echo "#define JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY " >>confdefs.h
$as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h $as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h
...@@ -4958,21 +5385,16 @@ main () ...@@ -4958,21 +5385,16 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
CFLAGS="$CFLAGS"; abi="elf" abi="elf"
else else
abi="aout" abi="aout"
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $abi" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $abi" >&5
$as_echo "$abi" >&6; } $as_echo "$abi" >&6; }
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
;; ;;
*-*-solaris2*) *-*-solaris2*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
RPATH='-Wl,-R,$(1)' RPATH='-Wl,-R,$(1)'
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
LIBS="$LIBS -lposix4 -lsocket -lnsl" LIBS="$LIBS -lposix4 -lsocket -lnsl"
...@@ -4988,7 +5410,6 @@ $as_echo "$abi" >&6; } ...@@ -4988,7 +5410,6 @@ $as_echo "$abi" >&6; }
*-*-mingw* | *-*-cygwin*) *-*-mingw* | *-*-cygwin*)
abi="pecoff" abi="pecoff"
force_tls="0" force_tls="0"
force_lazy_lock="1"
maps_coalesce="0" maps_coalesce="0"
RPATH="" RPATH=""
so="dll" so="dll"
...@@ -5005,6 +5426,7 @@ $as_echo "$abi" >&6; } ...@@ -5005,6 +5426,7 @@ $as_echo "$abi" >&6; }
else else
importlib="${so}" importlib="${so}"
DSO_LDFLAGS="-shared" DSO_LDFLAGS="-shared"
link_whole_archive="1"
fi fi
a="lib" a="lib"
libprefix="" libprefix=""
...@@ -5084,6 +5506,73 @@ _ACEOF ...@@ -5084,6 +5506,73 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log" >&5
$as_echo_n "checking for library containing log... " >&6; }
if ${ac_cv_search_log+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char log ();
int
main ()
{
return log ();
;
return 0;
}
_ACEOF
for ac_lib in '' m; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_log=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_log+:} false; then :
break
fi
done
if ${ac_cv_search_log+:} false; then :
else
ac_cv_search_log=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_log" >&5
$as_echo "$ac_cv_search_log" >&6; }
ac_res=$ac_cv_search_log
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "Missing math functions" "$LINENO" 5
fi
if test "x$ac_cv_search_log" != "xnone required" ; then
LM="$ac_cv_search_log"
else
LM=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__ syntax is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__ syntax is compilable" >&5
...@@ -5193,6 +5682,42 @@ fi ...@@ -5193,6 +5682,42 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-herror_on_warning"
else
CFLAGS="${CFLAGS} -herror_on_warning"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-herror_on_warning
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tls_model attribute is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tls_model attribute is compilable" >&5
$as_echo_n "checking whether tls_model attribute is compilable... " >&6; } $as_echo_n "checking whether tls_model attribute is compilable... " >&6; }
if ${je_cv_tls_model+:} false; then : if ${je_cv_tls_model+:} false; then :
...@@ -5268,6 +5793,42 @@ fi ...@@ -5268,6 +5793,42 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-herror_on_warning"
else
CFLAGS="${CFLAGS} -herror_on_warning"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-herror_on_warning
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether alloc_size attribute is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether alloc_size attribute is compilable" >&5
$as_echo_n "checking whether alloc_size attribute is compilable... " >&6; } $as_echo_n "checking whether alloc_size attribute is compilable... " >&6; }
if ${je_cv_alloc_size+:} false; then : if ${je_cv_alloc_size+:} false; then :
...@@ -5338,6 +5899,42 @@ fi ...@@ -5338,6 +5899,42 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-herror_on_warning"
else
CFLAGS="${CFLAGS} -herror_on_warning"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-herror_on_warning
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether format(gnu_printf, ...) attribute is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether format(gnu_printf, ...) attribute is compilable" >&5
$as_echo_n "checking whether format(gnu_printf, ...) attribute is compilable... " >&6; } $as_echo_n "checking whether format(gnu_printf, ...) attribute is compilable... " >&6; }
if ${je_cv_format_gnu_printf+:} false; then : if ${je_cv_format_gnu_printf+:} false; then :
...@@ -5408,6 +6005,42 @@ fi ...@@ -5408,6 +6005,42 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-herror_on_warning"
else
CFLAGS="${CFLAGS} -herror_on_warning"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-herror_on_warning
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether format(printf, ...) attribute is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether format(printf, ...) attribute is compilable" >&5
$as_echo_n "checking whether format(printf, ...) attribute is compilable... " >&6; } $as_echo_n "checking whether format(printf, ...) attribute is compilable... " >&6; }
if ${je_cv_format_printf+:} false; then : if ${je_cv_format_printf+:} false; then :
...@@ -5927,6 +6560,21 @@ fi ...@@ -5927,6 +6560,21 @@ fi
install_suffix="$INSTALL_SUFFIX" install_suffix="$INSTALL_SUFFIX"
# Check whether --with-malloc_conf was given.
if test "${with_malloc_conf+set}" = set; then :
withval=$with_malloc_conf; JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"
else
JEMALLOC_CONFIG_MALLOC_CONF=""
fi
config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
cat >>confdefs.h <<_ACEOF
#define JEMALLOC_CONFIG_MALLOC_CONF "$config_malloc_conf"
_ACEOF
je_="je_" je_="je_"
...@@ -6495,8 +7143,8 @@ $as_echo_n "checking configured backtracing method... " >&6; } ...@@ -6495,8 +7143,8 @@ $as_echo_n "checking configured backtracing method... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $backtrace_method" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $backtrace_method" >&5
$as_echo "$backtrace_method" >&6; } $as_echo "$backtrace_method" >&6; }
if test "x$enable_prof" = "x1" ; then if test "x$enable_prof" = "x1" ; then
if test "x$abi" != "xpecoff"; then if test "x$LM" != "x" ; then
LIBS="$LIBS -lm" LIBS="$LIBS $LM"
fi fi
$as_echo "#define JEMALLOC_PROF " >>confdefs.h $as_echo "#define JEMALLOC_PROF " >>confdefs.h
...@@ -6745,6 +7393,52 @@ fi ...@@ -6745,6 +7393,52 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program using __builtin_unreachable is compilable" >&5
$as_echo_n "checking whether a program using __builtin_unreachable is compilable... " >&6; }
if ${je_cv_gcc_builtin_unreachable+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
void foo (void) {
__builtin_unreachable();
}
int
main ()
{
{
foo();
}
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_gcc_builtin_unreachable=yes
else
je_cv_gcc_builtin_unreachable=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_gcc_builtin_unreachable" >&5
$as_echo "$je_cv_gcc_builtin_unreachable" >&6; }
if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
$as_echo "#define JEMALLOC_INTERNAL_UNREACHABLE __builtin_unreachable" >>confdefs.h
else
$as_echo "#define JEMALLOC_INTERNAL_UNREACHABLE abort" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program using __builtin_ffsl is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program using __builtin_ffsl is compilable" >&5
$as_echo_n "checking whether a program using __builtin_ffsl is compilable... " >&6; } $as_echo_n "checking whether a program using __builtin_ffsl is compilable... " >&6; }
if ${je_cv_gcc_builtin_ffsl+:} false; then : if ${je_cv_gcc_builtin_ffsl+:} false; then :
...@@ -6782,6 +7476,8 @@ fi ...@@ -6782,6 +7476,8 @@ fi
$as_echo "$je_cv_gcc_builtin_ffsl" >&6; } $as_echo "$je_cv_gcc_builtin_ffsl" >&6; }
if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
$as_echo "#define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll" >>confdefs.h
$as_echo "#define JEMALLOC_INTERNAL_FFSL __builtin_ffsl" >>confdefs.h $as_echo "#define JEMALLOC_INTERNAL_FFSL __builtin_ffsl" >>confdefs.h
$as_echo "#define JEMALLOC_INTERNAL_FFS __builtin_ffs" >>confdefs.h $as_echo "#define JEMALLOC_INTERNAL_FFS __builtin_ffs" >>confdefs.h
...@@ -6825,6 +7521,8 @@ fi ...@@ -6825,6 +7521,8 @@ fi
$as_echo "$je_cv_function_ffsl" >&6; } $as_echo "$je_cv_function_ffsl" >&6; }
if test "x${je_cv_function_ffsl}" = "xyes" ; then if test "x${je_cv_function_ffsl}" = "xyes" ; then
$as_echo "#define JEMALLOC_INTERNAL_FFSLL ffsll" >>confdefs.h
$as_echo "#define JEMALLOC_INTERNAL_FFSL ffsl" >>confdefs.h $as_echo "#define JEMALLOC_INTERNAL_FFSL ffsl" >>confdefs.h
$as_echo "#define JEMALLOC_INTERNAL_FFS ffs" >>confdefs.h $as_echo "#define JEMALLOC_INTERNAL_FFS ffs" >>confdefs.h
...@@ -6913,7 +7611,7 @@ main () ...@@ -6913,7 +7611,7 @@ main ()
if (f == NULL) { if (f == NULL) {
return 1; return 1;
} }
fprintf(f, "%d\n", result); fprintf(f, "%d", result);
fclose(f); fclose(f);
return 0; return 0;
...@@ -6964,7 +7662,6 @@ else ...@@ -6964,7 +7662,6 @@ else
LG_SIZE_CLASS_GROUP="2" LG_SIZE_CLASS_GROUP="2"
fi fi
if test ! -e "${objroot}VERSION" ; then if test ! -e "${objroot}VERSION" ; then
if test ! -e "${srcroot}VERSION" ; then if test ! -e "${srcroot}VERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Missing VERSION file, and unable to generate it; creating bogus VERSION" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Missing VERSION file, and unable to generate it; creating bogus VERSION" >&5
...@@ -7102,26 +7799,158 @@ fi ...@@ -7102,26 +7799,158 @@ fi
fi fi
fi
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
SAVED_LIBS="${LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthread_atfork(3) is compilable" >&5
LIBS= $as_echo_n "checking whether pthread_atfork(3) is compilable... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 if ${je_cv_pthread_atfork+:} false; then :
$as_echo_n "checking for library containing clock_gettime... " >&6; }
if ${ac_cv_search_clock_gettime+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error. #include <pthread.h>
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */ int
#ifdef __cplusplus main ()
extern "C" {
pthread_atfork((void *)0, (void *)0, (void *)0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_pthread_atfork=yes
else
je_cv_pthread_atfork=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_pthread_atfork" >&5
$as_echo "$je_cv_pthread_atfork" >&6; }
if test "x${je_cv_pthread_atfork}" = "xyes" ; then
$as_echo "#define JEMALLOC_HAVE_PTHREAD_ATFORK " >>confdefs.h
fi
fi
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
$as_echo_n "checking for library containing clock_gettime... " >&6; }
if ${ac_cv_search_clock_gettime+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char clock_gettime ();
int
main ()
{
return clock_gettime ();
;
return 0;
}
_ACEOF
for ac_lib in '' rt; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_clock_gettime=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_clock_gettime+:} false; then :
break
fi
done
if ${ac_cv_search_clock_gettime+:} false; then :
else
ac_cv_search_clock_gettime=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
$as_echo "$ac_cv_search_clock_gettime" >&6; }
ac_res=$ac_cv_search_clock_gettime
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
if test "$ac_cv_search_clock_gettime" != "-lrt"; then
SAVED_CFLAGS="${CFLAGS}"
unset ac_cv_search_clock_gettime
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -dynamic" >&5
$as_echo_n "checking whether compiler supports -dynamic... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-dynamic"
else
CFLAGS="${CFLAGS} -dynamic"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-dynamic
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
$as_echo_n "checking for library containing clock_gettime... " >&6; }
if ${ac_cv_search_clock_gettime+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif #endif
char clock_gettime (); char clock_gettime ();
int int
...@@ -7161,11 +7990,223 @@ $as_echo "$ac_cv_search_clock_gettime" >&6; } ...@@ -7161,11 +7990,223 @@ $as_echo "$ac_cv_search_clock_gettime" >&6; }
ac_res=$ac_cv_search_clock_gettime ac_res=$ac_cv_search_clock_gettime
if test "$ac_res" != no; then : if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
TESTLIBS="${LIBS}"
fi fi
LIBS="${SAVED_LIBS}" CFLAGS="${SAVED_CFLAGS}"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable" >&5
$as_echo_n "checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable... " >&6; }
if ${je_cv_clock_monotonic_coarse+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
int
main ()
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_clock_monotonic_coarse=yes
else
je_cv_clock_monotonic_coarse=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_clock_monotonic_coarse" >&5
$as_echo "$je_cv_clock_monotonic_coarse" >&6; }
if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
$as_echo "#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable" >&5
$as_echo_n "checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable... " >&6; }
if ${je_cv_clock_monotonic+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
#include <time.h>
int
main ()
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
# error _POSIX_MONOTONIC_CLOCK missing/invalid
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_clock_monotonic=yes
else
je_cv_clock_monotonic=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_clock_monotonic" >&5
$as_echo "$je_cv_clock_monotonic" >&6; }
if test "x${je_cv_clock_monotonic}" = "xyes" ; then
$as_echo "#define JEMALLOC_HAVE_CLOCK_MONOTONIC 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mach_absolute_time() is compilable" >&5
$as_echo_n "checking whether mach_absolute_time() is compilable... " >&6; }
if ${je_cv_mach_absolute_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <mach/mach_time.h>
int
main ()
{
mach_absolute_time();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_mach_absolute_time=yes
else
je_cv_mach_absolute_time=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_mach_absolute_time" >&5
$as_echo "$je_cv_mach_absolute_time" >&6; }
if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
$as_echo "#define JEMALLOC_HAVE_MACH_ABSOLUTE_TIME 1" >>confdefs.h
fi
# Check whether --enable-syscall was given.
if test "${enable_syscall+set}" = set; then :
enableval=$enable_syscall; if test "x$enable_syscall" = "xno" ; then
enable_syscall="0"
else
enable_syscall="1"
fi
else
enable_syscall="1"
fi
if test "x$enable_syscall" = "x1" ; then
SAVED_CFLAGS="${CFLAGS}"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror" >&5
$as_echo_n "checking whether compiler supports -Werror... " >&6; }
TCFLAGS="${CFLAGS}"
if test "x${CFLAGS}" = "x" ; then
CFLAGS="-Werror"
else
CFLAGS="${CFLAGS} -Werror"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
je_cv_cflags_appended=-Werror
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
je_cv_cflags_appended=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
CFLAGS="${TCFLAGS}"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether syscall(2) is compilable" >&5
$as_echo_n "checking whether syscall(2) is compilable... " >&6; }
if ${je_cv_syscall+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/syscall.h>
#include <unistd.h>
int
main ()
{
syscall(SYS_write, 2, "hello", 5);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_syscall=yes
else
je_cv_syscall=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_syscall" >&5
$as_echo "$je_cv_syscall" >&6; }
CFLAGS="${SAVED_CFLAGS}"
if test "x$je_cv_syscall" = "xyes" ; then
$as_echo "#define JEMALLOC_USE_SYSCALL " >>confdefs.h
fi
fi
ac_fn_c_check_func "$LINENO" "secure_getenv" "ac_cv_func_secure_getenv" ac_fn_c_check_func "$LINENO" "secure_getenv" "ac_cv_func_secure_getenv"
if test "x$ac_cv_func_secure_getenv" = xyes; then : if test "x$ac_cv_func_secure_getenv" = xyes; then :
...@@ -7233,10 +8274,19 @@ else ...@@ -7233,10 +8274,19 @@ else
fi fi
if test "x$enable_lazy_lock" = "x" -a "x${force_lazy_lock}" = "x1" ; then if test "x${enable_lazy_lock}" = "x" ; then
if test "x${force_lazy_lock}" = "x1" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing lazy-lock to avoid allocator/threading bootstrap issues" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing lazy-lock to avoid allocator/threading bootstrap issues" >&5
$as_echo "Forcing lazy-lock to avoid allocator/threading bootstrap issues" >&6; } $as_echo "Forcing lazy-lock to avoid allocator/threading bootstrap issues" >&6; }
enable_lazy_lock="1" enable_lazy_lock="1"
else
enable_lazy_lock="0"
fi
fi
if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing no lazy-lock because thread creation monitoring is unimplemented" >&5
$as_echo "Forcing no lazy-lock because thread creation monitoring is unimplemented" >&6; }
enable_lazy_lock="0"
fi fi
if test "x$enable_lazy_lock" = "x1" ; then if test "x$enable_lazy_lock" = "x1" ; then
if test "x$abi" != "xpecoff" ; then if test "x$abi" != "xpecoff" ; then
...@@ -7306,8 +8356,6 @@ fi ...@@ -7306,8 +8356,6 @@ fi
fi fi
$as_echo "#define JEMALLOC_LAZY_LOCK " >>confdefs.h $as_echo "#define JEMALLOC_LAZY_LOCK " >>confdefs.h
else
enable_lazy_lock="0"
fi fi
...@@ -7544,9 +8592,7 @@ int ...@@ -7544,9 +8592,7 @@ int
main () main ()
{ {
{
madvise((void *)0, 0, 0); madvise((void *)0, 0, 0);
}
; ;
return 0; return 0;
...@@ -7566,6 +8612,118 @@ $as_echo "$je_cv_madvise" >&6; } ...@@ -7566,6 +8612,118 @@ $as_echo "$je_cv_madvise" >&6; }
if test "x${je_cv_madvise}" = "xyes" ; then if test "x${je_cv_madvise}" = "xyes" ; then
$as_echo "#define JEMALLOC_HAVE_MADVISE " >>confdefs.h $as_echo "#define JEMALLOC_HAVE_MADVISE " >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether madvise(..., MADV_FREE) is compilable" >&5
$as_echo_n "checking whether madvise(..., MADV_FREE) is compilable... " >&6; }
if ${je_cv_madv_free+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/mman.h>
int
main ()
{
madvise((void *)0, 0, MADV_FREE);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_madv_free=yes
else
je_cv_madv_free=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_madv_free" >&5
$as_echo "$je_cv_madv_free" >&6; }
if test "x${je_cv_madv_free}" = "xyes" ; then
$as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether madvise(..., MADV_DONTNEED) is compilable" >&5
$as_echo_n "checking whether madvise(..., MADV_DONTNEED) is compilable... " >&6; }
if ${je_cv_madv_dontneed+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/mman.h>
int
main ()
{
madvise((void *)0, 0, MADV_DONTNEED);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_madv_dontneed=yes
else
je_cv_madv_dontneed=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_madv_dontneed" >&5
$as_echo "$je_cv_madv_dontneed" >&6; }
if test "x${je_cv_madv_dontneed}" = "xyes" ; then
$as_echo "#define JEMALLOC_PURGE_MADVISE_DONTNEED " >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether madvise(..., MADV_[NO]HUGEPAGE) is compilable" >&5
$as_echo_n "checking whether madvise(..., MADV_[NO]HUGEPAGE) is compilable... " >&6; }
if ${je_cv_thp+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/mman.h>
int
main ()
{
madvise((void *)0, 0, MADV_HUGEPAGE);
madvise((void *)0, 0, MADV_NOHUGEPAGE);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_thp=yes
else
je_cv_thp=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_thp" >&5
$as_echo "$je_cv_thp" >&6; }
if test "x${je_cv_thp}" = "xyes" ; then
$as_echo "#define JEMALLOC_THP " >>confdefs.h
fi
fi fi
...@@ -7708,6 +8866,51 @@ fi ...@@ -7708,6 +8866,51 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Darwin os_unfair_lock_*() is compilable" >&5
$as_echo_n "checking whether Darwin os_unfair_lock_*() is compilable... " >&6; }
if ${je_cv_os_unfair_lock+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <os/lock.h>
#include <AvailabilityMacros.h>
int
main ()
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
#error "os_unfair_lock is not supported"
#else
os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
os_unfair_lock_lock(&lock);
os_unfair_lock_unlock(&lock);
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
je_cv_os_unfair_lock=yes
else
je_cv_os_unfair_lock=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_os_unfair_lock" >&5
$as_echo "$je_cv_os_unfair_lock" >&6; }
if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
$as_echo "#define JEMALLOC_OS_UNFAIR_LOCK " >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Darwin OSSpin*() is compilable" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Darwin OSSpin*() is compilable" >&5
$as_echo_n "checking whether Darwin OSSpin*() is compilable... " >&6; } $as_echo_n "checking whether Darwin OSSpin*() is compilable... " >&6; }
if ${je_cv_osspin+:} false; then : if ${je_cv_osspin+:} false; then :
...@@ -9610,6 +10813,8 @@ $as_echo "CONFIG : ${CONFIG}" >&6; } ...@@ -9610,6 +10813,8 @@ $as_echo "CONFIG : ${CONFIG}" >&6; }
$as_echo "CC : ${CC}" >&6; } $as_echo "CC : ${CC}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CFLAGS : ${CFLAGS}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: CFLAGS : ${CFLAGS}" >&5
$as_echo "CFLAGS : ${CFLAGS}" >&6; } $as_echo "CFLAGS : ${CFLAGS}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: EXTRA_CFLAGS : ${EXTRA_CFLAGS}" >&5
$as_echo "EXTRA_CFLAGS : ${EXTRA_CFLAGS}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CPPFLAGS : ${CPPFLAGS}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: CPPFLAGS : ${CPPFLAGS}" >&5
$as_echo "CPPFLAGS : ${CPPFLAGS}" >&6; } $as_echo "CPPFLAGS : ${CPPFLAGS}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LDFLAGS : ${LDFLAGS}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: LDFLAGS : ${LDFLAGS}" >&5
...@@ -9618,8 +10823,6 @@ $as_echo "LDFLAGS : ${LDFLAGS}" >&6; } ...@@ -9618,8 +10823,6 @@ $as_echo "LDFLAGS : ${LDFLAGS}" >&6; }
$as_echo "EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}" >&6; } $as_echo "EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LIBS : ${LIBS}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: LIBS : ${LIBS}" >&5
$as_echo "LIBS : ${LIBS}" >&6; } $as_echo "LIBS : ${LIBS}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: TESTLIBS : ${TESTLIBS}" >&5
$as_echo "TESTLIBS : ${TESTLIBS}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: RPATH_EXTRA : ${RPATH_EXTRA}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: RPATH_EXTRA : ${RPATH_EXTRA}" >&5
$as_echo "RPATH_EXTRA : ${RPATH_EXTRA}" >&6; } $as_echo "RPATH_EXTRA : ${RPATH_EXTRA}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
...@@ -9662,6 +10865,8 @@ $as_echo "JEMALLOC_PRIVATE_NAMESPACE" >&6; } ...@@ -9662,6 +10865,8 @@ $as_echo "JEMALLOC_PRIVATE_NAMESPACE" >&6; }
$as_echo " : ${JEMALLOC_PRIVATE_NAMESPACE}" >&6; } $as_echo " : ${JEMALLOC_PRIVATE_NAMESPACE}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: install_suffix : ${install_suffix}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: install_suffix : ${install_suffix}" >&5
$as_echo "install_suffix : ${install_suffix}" >&6; } $as_echo "install_suffix : ${install_suffix}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: malloc_conf : ${config_malloc_conf}" >&5
$as_echo "malloc_conf : ${config_malloc_conf}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: autogen : ${enable_autogen}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: autogen : ${enable_autogen}" >&5
$as_echo "autogen : ${enable_autogen}" >&6; } $as_echo "autogen : ${enable_autogen}" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cc-silence : ${enable_cc_silence}" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cc-silence : ${enable_cc_silence}" >&5
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT([Makefile.in]) AC_INIT([Makefile.in])
AC_CONFIG_AUX_DIR([build-aux])
dnl ============================================================================ dnl ============================================================================
dnl Custom macro definitions. dnl Custom macro definitions.
...@@ -116,6 +118,7 @@ dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, ...@@ -116,6 +118,7 @@ dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
dnl just prevent autoconf from molesting CFLAGS. dnl just prevent autoconf from molesting CFLAGS.
CFLAGS=$CFLAGS CFLAGS=$CFLAGS
AC_PROG_CC AC_PROG_CC
if test "x$GCC" != "xyes" ; then if test "x$GCC" != "xyes" ; then
AC_CACHE_CHECK([whether compiler is MSVC], AC_CACHE_CHECK([whether compiler is MSVC],
[je_cv_msvc], [je_cv_msvc],
...@@ -129,15 +132,58 @@ if test "x$GCC" != "xyes" ; then ...@@ -129,15 +132,58 @@ if test "x$GCC" != "xyes" ; then
[je_cv_msvc=no])]) [je_cv_msvc=no])])
fi fi
dnl check if a cray prgenv wrapper compiler is being used
je_cv_cray_prgenv_wrapper=""
if test "x${PE_ENV}" != "x" ; then
case "${CC}" in
CC|cc)
je_cv_cray_prgenv_wrapper="yes"
;;
*)
;;
esac
fi
AC_CACHE_CHECK([whether compiler is cray],
[je_cv_cray],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[
#ifndef _CRAYC
int fail[-1];
#endif
])],
[je_cv_cray=yes],
[je_cv_cray=no])])
if test "x${je_cv_cray}" = "xyes" ; then
AC_CACHE_CHECK([whether cray compiler version is 8.4],
[je_cv_cray_84],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[
#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
int fail[-1];
#endif
])],
[je_cv_cray_84=yes],
[je_cv_cray_84=no])])
fi
if test "x$CFLAGS" = "x" ; then if test "x$CFLAGS" = "x" ; then
no_CFLAGS="yes" no_CFLAGS="yes"
if test "x$GCC" = "xyes" ; then if test "x$GCC" = "xyes" ; then
JE_CFLAGS_APPEND([-std=gnu11])
if test "x$je_cv_cflags_appended" = "x-std=gnu11" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
else
JE_CFLAGS_APPEND([-std=gnu99]) JE_CFLAGS_APPEND([-std=gnu99])
if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
fi fi
fi
JE_CFLAGS_APPEND([-Wall]) JE_CFLAGS_APPEND([-Wall])
JE_CFLAGS_APPEND([-Werror=declaration-after-statement]) JE_CFLAGS_APPEND([-Werror=declaration-after-statement])
JE_CFLAGS_APPEND([-Wshorten-64-to-32])
JE_CFLAGS_APPEND([-Wsign-compare])
JE_CFLAGS_APPEND([-pipe]) JE_CFLAGS_APPEND([-pipe])
JE_CFLAGS_APPEND([-g3]) JE_CFLAGS_APPEND([-g3])
elif test "x$je_cv_msvc" = "xyes" ; then elif test "x$je_cv_msvc" = "xyes" ; then
...@@ -148,11 +194,21 @@ if test "x$CFLAGS" = "x" ; then ...@@ -148,11 +194,21 @@ if test "x$CFLAGS" = "x" ; then
JE_CFLAGS_APPEND([-FS]) JE_CFLAGS_APPEND([-FS])
CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat" CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
fi fi
if test "x$je_cv_cray" = "xyes" ; then
dnl cray compiler 8.4 has an inlining bug
if test "x$je_cv_cray_84" = "xyes" ; then
JE_CFLAGS_APPEND([-hipa2])
JE_CFLAGS_APPEND([-hnognu])
fi
if test "x$enable_cc_silence" != "xno" ; then
dnl ignore unreachable code warning
JE_CFLAGS_APPEND([-hnomessage=128])
dnl ignore redefinition of "malloc", "free", etc warning
JE_CFLAGS_APPEND([-hnomessage=1357])
fi
fi
fi fi
dnl Append EXTRA_CFLAGS to CFLAGS, if defined. AC_SUBST([EXTRA_CFLAGS])
if test "x$EXTRA_CFLAGS" != "x" ; then
JE_CFLAGS_APPEND([$EXTRA_CFLAGS])
fi
AC_PROG_CPP AC_PROG_CPP
AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
...@@ -164,13 +220,18 @@ if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then ...@@ -164,13 +220,18 @@ if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99" CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
fi fi
AC_CHECK_SIZEOF([void *]) if test "x${je_cv_msvc}" = "xyes" ; then
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit])
else
AC_CHECK_SIZEOF([void *])
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
LG_SIZEOF_PTR=3 LG_SIZEOF_PTR=3
elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
LG_SIZEOF_PTR=2 LG_SIZEOF_PTR=2
else else
AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
fi
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
...@@ -194,6 +255,16 @@ else ...@@ -194,6 +255,16 @@ else
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG]) AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
AC_CHECK_SIZEOF([long long])
if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
LG_SIZEOF_LONG_LONG=3
elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
LG_SIZEOF_LONG_LONG=2
else
AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG])
AC_CHECK_SIZEOF([intmax_t]) AC_CHECK_SIZEOF([intmax_t])
if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
LG_SIZEOF_INTMAX_T=4 LG_SIZEOF_INTMAX_T=4
...@@ -211,6 +282,15 @@ dnl CPU-specific settings. ...@@ -211,6 +282,15 @@ dnl CPU-specific settings.
CPU_SPINWAIT="" CPU_SPINWAIT=""
case "${host_cpu}" in case "${host_cpu}" in
i686|x86_64) i686|x86_64)
if test "x${je_cv_msvc}" = "xyes" ; then
AC_CACHE_VAL([je_cv_pause_msvc],
[JE_COMPILABLE([pause instruction MSVC], [],
[[_mm_pause(); return 0;]],
[je_cv_pause_msvc])])
if test "x${je_cv_pause_msvc}" = "xyes" ; then
CPU_SPINWAIT='_mm_pause()'
fi
else
AC_CACHE_VAL([je_cv_pause], AC_CACHE_VAL([je_cv_pause],
[JE_COMPILABLE([pause instruction], [], [JE_COMPILABLE([pause instruction], [],
[[__asm__ volatile("pause"); return 0;]], [[__asm__ volatile("pause"); return 0;]],
...@@ -218,6 +298,7 @@ case "${host_cpu}" in ...@@ -218,6 +298,7 @@ case "${host_cpu}" in
if test "x${je_cv_pause}" = "xyes" ; then if test "x${je_cv_pause}" = "xyes" ; then
CPU_SPINWAIT='__asm__ volatile("pause")' CPU_SPINWAIT='__asm__ volatile("pause")'
fi fi
fi
;; ;;
powerpc) powerpc)
AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ]) AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
...@@ -234,17 +315,27 @@ o="$ac_objext" ...@@ -234,17 +315,27 @@ o="$ac_objext"
a="a" a="a"
exe="$ac_exeext" exe="$ac_exeext"
libprefix="lib" libprefix="lib"
link_whole_archive="0"
DSO_LDFLAGS='-shared -Wl,-soname,$(@F)' DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
RPATH='-Wl,-rpath,$(1)' RPATH='-Wl,-rpath,$(1)'
SOREV="${so}.${rev}" SOREV="${so}.${rev}"
PIC_CFLAGS='-fPIC -DPIC' PIC_CFLAGS='-fPIC -DPIC'
CTARGET='-o $@' CTARGET='-o $@'
LDTARGET='-o $@' LDTARGET='-o $@'
TEST_LD_MODE=
EXTRA_LDFLAGS= EXTRA_LDFLAGS=
ARFLAGS='crus' ARFLAGS='crus'
AROUT=' $@' AROUT=' $@'
CC_MM=1 CC_MM=1
if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
TEST_LD_MODE='-dynamic'
fi
if test "x${je_cv_cray}" = "xyes" ; then
CC_MM=
fi
AN_MAKEVAR([AR], [AC_PROG_AR]) AN_MAKEVAR([AR], [AC_PROG_AR])
AN_PROGRAM([ar], [AC_PROG_AR]) AN_PROGRAM([ar], [AC_PROG_AR])
AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
...@@ -257,13 +348,12 @@ dnl ...@@ -257,13 +348,12 @@ dnl
dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
dnl definitions need to be seen before any headers are included, which is a pain dnl definitions need to be seen before any headers are included, which is a pain
dnl to make happen otherwise. dnl to make happen otherwise.
CFLAGS="$CFLAGS"
default_munmap="1" default_munmap="1"
maps_coalesce="1" maps_coalesce="1"
case "${host}" in case "${host}" in
*-*-darwin* | *-*-ios*) *-*-darwin* | *-*-ios*)
CFLAGS="$CFLAGS"
abi="macho" abi="macho"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
RPATH="" RPATH=""
LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
so="dylib" so="dylib"
...@@ -274,33 +364,37 @@ case "${host}" in ...@@ -274,33 +364,37 @@ case "${host}" in
sbrk_deprecated="1" sbrk_deprecated="1"
;; ;;
*-*-freebsd*) *-*-freebsd*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
force_lazy_lock="1" force_lazy_lock="1"
;; ;;
*-*-dragonfly*) *-*-dragonfly*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
;; ;;
*-*-openbsd*) *-*-openbsd*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
force_tls="0" force_tls="0"
;; ;;
*-*-bitrig*) *-*-bitrig*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
;; ;;
*-*-linux*) *-*-linux-android)
CFLAGS="$CFLAGS" dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
AC_DEFINE([JEMALLOC_C11ATOMICS])
force_tls="0"
default_munmap="0"
;;
*-*-linux* | *-*-kfreebsd*)
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
abi="elf"
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
default_munmap="0" default_munmap="0"
...@@ -314,15 +408,12 @@ case "${host}" in ...@@ -314,15 +408,12 @@ case "${host}" in
#error aout #error aout
#endif #endif
]])], ]])],
[CFLAGS="$CFLAGS"; abi="elf"], [abi="elf"],
[abi="aout"]) [abi="aout"])
AC_MSG_RESULT([$abi]) AC_MSG_RESULT([$abi])
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
;; ;;
*-*-solaris2*) *-*-solaris2*)
CFLAGS="$CFLAGS"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
RPATH='-Wl,-R,$(1)' RPATH='-Wl,-R,$(1)'
dnl Solaris needs this for sigwait(). dnl Solaris needs this for sigwait().
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
...@@ -341,7 +432,6 @@ case "${host}" in ...@@ -341,7 +432,6 @@ case "${host}" in
*-*-mingw* | *-*-cygwin*) *-*-mingw* | *-*-cygwin*)
abi="pecoff" abi="pecoff"
force_tls="0" force_tls="0"
force_lazy_lock="1"
maps_coalesce="0" maps_coalesce="0"
RPATH="" RPATH=""
so="dll" so="dll"
...@@ -358,6 +448,7 @@ case "${host}" in ...@@ -358,6 +448,7 @@ case "${host}" in
else else
importlib="${so}" importlib="${so}"
DSO_LDFLAGS="-shared" DSO_LDFLAGS="-shared"
link_whole_archive="1"
fi fi
a="lib" a="lib"
libprefix="" libprefix=""
...@@ -395,17 +486,28 @@ AC_SUBST([o]) ...@@ -395,17 +486,28 @@ AC_SUBST([o])
AC_SUBST([a]) AC_SUBST([a])
AC_SUBST([exe]) AC_SUBST([exe])
AC_SUBST([libprefix]) AC_SUBST([libprefix])
AC_SUBST([link_whole_archive])
AC_SUBST([DSO_LDFLAGS]) AC_SUBST([DSO_LDFLAGS])
AC_SUBST([EXTRA_LDFLAGS]) AC_SUBST([EXTRA_LDFLAGS])
AC_SUBST([SOREV]) AC_SUBST([SOREV])
AC_SUBST([PIC_CFLAGS]) AC_SUBST([PIC_CFLAGS])
AC_SUBST([CTARGET]) AC_SUBST([CTARGET])
AC_SUBST([LDTARGET]) AC_SUBST([LDTARGET])
AC_SUBST([TEST_LD_MODE])
AC_SUBST([MKLIB]) AC_SUBST([MKLIB])
AC_SUBST([ARFLAGS]) AC_SUBST([ARFLAGS])
AC_SUBST([AROUT]) AC_SUBST([AROUT])
AC_SUBST([CC_MM]) AC_SUBST([CC_MM])
dnl Determine whether libm must be linked to use e.g. log(3).
AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
if test "x$ac_cv_search_log" != "xnone required" ; then
LM="$ac_cv_search_log"
else
LM=
fi
AC_SUBST(LM)
JE_COMPILABLE([__attribute__ syntax], JE_COMPILABLE([__attribute__ syntax],
[static __attribute__((unused)) void foo(void){}], [static __attribute__((unused)) void foo(void){}],
[], [],
...@@ -419,6 +521,7 @@ fi ...@@ -419,6 +521,7 @@ fi
dnl Check for tls_model attribute support (clang 3.0 still lacks support). dnl Check for tls_model attribute support (clang 3.0 still lacks support).
SAVED_CFLAGS="${CFLAGS}" SAVED_CFLAGS="${CFLAGS}"
JE_CFLAGS_APPEND([-Werror]) JE_CFLAGS_APPEND([-Werror])
JE_CFLAGS_APPEND([-herror_on_warning])
JE_COMPILABLE([tls_model attribute], [], JE_COMPILABLE([tls_model attribute], [],
[static __thread int [static __thread int
__attribute__((tls_model("initial-exec"), unused)) foo; __attribute__((tls_model("initial-exec"), unused)) foo;
...@@ -434,6 +537,7 @@ fi ...@@ -434,6 +537,7 @@ fi
dnl Check for alloc_size attribute support. dnl Check for alloc_size attribute support.
SAVED_CFLAGS="${CFLAGS}" SAVED_CFLAGS="${CFLAGS}"
JE_CFLAGS_APPEND([-Werror]) JE_CFLAGS_APPEND([-Werror])
JE_CFLAGS_APPEND([-herror_on_warning])
JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
[void *foo(size_t size) __attribute__((alloc_size(1)));], [void *foo(size_t size) __attribute__((alloc_size(1)));],
[je_cv_alloc_size]) [je_cv_alloc_size])
...@@ -444,6 +548,7 @@ fi ...@@ -444,6 +548,7 @@ fi
dnl Check for format(gnu_printf, ...) attribute support. dnl Check for format(gnu_printf, ...) attribute support.
SAVED_CFLAGS="${CFLAGS}" SAVED_CFLAGS="${CFLAGS}"
JE_CFLAGS_APPEND([-Werror]) JE_CFLAGS_APPEND([-Werror])
JE_CFLAGS_APPEND([-herror_on_warning])
JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
[void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));], [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));],
[je_cv_format_gnu_printf]) [je_cv_format_gnu_printf])
...@@ -454,6 +559,7 @@ fi ...@@ -454,6 +559,7 @@ fi
dnl Check for format(printf, ...) attribute support. dnl Check for format(printf, ...) attribute support.
SAVED_CFLAGS="${CFLAGS}" SAVED_CFLAGS="${CFLAGS}"
JE_CFLAGS_APPEND([-Werror]) JE_CFLAGS_APPEND([-Werror])
JE_CFLAGS_APPEND([-herror_on_warning])
JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
[void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));], [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));],
[je_cv_format_printf]) [je_cv_format_printf])
...@@ -575,6 +681,15 @@ AC_ARG_WITH([install_suffix], ...@@ -575,6 +681,15 @@ AC_ARG_WITH([install_suffix],
install_suffix="$INSTALL_SUFFIX" install_suffix="$INSTALL_SUFFIX"
AC_SUBST([install_suffix]) AC_SUBST([install_suffix])
dnl Specify default malloc_conf.
AC_ARG_WITH([malloc_conf],
[AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])],
[JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"],
[JEMALLOC_CONFIG_MALLOC_CONF=""]
)
config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"])
dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
dnl jemalloc_protos_jet.h easy. dnl jemalloc_protos_jet.h easy.
je_="je_" je_="je_"
...@@ -839,9 +954,9 @@ fi ...@@ -839,9 +954,9 @@ fi
AC_MSG_CHECKING([configured backtracing method]) AC_MSG_CHECKING([configured backtracing method])
AC_MSG_RESULT([$backtrace_method]) AC_MSG_RESULT([$backtrace_method])
if test "x$enable_prof" = "x1" ; then if test "x$enable_prof" = "x1" ; then
if test "x$abi" != "xpecoff"; then
dnl Heap profiling uses the log(3) function. dnl Heap profiling uses the log(3) function.
LIBS="$LIBS -lm" if test "x$LM" != "x" ; then
LIBS="$LIBS $LM"
fi fi
AC_DEFINE([JEMALLOC_PROF], [ ]) AC_DEFINE([JEMALLOC_PROF], [ ])
...@@ -1010,11 +1125,28 @@ if test "x$enable_cache_oblivious" = "x1" ; then ...@@ -1010,11 +1125,28 @@ if test "x$enable_cache_oblivious" = "x1" ; then
fi fi
AC_SUBST([enable_cache_oblivious]) AC_SUBST([enable_cache_oblivious])
JE_COMPILABLE([a program using __builtin_unreachable], [
void foo (void) {
__builtin_unreachable();
}
], [
{
foo();
}
], [je_cv_gcc_builtin_unreachable])
if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable])
else
AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort])
fi
dnl ============================================================================ dnl ============================================================================
dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found. dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
dnl One of those two functions should (theoretically) exist on all platforms dnl One of those two functions should (theoretically) exist on all platforms
dnl that jemalloc currently has a chance of functioning on without modification. dnl that jemalloc currently has a chance of functioning on without modification.
dnl We additionally assume ffs() or __builtin_ffs() are defined if dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if
dnl ffsl() or __builtin_ffsl() are defined, respectively. dnl ffsl() or __builtin_ffsl() are defined, respectively.
JE_COMPILABLE([a program using __builtin_ffsl], [ JE_COMPILABLE([a program using __builtin_ffsl], [
#include <stdio.h> #include <stdio.h>
...@@ -1027,6 +1159,7 @@ JE_COMPILABLE([a program using __builtin_ffsl], [ ...@@ -1027,6 +1159,7 @@ JE_COMPILABLE([a program using __builtin_ffsl], [
} }
], [je_cv_gcc_builtin_ffsl]) ], [je_cv_gcc_builtin_ffsl])
if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll])
AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl]) AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs]) AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
else else
...@@ -1041,6 +1174,7 @@ else ...@@ -1041,6 +1174,7 @@ else
} }
], [je_cv_function_ffsl]) ], [je_cv_function_ffsl])
if test "x${je_cv_function_ffsl}" = "xyes" ; then if test "x${je_cv_function_ffsl}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll])
AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl]) AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs]) AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
else else
...@@ -1100,7 +1234,7 @@ if test "x$LG_PAGE" = "xdetect"; then ...@@ -1100,7 +1234,7 @@ if test "x$LG_PAGE" = "xdetect"; then
if (f == NULL) { if (f == NULL) {
return 1; return 1;
} }
fprintf(f, "%d\n", result); fprintf(f, "%d", result);
fclose(f); fclose(f);
return 0; return 0;
...@@ -1133,27 +1267,36 @@ dnl ============================================================================ ...@@ -1133,27 +1267,36 @@ dnl ============================================================================
dnl jemalloc configuration. dnl jemalloc configuration.
dnl dnl
dnl Set VERSION if source directory is inside a git repository. AC_ARG_WITH([version],
if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
[Version string])],
[
echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
if test $? -ne 0 ; then
AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid>])
fi
echo "$with_version" > "${objroot}VERSION"
], [
dnl Set VERSION if source directory is inside a git repository.
if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
dnl Pattern globs aren't powerful enough to match both single- and dnl Pattern globs aren't powerful enough to match both single- and
dnl double-digit version numbers, so iterate over patterns to support up to dnl double-digit version numbers, so iterate over patterns to support up
dnl version 99.99.99 without any accidental matches. dnl to version 99.99.99 without any accidental matches.
rm -f "${objroot}VERSION"
for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \ for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
'[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \ '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
'[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \ '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
'[0-9][0-9].[0-9][0-9].[0-9]' \ '[0-9][0-9].[0-9][0-9].[0-9]' \
'[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
if test ! -e "${objroot}VERSION" ; then
(test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
if test $? -eq 0 ; then if test $? -eq 0 ; then
mv "${objroot}VERSION.tmp" "${objroot}VERSION" mv "${objroot}VERSION.tmp" "${objroot}VERSION"
break break
fi fi
fi
done done
fi fi
rm -f "${objroot}VERSION.tmp" rm -f "${objroot}VERSION.tmp"
])
if test ! -e "${objroot}VERSION" ; then if test ! -e "${objroot}VERSION" ; then
if test ! -e "${srcroot}VERSION" ; then if test ! -e "${srcroot}VERSION" ; then
AC_MSG_RESULT( AC_MSG_RESULT(
...@@ -1186,17 +1329,101 @@ if test "x$abi" != "xpecoff" ; then ...@@ -1186,17 +1329,101 @@ if test "x$abi" != "xpecoff" ; then
AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
[AC_SEARCH_LIBS([pthread_create], , , [AC_SEARCH_LIBS([pthread_create], , ,
AC_MSG_ERROR([libpthread is missing]))]) AC_MSG_ERROR([libpthread is missing]))])
JE_COMPILABLE([pthread_atfork(3)], [
#include <pthread.h>
], [
pthread_atfork((void *)0, (void *)0, (void *)0);
], [je_cv_pthread_atfork])
if test "x${je_cv_pthread_atfork}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ])
fi
fi fi
CPPFLAGS="$CPPFLAGS -D_REENTRANT" CPPFLAGS="$CPPFLAGS -D_REENTRANT"
dnl Check whether clock_gettime(2) is in libc or librt. This function is only dnl Check whether clock_gettime(2) is in libc or librt.
dnl used in test code, so save the result to TESTLIBS to avoid poluting LIBS. AC_SEARCH_LIBS([clock_gettime], [rt])
SAVED_LIBS="${LIBS}"
LIBS= dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with
AC_SEARCH_LIBS([clock_gettime], [rt], [TESTLIBS="${LIBS}"]) dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc
AC_SUBST([TESTLIBS]) if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
LIBS="${SAVED_LIBS}" if test "$ac_cv_search_clock_gettime" != "-lrt"; then
SAVED_CFLAGS="${CFLAGS}"
unset ac_cv_search_clock_gettime
JE_CFLAGS_APPEND([-dynamic])
AC_SEARCH_LIBS([clock_gettime], [rt])
CFLAGS="${SAVED_CFLAGS}"
fi
fi
dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific).
JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
#include <time.h>
], [
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
], [je_cv_clock_monotonic_coarse])
if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE])
fi
dnl check for CLOCK_MONOTONIC.
JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
#include <unistd.h>
#include <time.h>
], [
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
# error _POSIX_MONOTONIC_CLOCK missing/invalid
#endif
], [je_cv_clock_monotonic])
if test "x${je_cv_clock_monotonic}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC])
fi
dnl Check for mach_absolute_time().
JE_COMPILABLE([mach_absolute_time()], [
#include <mach/mach_time.h>
], [
mach_absolute_time();
], [je_cv_mach_absolute_time])
if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME])
fi
dnl Use syscall(2) (if available) by default.
AC_ARG_ENABLE([syscall],
[AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])],
[if test "x$enable_syscall" = "xno" ; then
enable_syscall="0"
else
enable_syscall="1"
fi
],
[enable_syscall="1"]
)
if test "x$enable_syscall" = "x1" ; then
dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS
dnl X 10.12's deprecation warning prevents use.
SAVED_CFLAGS="${CFLAGS}"
JE_CFLAGS_APPEND([-Werror])
JE_COMPILABLE([syscall(2)], [
#include <sys/syscall.h>
#include <unistd.h>
], [
syscall(SYS_write, 2, "hello", 5);
],
[je_cv_syscall])
CFLAGS="${SAVED_CFLAGS}"
if test "x$je_cv_syscall" = "xyes" ; then
AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ])
fi
fi
dnl Check if the GNU-specific secure_getenv function exists. dnl Check if the GNU-specific secure_getenv function exists.
AC_CHECK_FUNC([secure_getenv], AC_CHECK_FUNC([secure_getenv],
...@@ -1252,9 +1479,17 @@ fi ...@@ -1252,9 +1479,17 @@ fi
], ],
[enable_lazy_lock=""] [enable_lazy_lock=""]
) )
if test "x$enable_lazy_lock" = "x" -a "x${force_lazy_lock}" = "x1" ; then if test "x${enable_lazy_lock}" = "x" ; then
if test "x${force_lazy_lock}" = "x1" ; then
AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
enable_lazy_lock="1" enable_lazy_lock="1"
else
enable_lazy_lock="0"
fi
fi
if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented])
enable_lazy_lock="0"
fi fi
if test "x$enable_lazy_lock" = "x1" ; then if test "x$enable_lazy_lock" = "x1" ; then
if test "x$abi" != "xpecoff" ; then if test "x$abi" != "xpecoff" ; then
...@@ -1265,8 +1500,6 @@ if test "x$enable_lazy_lock" = "x1" ; then ...@@ -1265,8 +1500,6 @@ if test "x$enable_lazy_lock" = "x1" ; then
]) ])
fi fi
AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ]) AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
else
enable_lazy_lock="0"
fi fi
AC_SUBST([enable_lazy_lock]) AC_SUBST([enable_lazy_lock])
...@@ -1389,12 +1622,41 @@ dnl Check for madvise(2). ...@@ -1389,12 +1622,41 @@ dnl Check for madvise(2).
JE_COMPILABLE([madvise(2)], [ JE_COMPILABLE([madvise(2)], [
#include <sys/mman.h> #include <sys/mman.h>
], [ ], [
{
madvise((void *)0, 0, 0); madvise((void *)0, 0, 0);
}
], [je_cv_madvise]) ], [je_cv_madvise])
if test "x${je_cv_madvise}" = "xyes" ; then if test "x${je_cv_madvise}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ]) AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
dnl Check for madvise(..., MADV_FREE).
JE_COMPILABLE([madvise(..., MADV_FREE)], [
#include <sys/mman.h>
], [
madvise((void *)0, 0, MADV_FREE);
], [je_cv_madv_free])
if test "x${je_cv_madv_free}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
fi
dnl Check for madvise(..., MADV_DONTNEED).
JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [
#include <sys/mman.h>
], [
madvise((void *)0, 0, MADV_DONTNEED);
], [je_cv_madv_dontneed])
if test "x${je_cv_madv_dontneed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
fi
dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [
#include <sys/mman.h>
], [
madvise((void *)0, 0, MADV_HUGEPAGE);
madvise((void *)0, 0, MADV_NOHUGEPAGE);
], [je_cv_thp])
if test "x${je_cv_thp}" = "xyes" ; then
AC_DEFINE([JEMALLOC_THP], [ ])
fi
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -1454,6 +1716,25 @@ if test "x${je_cv_builtin_clz}" = "xyes" ; then ...@@ -1454,6 +1716,25 @@ if test "x${je_cv_builtin_clz}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ]) AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
fi fi
dnl ============================================================================
dnl Check for os_unfair_lock operations as provided on Darwin.
JE_COMPILABLE([Darwin os_unfair_lock_*()], [
#include <os/lock.h>
#include <AvailabilityMacros.h>
], [
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
#error "os_unfair_lock is not supported"
#else
os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
os_unfair_lock_lock(&lock);
os_unfair_lock_unlock(&lock);
#endif
], [je_cv_os_unfair_lock])
if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
fi
dnl ============================================================================ dnl ============================================================================
dnl Check for spinlock(3) operations as provided on Darwin. dnl Check for spinlock(3) operations as provided on Darwin.
...@@ -1698,11 +1979,11 @@ AC_MSG_RESULT([]) ...@@ -1698,11 +1979,11 @@ AC_MSG_RESULT([])
AC_MSG_RESULT([CONFIG : ${CONFIG}]) AC_MSG_RESULT([CONFIG : ${CONFIG}])
AC_MSG_RESULT([CC : ${CC}]) AC_MSG_RESULT([CC : ${CC}])
AC_MSG_RESULT([CFLAGS : ${CFLAGS}]) AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}])
AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
AC_MSG_RESULT([LIBS : ${LIBS}]) AC_MSG_RESULT([LIBS : ${LIBS}])
AC_MSG_RESULT([TESTLIBS : ${TESTLIBS}])
AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
...@@ -1724,6 +2005,7 @@ AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) ...@@ -1724,6 +2005,7 @@ AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
AC_MSG_RESULT([install_suffix : ${install_suffix}]) AC_MSG_RESULT([install_suffix : ${install_suffix}])
AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
AC_MSG_RESULT([autogen : ${enable_autogen}]) AC_MSG_RESULT([autogen : ${enable_autogen}])
AC_MSG_RESULT([cc-silence : ${enable_cc_silence}]) AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
AC_MSG_RESULT([debug : ${enable_debug}]) AC_MSG_RESULT([debug : ${enable_debug}])
......
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="@XSLROOT@/html/docbook.xsl"/> <xsl:import href="@XSLROOT@/html/docbook.xsl"/>
<xsl:import href="@abs_srcroot@doc/stylesheet.xsl"/> <xsl:import href="@abs_srcroot@doc/stylesheet.xsl"/>
<xsl:output method="xml" encoding="utf-8"/>
</xsl:stylesheet> </xsl:stylesheet>
'\" t '\" t
.\" Title: JEMALLOC .\" Title: JEMALLOC
.\" Author: Jason Evans .\" Author: Jason Evans
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 09/24/2015 .\" Date: 12/03/2016
.\" Manual: User Manual .\" Manual: User Manual
.\" Source: jemalloc 4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c .\" Source: jemalloc 4.4.0-0-gf1f76357313e7dcad7262f17a48ff0a2e005fcdc
.\" Language: English .\" Language: English
.\" .\"
.TH "JEMALLOC" "3" "09/24/2015" "jemalloc 4.0.3-0-ge9192eacf893" "User Manual" .TH "JEMALLOC" "3" "12/03/2016" "jemalloc 4.4.0-0-gf1f76357313e" "User Manual"
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * Define some portability stuff .\" * Define some portability stuff
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
jemalloc \- general purpose memory allocation functions jemalloc \- general purpose memory allocation functions
.SH "LIBRARY" .SH "LIBRARY"
.PP .PP
This manual describes jemalloc 4\&.0\&.3\-0\-ge9192eacf8935e29fc62fddc2701f7942b1cc02c\&. More information can be found at the This manual describes jemalloc 4\&.4\&.0\-0\-gf1f76357313e7dcad7262f17a48ff0a2e005fcdc\&. More information can be found at the
\m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&.
.SH "SYNOPSIS" .SH "SYNOPSIS"
.sp .sp
...@@ -86,26 +86,26 @@ const char *\fImalloc_conf\fR; ...@@ -86,26 +86,26 @@ const char *\fImalloc_conf\fR;
.SS "Standard API" .SS "Standard API"
.PP .PP
The The
\fBmalloc\fR\fB\fR malloc()
function allocates function allocates
\fIsize\fR \fIsize\fR
bytes of uninitialized memory\&. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object\&. bytes of uninitialized memory\&. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object\&.
.PP .PP
The The
\fBcalloc\fR\fB\fR calloc()
function allocates space for function allocates space for
\fInumber\fR \fInumber\fR
objects, each objects, each
\fIsize\fR \fIsize\fR
bytes in length\&. The result is identical to calling bytes in length\&. The result is identical to calling
\fBmalloc\fR\fB\fR malloc()
with an argument of with an argument of
\fInumber\fR \fInumber\fR
* *
\fIsize\fR, with the exception that the allocated memory is explicitly initialized to zero bytes\&. \fIsize\fR, with the exception that the allocated memory is explicitly initialized to zero bytes\&.
.PP .PP
The The
\fBposix_memalign\fR\fB\fR posix_memalign()
function allocates function allocates
\fIsize\fR \fIsize\fR
bytes of memory such that the allocation\*(Aqs base address is a multiple of bytes of memory such that the allocation\*(Aqs base address is a multiple of
...@@ -116,7 +116,7 @@ must be a power of 2 at least as large as ...@@ -116,7 +116,7 @@ must be a power of 2 at least as large as
sizeof(\fBvoid *\fR)\&. sizeof(\fBvoid *\fR)\&.
.PP .PP
The The
\fBaligned_alloc\fR\fB\fR aligned_alloc()
function allocates function allocates
\fIsize\fR \fIsize\fR
bytes of memory such that the allocation\*(Aqs base address is a multiple of bytes of memory such that the allocation\*(Aqs base address is a multiple of
...@@ -128,7 +128,7 @@ is not an integral multiple of ...@@ -128,7 +128,7 @@ is not an integral multiple of
\fIalignment\fR\&. \fIalignment\fR\&.
.PP .PP
The The
\fBrealloc\fR\fB\fR realloc()
function changes the size of the previously allocated memory referenced by function changes the size of the previously allocated memory referenced by
\fIptr\fR \fIptr\fR
to to
...@@ -136,19 +136,19 @@ to ...@@ -136,19 +136,19 @@ to
bytes\&. The contents of the memory are unchanged up to the lesser of the new and old sizes\&. If the new size is larger, the contents of the newly allocated portion of the memory are undefined\&. Upon success, the memory referenced by bytes\&. The contents of the memory are unchanged up to the lesser of the new and old sizes\&. If the new size is larger, the contents of the newly allocated portion of the memory are undefined\&. Upon success, the memory referenced by
\fIptr\fR \fIptr\fR
is freed and a pointer to the newly allocated memory is returned\&. Note that is freed and a pointer to the newly allocated memory is returned\&. Note that
\fBrealloc\fR\fB\fR realloc()
may move the memory allocation, resulting in a different return value than may move the memory allocation, resulting in a different return value than
\fIptr\fR\&. If \fIptr\fR\&. If
\fIptr\fR \fIptr\fR
is is
\fBNULL\fR, the \fBNULL\fR, the
\fBrealloc\fR\fB\fR realloc()
function behaves identically to function behaves identically to
\fBmalloc\fR\fB\fR malloc()
for the specified size\&. for the specified size\&.
.PP .PP
The The
\fBfree\fR\fB\fR free()
function causes the allocated memory referenced by function causes the allocated memory referenced by
\fIptr\fR \fIptr\fR
to be made available for future allocations\&. If to be made available for future allocations\&. If
...@@ -158,13 +158,13 @@ is ...@@ -158,13 +158,13 @@ is
.SS "Non\-standard API" .SS "Non\-standard API"
.PP .PP
The The
\fBmallocx\fR\fB\fR, mallocx(),
\fBrallocx\fR\fB\fR, rallocx(),
\fBxallocx\fR\fB\fR, xallocx(),
\fBsallocx\fR\fB\fR, sallocx(),
\fBdallocx\fR\fB\fR, dallocx(),
\fBsdallocx\fR\fB\fR, and sdallocx(), and
\fBnallocx\fR\fB\fR nallocx()
functions all have a functions all have a
\fIflags\fR \fIflags\fR
argument that can be used to specify options\&. The functions only check the options that are contextually relevant\&. Use bitwise or (|) operations to specify one or more of the following: argument that can be used to specify options\&. The functions only check the options that are contextually relevant\&. Use bitwise or (|) operations to specify one or more of the following:
...@@ -196,7 +196,7 @@ Initialize newly allocated memory to contain zero bytes\&. In the growing reallo ...@@ -196,7 +196,7 @@ Initialize newly allocated memory to contain zero bytes\&. In the growing reallo
.RS 4 .RS 4
Use the thread\-specific cache (tcache) specified by the identifier Use the thread\-specific cache (tcache) specified by the identifier
\fItc\fR, which must have been acquired via the \fItc\fR, which must have been acquired via the
"tcache\&.create" tcache\&.create
mallctl\&. This macro does not validate that mallctl\&. This macro does not validate that
\fItc\fR \fItc\fR
specifies a valid identifier\&. specifies a valid identifier\&.
...@@ -223,16 +223,16 @@ specifies an arena index in the valid range\&. ...@@ -223,16 +223,16 @@ specifies an arena index in the valid range\&.
.RE .RE
.PP .PP
The The
\fBmallocx\fR\fB\fR mallocx()
function allocates at least function allocates at least
\fIsize\fR \fIsize\fR
bytes of memory, and returns a pointer to the base address of the allocation\&. Behavior is undefined if bytes of memory, and returns a pointer to the base address of the allocation\&. Behavior is undefined if
\fIsize\fR \fIsize\fR
is is
\fB0\fR, or if request size overflows due to size class and/or alignment constraints\&. \fB0\fR\&.
.PP .PP
The The
\fBrallocx\fR\fB\fR rallocx()
function resizes the allocation at function resizes the allocation at
\fIptr\fR \fIptr\fR
to be at least to be at least
...@@ -240,10 +240,10 @@ to be at least ...@@ -240,10 +240,10 @@ to be at least
bytes, and returns a pointer to the base address of the resulting allocation, which may or may not have moved from its original location\&. Behavior is undefined if bytes, and returns a pointer to the base address of the resulting allocation, which may or may not have moved from its original location\&. Behavior is undefined if
\fIsize\fR \fIsize\fR
is is
\fB0\fR, or if request size overflows due to size class and/or alignment constraints\&. \fB0\fR\&.
.PP .PP
The The
\fBxallocx\fR\fB\fR xallocx()
function resizes the allocation at function resizes the allocation at
\fIptr\fR \fIptr\fR
in place to be at least in place to be at least
...@@ -259,40 +259,42 @@ is ...@@ -259,40 +259,42 @@ is
(\fIsize\fR + \fIextra\fR > \fBSIZE_T_MAX\fR)\&. (\fIsize\fR + \fIextra\fR > \fBSIZE_T_MAX\fR)\&.
.PP .PP
The The
\fBsallocx\fR\fB\fR sallocx()
function returns the real size of the allocation at function returns the real size of the allocation at
\fIptr\fR\&. \fIptr\fR\&.
.PP .PP
The The
\fBdallocx\fR\fB\fR dallocx()
function causes the memory referenced by function causes the memory referenced by
\fIptr\fR \fIptr\fR
to be made available for future allocations\&. to be made available for future allocations\&.
.PP .PP
The The
\fBsdallocx\fR\fB\fR sdallocx()
function is an extension of function is an extension of
\fBdallocx\fR\fB\fR dallocx()
with a with a
\fIsize\fR \fIsize\fR
parameter to allow the caller to pass in the allocation size as an optimization\&. The minimum valid input size is the original requested size of the allocation, and the maximum valid input size is the corresponding value returned by parameter to allow the caller to pass in the allocation size as an optimization\&. The minimum valid input size is the original requested size of the allocation, and the maximum valid input size is the corresponding value returned by
\fBnallocx\fR\fB\fR nallocx()
or or
\fBsallocx\fR\fB\fR\&. sallocx()\&.
.PP .PP
The The
\fBnallocx\fR\fB\fR nallocx()
function allocates no memory, but it performs the same size computation as the function allocates no memory, but it performs the same size computation as the
\fBmallocx\fR\fB\fR mallocx()
function, and returns the real size of the allocation that would result from the equivalent function, and returns the real size of the allocation that would result from the equivalent
\fBmallocx\fR\fB\fR mallocx()
function call\&. Behavior is undefined if function call, or
\fB0\fR
if the inputs exceed the maximum supported size class and/or alignment\&. Behavior is undefined if
\fIsize\fR \fIsize\fR
is is
\fB0\fR, or if request size overflows due to size class and/or alignment constraints\&. \fB0\fR\&.
.PP .PP
The The
\fBmallctl\fR\fB\fR mallctl()
function provides a general interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions\&. The period\-separated function provides a general interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions\&. The period\-separated
\fIname\fR \fIname\fR
argument specifies a location in a tree\-structured namespace; see the argument specifies a location in a tree\-structured namespace; see the
...@@ -311,10 +313,12 @@ and ...@@ -311,10 +313,12 @@ and
\fB0\fR\&. \fB0\fR\&.
.PP .PP
The The
\fBmallctlnametomib\fR\fB\fR mallctlnametomib()
function provides a way to avoid repeated name lookups for applications that repeatedly query the same portion of the namespace, by translating a name to a \(lqManagement Information Base\(rq (MIB) that can be passed repeatedly to function provides a way to avoid repeated name lookups for applications that repeatedly query the same portion of the namespace, by translating a name to a
\fBmallctlbymib\fR\fB\fR\&. Upon successful return from \(lqManagement Information Base\(rq
\fBmallctlnametomib\fR\fB\fR, (MIB) that can be passed repeatedly to
mallctlbymib()\&. Upon successful return from
mallctlnametomib(),
\fImibp\fR \fImibp\fR
contains an array of contains an array of
\fI*miblenp\fR \fI*miblenp\fR
...@@ -326,7 +330,7 @@ and the input value of ...@@ -326,7 +330,7 @@ and the input value of
\fI*miblenp\fR\&. Thus it is possible to pass a \fI*miblenp\fR\&. Thus it is possible to pass a
\fI*miblenp\fR \fI*miblenp\fR
that is smaller than the number of period\-separated name components, which results in a partial MIB that can be used as the basis for constructing a complete MIB\&. For name components that are integers (e\&.g\&. the 2 in that is smaller than the number of period\-separated name components, which results in a partial MIB that can be used as the basis for constructing a complete MIB\&. For name components that are integers (e\&.g\&. the 2 in
"arenas\&.bin\&.2\&.size"), the corresponding MIB component will always be that integer\&. Therefore, it is legitimate to construct code like the following: arenas\&.bin\&.2\&.size), the corresponding MIB component will always be that integer\&. Therefore, it is legitimate to construct code like the following:
.sp .sp
.if n \{\ .if n \{\
.RS 4 .RS 4
...@@ -346,7 +350,7 @@ for (i = 0; i < nbins; i++) { ...@@ -346,7 +350,7 @@ for (i = 0; i < nbins; i++) {
mib[2] = i; mib[2] = i;
len = sizeof(bin_size); len = sizeof(bin_size);
mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0); mallctlbymib(mib, miblen, (void *)&bin_size, &len, NULL, 0);
/* Do something with bin_size\&.\&.\&. */ /* Do something with bin_size\&.\&.\&. */
} }
.fi .fi
...@@ -355,67 +359,87 @@ for (i = 0; i < nbins; i++) { ...@@ -355,67 +359,87 @@ for (i = 0; i < nbins; i++) {
.\} .\}
.PP .PP
The The
\fBmalloc_stats_print\fR\fB\fR malloc_stats_print()
function writes human\-readable summary statistics via the function writes summary statistics via the
\fIwrite_cb\fR \fIwrite_cb\fR
callback function pointer and callback function pointer and
\fIcbopaque\fR \fIcbopaque\fR
data passed to data passed to
\fIwrite_cb\fR, or \fIwrite_cb\fR, or
\fBmalloc_message\fR\fB\fR malloc_message()
if if
\fIwrite_cb\fR \fIwrite_cb\fR
is is
\fBNULL\fR\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying "g" as a character within the \fBNULL\fR\&. The statistics are presented in human\-readable form unless
\(lqJ\(rq
is specified as a character within the
\fIopts\fR
string, in which case the statistics are presented in
\m[blue]\fBJSON format\fR\m[]\&\s-2\u[2]\d\s+2\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying
\(lqg\(rq
as a character within the
\fIopts\fR \fIopts\fR
string\&. Note that string\&. Note that
\fBmalloc_message\fR\fB\fR malloc_message()
uses the uses the
\fBmallctl*\fR\fB\fR mallctl*()
functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If
\fB\-\-enable\-stats\fR \fB\-\-enable\-stats\fR
is specified during configuration, \(lqm\(rq and \(lqa\(rq can be specified to omit merged arena and per arena statistics, respectively; \(lqb\(rq, \(lql\(rq, and \(lqh\(rq can be specified to omit per size class statistics for bins, large objects, and huge objects, respectively\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. is specified during configuration,
\(lqm\(rq
and
\(lqa\(rq
can be specified to omit merged arena and per arena statistics, respectively;
\(lqb\(rq,
\(lql\(rq, and
\(lqh\(rq
can be specified to omit per size class statistics for bins, large objects, and huge objects, respectively\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&.
.PP .PP
The The
\fBmalloc_usable_size\fR\fB\fR malloc_usable_size()
function returns the usable size of the allocation pointed to by function returns the usable size of the allocation pointed to by
\fIptr\fR\&. The return value may be larger than the size that was requested during allocation\&. The \fIptr\fR\&. The return value may be larger than the size that was requested during allocation\&. The
\fBmalloc_usable_size\fR\fB\fR malloc_usable_size()
function is not a mechanism for in\-place function is not a mechanism for in\-place
\fBrealloc\fR\fB\fR; rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by realloc(); rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by
\fBmalloc_usable_size\fR\fB\fR malloc_usable_size()
should not be depended on, since such behavior is entirely implementation\-dependent\&. should not be depended on, since such behavior is entirely implementation\-dependent\&.
.SH "TUNING" .SH "TUNING"
.PP .PP
Once, when the first call is made to one of the memory allocation routines, the allocator initializes its internals based in part on various options that can be specified at compile\- or run\-time\&. Once, when the first call is made to one of the memory allocation routines, the allocator initializes its internals based in part on various options that can be specified at compile\- or run\-time\&.
.PP .PP
The string pointed to by the global variable The string specified via
\fImalloc_conf\fR, the \(lqname\(rq of the file referenced by the symbolic link named \fB\-\-with\-malloc\-conf\fR, the string pointed to by the global variable
\fImalloc_conf\fR, the
\(lqname\(rq
of the file referenced by the symbolic link named
/etc/malloc\&.conf, and the value of the environment variable /etc/malloc\&.conf, and the value of the environment variable
\fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. Note that \fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. Note that
\fImalloc_conf\fR \fImalloc_conf\fR
may be read before may be read before
\fBmain\fR\fB\fR main()
is entered, so the declaration of is entered, so the declaration of
\fImalloc_conf\fR \fImalloc_conf\fR
should specify an initializer that contains the final value to be read by jemalloc\&. should specify an initializer that contains the final value to be read by jemalloc\&.
\fB\-\-with\-malloc\-conf\fR
and
\fImalloc_conf\fR \fImalloc_conf\fR
is a compile\-time setting, whereas are compile\-time mechanisms, whereas
/etc/malloc\&.conf /etc/malloc\&.conf
and and
\fBMALLOC_CONF\fR \fBMALLOC_CONF\fR
can be safely set any time prior to program invocation\&. can be safely set any time prior to program invocation\&.
.PP .PP
An options string is a comma\-separated list of option:value pairs\&. There is one key corresponding to each An options string is a comma\-separated list of option:value pairs\&. There is one key corresponding to each
"opt\&.*" opt\&.*
mallctl (see the mallctl (see the
MALLCTL NAMESPACE MALLCTL NAMESPACE
section for options documentation)\&. For example, section for options documentation)\&. For example,
abort:true,narenas:1 abort:true,narenas:1
sets the sets the
"opt\&.abort" opt\&.abort
and and
"opt\&.narenas" opt\&.narenas
options\&. Some options have boolean values (true/false), others have integer values (base 8, 10, or 16, depending on prefix), and yet others have raw string values\&. options\&. Some options have boolean values (true/false), others have integer values (base 8, 10, or 16, depending on prefix), and yet others have raw string values\&.
.SH "IMPLEMENTATION NOTES" .SH "IMPLEMENTATION NOTES"
.PP .PP
...@@ -436,29 +460,26 @@ In addition to multiple arenas, unless ...@@ -436,29 +460,26 @@ In addition to multiple arenas, unless
\fB\-\-disable\-tcache\fR \fB\-\-disable\-tcache\fR
is specified during configuration, this allocator supports thread\-specific caching for small and large objects, in order to make it possible to completely avoid synchronization for most allocation requests\&. Such caching allows very fast allocation in the common case, but it increases memory usage and fragmentation, since a bounded number of objects can remain allocated in each thread cache\&. is specified during configuration, this allocator supports thread\-specific caching for small and large objects, in order to make it possible to completely avoid synchronization for most allocation requests\&. Such caching allows very fast allocation in the common case, but it increases memory usage and fragmentation, since a bounded number of objects can remain allocated in each thread cache\&.
.PP .PP
Memory is conceptually broken into equal\-sized chunks, where the chunk size is a power of two that is greater than the page size\&. Chunks are always aligned to multiples of the chunk size\&. This alignment makes it possible to find metadata for user objects very quickly\&. Memory is conceptually broken into equal\-sized chunks, where the chunk size is a power of two that is greater than the page size\&. Chunks are always aligned to multiples of the chunk size\&. This alignment makes it possible to find metadata for user objects very quickly\&. User objects are broken into three categories according to size: small, large, and huge\&. Multiple small and large objects can reside within a single chunk, whereas huge objects each have one or more chunks backing them\&. Each chunk that contains small and/or large objects tracks its contents as runs of contiguous pages (unused, backing a set of small objects, or backing one large object)\&. The combination of chunk alignment and chunk page maps makes it possible to determine all metadata regarding small and large allocations in constant time\&.
.PP
User objects are broken into three categories according to size: small, large, and huge\&. Small and large objects are managed entirely by arenas; huge objects are additionally aggregated in a single data structure that is shared by all threads\&. Huge objects are typically used by applications infrequently enough that this single data structure is not a scalability issue\&.
.PP
Each chunk that is managed by an arena tracks its contents as runs of contiguous pages (unused, backing a set of small objects, or backing one large object)\&. The combination of chunk alignment and chunk page maps makes it possible to determine all metadata regarding small and large allocations in constant time\&.
.PP .PP
Small objects are managed in groups by page runs\&. Each run maintains a bitmap to track which regions are in use\&. Allocation requests that are no more than half the quantum (8 or 16, depending on architecture) are rounded up to the nearest power of two that is at least Small objects are managed in groups by page runs\&. Each run maintains a bitmap to track which regions are in use\&. Allocation requests that are no more than half the quantum (8 or 16, depending on architecture) are rounded up to the nearest power of two that is at least
sizeof(\fBdouble\fR)\&. All other object size classes are multiples of the quantum, spaced such that there are four size classes for each doubling in size, which limits internal fragmentation to approximately 20% for all but the smallest size classes\&. Small size classes are smaller than four times the page size, large size classes are smaller than the chunk size (see the sizeof(\fBdouble\fR)\&. All other object size classes are multiples of the quantum, spaced such that there are four size classes for each doubling in size, which limits internal fragmentation to approximately 20% for all but the smallest size classes\&. Small size classes are smaller than four times the page size, large size classes are smaller than the chunk size (see the
"opt\&.lg_chunk" opt\&.lg_chunk
option), and huge size classes extend from the chunk size up to one size class less than the full address space size\&. option), and huge size classes extend from the chunk size up to the largest size class that does not exceed
\fBPTRDIFF_MAX\fR\&.
.PP .PP
Allocations are packed tightly together, which can be an issue for multi\-threaded applications\&. If you need to assure that allocations do not suffer from cacheline sharing, round your allocation requests up to the nearest multiple of the cacheline size, or specify cacheline alignment when allocating\&. Allocations are packed tightly together, which can be an issue for multi\-threaded applications\&. If you need to assure that allocations do not suffer from cacheline sharing, round your allocation requests up to the nearest multiple of the cacheline size, or specify cacheline alignment when allocating\&.
.PP .PP
The The
\fBrealloc\fR\fB\fR, realloc(),
\fBrallocx\fR\fB\fR, and rallocx(), and
\fBxallocx\fR\fB\fR xallocx()
functions may resize allocations without moving them under limited circumstances\&. Unlike the functions may resize allocations without moving them under limited circumstances\&. Unlike the
\fB*allocx\fR\fB\fR *allocx()
API, the standard API does not officially round up the usable size of an allocation to the nearest size class, so technically it is necessary to call API, the standard API does not officially round up the usable size of an allocation to the nearest size class, so technically it is necessary to call
\fBrealloc\fR\fB\fR realloc()
to grow e\&.g\&. a 9\-byte allocation to 16 bytes, or shrink a 16\-byte allocation to 9 bytes\&. Growth and shrinkage trivially succeeds in place as long as the pre\-size and post\-size both round up to the same size class\&. No other API guarantees are made regarding in\-place resizing, but the current implementation also tries to resize large and huge allocations in place, as long as the pre\-size and post\-size are both large or both huge\&. In such cases shrinkage always succeeds for large size classes, but for huge size classes the chunk allocator must support splitting (see to grow e\&.g\&. a 9\-byte allocation to 16 bytes, or shrink a 16\-byte allocation to 9 bytes\&. Growth and shrinkage trivially succeeds in place as long as the pre\-size and post\-size both round up to the same size class\&. No other API guarantees are made regarding in\-place resizing, but the current implementation also tries to resize large and huge allocations in place, as long as the pre\-size and post\-size are both large or both huge\&. In such cases shrinkage always succeeds for large size classes, but for huge size classes the chunk allocator must support splitting (see
"arena\&.<i>\&.chunk_hooks")\&. Growth only succeeds if the trailing memory is currently available, and additionally for huge size classes the chunk allocator must support merging\&. arena\&.<i>\&.chunk_hooks)\&. Growth only succeeds if the trailing memory is currently available, and additionally for huge size classes the chunk allocator must support merging\&.
.PP .PP
Assuming 2 MiB chunks, 4 KiB pages, and a 16\-byte quantum on a 64\-bit system, the size classes in each category are as shown in Assuming 2 MiB chunks, 4 KiB pages, and a 16\-byte quantum on a 64\-bit system, the size classes in each category are as shown in
Table 1\&. Table 1\&.
...@@ -502,6 +523,8 @@ l r l ...@@ -502,6 +523,8 @@ l r l
^ r l ^ r l
^ r l ^ r l
^ r l ^ r l
^ r l
^ r l
^ r l. ^ r l.
T{ T{
Small Small
...@@ -629,12 +652,22 @@ T} ...@@ -629,12 +652,22 @@ T}
T}:T{ T}:T{
\&.\&.\&. \&.\&.\&.
T} T}
:T{
512 PiB
T}:T{
[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]
T}
:T{
1 EiB
T}:T{
[5 EiB, 6 EiB, 7 EiB]
T}
.TE .TE
.sp 1 .sp 1
.SH "MALLCTL NAMESPACE" .SH "MALLCTL NAMESPACE"
.PP .PP
The following names are defined in the namespace accessible via the The following names are defined in the namespace accessible via the
\fBmallctl*\fR\fB\fR mallctl*()
functions\&. Value types are specified in parentheses, their readable/writable statuses are encoded as functions\&. Value types are specified in parentheses, their readable/writable statuses are encoded as
rw, rw,
r\-, r\-,
...@@ -644,111 +677,118 @@ r\-, ...@@ -644,111 +677,118 @@ r\-,
or or
<j> <j>
indicates an integer component, where the integer varies from 0 to some upper value that must be determined via introspection\&. In the case of indicates an integer component, where the integer varies from 0 to some upper value that must be determined via introspection\&. In the case of
"stats\&.arenas\&.<i>\&.*", stats\&.arenas\&.<i>\&.*,
<i> <i>
equal to equal to
"arenas\&.narenas" arenas\&.narenas
can be used to access the summation of statistics from all arenas\&. Take special note of the can be used to access the summation of statistics from all arenas\&. Take special note of the
"epoch" epoch
mallctl, which controls refreshing of cached dynamic statistics\&. mallctl, which controls refreshing of cached dynamic statistics\&.
.PP .PP
"version" (\fBconst char *\fR) r\- version (\fBconst char *\fR) r\-
.RS 4 .RS 4
Return the jemalloc version string\&. Return the jemalloc version string\&.
.RE .RE
.PP .PP
"epoch" (\fBuint64_t\fR) rw epoch (\fBuint64_t\fR) rw
.RS 4 .RS 4
If a value is passed in, refresh the data from which the If a value is passed in, refresh the data from which the
\fBmallctl*\fR\fB\fR mallctl*()
functions report values, and increment the epoch\&. Return the current epoch\&. This is useful for detecting whether another thread caused a refresh\&. functions report values, and increment the epoch\&. Return the current epoch\&. This is useful for detecting whether another thread caused a refresh\&.
.RE .RE
.PP .PP
"config\&.cache_oblivious" (\fBbool\fR) r\- config\&.cache_oblivious (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-cache\-oblivious\fR \fB\-\-enable\-cache\-oblivious\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.debug" (\fBbool\fR) r\- config\&.debug (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-debug\fR \fB\-\-enable\-debug\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.fill" (\fBbool\fR) r\- config\&.fill (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-fill\fR \fB\-\-enable\-fill\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.lazy_lock" (\fBbool\fR) r\- config\&.lazy_lock (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-lazy\-lock\fR \fB\-\-enable\-lazy\-lock\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.munmap" (\fBbool\fR) r\- config\&.malloc_conf (\fBconst char *\fR) r\-
.RS 4
Embedded configure\-time\-specified run\-time options string, empty unless
\fB\-\-with\-malloc\-conf\fR
was specified during build configuration\&.
.RE
.PP
config\&.munmap (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-munmap\fR \fB\-\-enable\-munmap\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.prof" (\fBbool\fR) r\- config\&.prof (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-prof\fR \fB\-\-enable\-prof\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.prof_libgcc" (\fBbool\fR) r\- config\&.prof_libgcc (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-disable\-prof\-libgcc\fR \fB\-\-disable\-prof\-libgcc\fR
was not specified during build configuration\&. was not specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.prof_libunwind" (\fBbool\fR) r\- config\&.prof_libunwind (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-prof\-libunwind\fR \fB\-\-enable\-prof\-libunwind\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.stats" (\fBbool\fR) r\- config\&.stats (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-stats\fR \fB\-\-enable\-stats\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.tcache" (\fBbool\fR) r\- config\&.tcache (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-disable\-tcache\fR \fB\-\-disable\-tcache\fR
was not specified during build configuration\&. was not specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.tls" (\fBbool\fR) r\- config\&.tls (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-disable\-tls\fR \fB\-\-disable\-tls\fR
was not specified during build configuration\&. was not specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.utrace" (\fBbool\fR) r\- config\&.utrace (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-utrace\fR \fB\-\-enable\-utrace\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.valgrind" (\fBbool\fR) r\- config\&.valgrind (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-valgrind\fR \fB\-\-enable\-valgrind\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"config\&.xmalloc" (\fBbool\fR) r\- config\&.xmalloc (\fBbool\fR) r\-
.RS 4 .RS 4
\fB\-\-enable\-xmalloc\fR \fB\-\-enable\-xmalloc\fR
was specified during build configuration\&. was specified during build configuration\&.
.RE .RE
.PP .PP
"opt\&.abort" (\fBbool\fR) r\- opt\&.abort (\fBbool\fR) r\-
.RS 4 .RS 4
Abort\-on\-warning enabled/disabled\&. If true, most warnings are fatal\&. The process will call Abort\-on\-warning enabled/disabled\&. If true, most warnings are fatal\&. The process will call
\fBabort\fR(3) \fBabort\fR(3)
...@@ -757,97 +797,132 @@ in these cases\&. This option is disabled by default unless ...@@ -757,97 +797,132 @@ in these cases\&. This option is disabled by default unless
is specified during configuration, in which case it is enabled by default\&. is specified during configuration, in which case it is enabled by default\&.
.RE .RE
.PP .PP
"opt\&.dss" (\fBconst char *\fR) r\- opt\&.dss (\fBconst char *\fR) r\-
.RS 4 .RS 4
dss (\fBsbrk\fR(2)) allocation precedence as related to dss (\fBsbrk\fR(2)) allocation precedence as related to
\fBmmap\fR(2) \fBmmap\fR(2)
allocation\&. The following settings are supported if allocation\&. The following settings are supported if
\fBsbrk\fR(2) \fBsbrk\fR(2)
is supported by the operating system: \(lqdisabled\(rq, \(lqprimary\(rq, and \(lqsecondary\(rq; otherwise only \(lqdisabled\(rq is supported\&. The default is \(lqsecondary\(rq if is supported by the operating system:
\(lqdisabled\(rq,
\(lqprimary\(rq, and
\(lqsecondary\(rq; otherwise only
\(lqdisabled\(rq
is supported\&. The default is
\(lqsecondary\(rq
if
\fBsbrk\fR(2) \fBsbrk\fR(2)
is supported by the operating system; \(lqdisabled\(rq otherwise\&. is supported by the operating system;
\(lqdisabled\(rq
otherwise\&.
.RE .RE
.PP .PP
"opt\&.lg_chunk" (\fBsize_t\fR) r\- opt\&.lg_chunk (\fBsize_t\fR) r\-
.RS 4 .RS 4
Virtual memory chunk size (log base 2)\&. If a chunk size outside the supported size range is specified, the size is silently clipped to the minimum/maximum supported size\&. The default chunk size is 2 MiB (2^21)\&. Virtual memory chunk size (log base 2)\&. If a chunk size outside the supported size range is specified, the size is silently clipped to the minimum/maximum supported size\&. The default chunk size is 2 MiB (2^21)\&.
.RE .RE
.PP .PP
"opt\&.narenas" (\fBsize_t\fR) r\- opt\&.narenas (\fBunsigned\fR) r\-
.RS 4 .RS 4
Maximum number of arenas to use for automatic multiplexing of threads and arenas\&. The default is four times the number of CPUs, or one if there is a single CPU\&. Maximum number of arenas to use for automatic multiplexing of threads and arenas\&. The default is four times the number of CPUs, or one if there is a single CPU\&.
.RE .RE
.PP .PP
"opt\&.lg_dirty_mult" (\fBssize_t\fR) r\- opt\&.purge (\fBconst char *\fR) r\-
.RS 4
Purge mode is \(lqratio\(rq (default) or \(lqdecay\(rq\&. See
opt\&.lg_dirty_mult
for details of the ratio mode\&. See
opt\&.decay_time
for details of the decay mode\&.
.RE
.PP
opt\&.lg_dirty_mult (\fBssize_t\fR) r\-
.RS 4 .RS 4
Per\-arena minimum ratio (log base 2) of active to dirty pages\&. Some dirty unused pages may be allowed to accumulate, within the limit set by the ratio (or one chunk worth of dirty pages, whichever is greater), before informing the kernel about some of those pages via Per\-arena minimum ratio (log base 2) of active to dirty pages\&. Some dirty unused pages may be allowed to accumulate, within the limit set by the ratio (or one chunk worth of dirty pages, whichever is greater), before informing the kernel about some of those pages via
\fBmadvise\fR(2) \fBmadvise\fR(2)
or a similar system call\&. This provides the kernel with sufficient information to recycle dirty pages if physical memory becomes scarce and the pages remain unused\&. The default minimum ratio is 8:1 (2^3:1); an option value of \-1 will disable dirty page purging\&. See or a similar system call\&. This provides the kernel with sufficient information to recycle dirty pages if physical memory becomes scarce and the pages remain unused\&. The default minimum ratio is 8:1 (2^3:1); an option value of \-1 will disable dirty page purging\&. See
"arenas\&.lg_dirty_mult" arenas\&.lg_dirty_mult
and and
"arena\&.<i>\&.lg_dirty_mult" arena\&.<i>\&.lg_dirty_mult
for related dynamic control options\&. for related dynamic control options\&.
.RE .RE
.PP .PP
"opt\&.stats_print" (\fBbool\fR) r\- opt\&.decay_time (\fBssize_t\fR) r\-
.RS 4
Approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. The pages are incrementally purged according to a sigmoidal decay curve that starts and ends with zero purge rate\&. A decay time of 0 causes all unused dirty pages to be purged immediately upon creation\&. A decay time of \-1 disables purging\&. The default decay time is 10 seconds\&. See
arenas\&.decay_time
and
arena\&.<i>\&.decay_time
for related dynamic control options\&.
.RE
.PP
opt\&.stats_print (\fBbool\fR) r\-
.RS 4 .RS 4
Enable/disable statistics printing at exit\&. If enabled, the Enable/disable statistics printing at exit\&. If enabled, the
\fBmalloc_stats_print\fR\fB\fR malloc_stats_print()
function is called at program exit via an function is called at program exit via an
\fBatexit\fR(3) \fBatexit\fR(3)
function\&. If function\&. If
\fB\-\-enable\-stats\fR \fB\-\-enable\-stats\fR
is specified during configuration, this has the potential to cause deadlock for a multi\-threaded process that exits while one or more threads are executing in the memory allocation functions\&. Furthermore, is specified during configuration, this has the potential to cause deadlock for a multi\-threaded process that exits while one or more threads are executing in the memory allocation functions\&. Furthermore,
\fBatexit\fR\fB\fR atexit()
may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls
\fBatexit\fR\fB\fR, so this option is not univerally usable (though the application can register its own atexit(), so this option is not universally usable (though the application can register its own
\fBatexit\fR\fB\fR atexit()
function with equivalent functionality)\&. Therefore, this option should only be used with care; it is primarily intended as a performance tuning aid during application development\&. This option is disabled by default\&. function with equivalent functionality)\&. Therefore, this option should only be used with care; it is primarily intended as a performance tuning aid during application development\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.junk" (\fBconst char *\fR) r\- [\fB\-\-enable\-fill\fR] opt\&.junk (\fBconst char *\fR) r\- [\fB\-\-enable\-fill\fR]
.RS 4 .RS 4
Junk filling\&. If set to "alloc", each byte of uninitialized allocated memory will be initialized to Junk filling\&. If set to
0xa5\&. If set to "free", all deallocated memory will be initialized to \(lqalloc\(rq, each byte of uninitialized allocated memory will be initialized to
0x5a\&. If set to "true", both allocated and deallocated memory will be initialized, and if set to "false", junk filling be disabled entirely\&. This is intended for debugging and will impact performance negatively\&. This option is "false" by default unless 0xa5\&. If set to
\(lqfree\(rq, all deallocated memory will be initialized to
0x5a\&. If set to
\(lqtrue\(rq, both allocated and deallocated memory will be initialized, and if set to
\(lqfalse\(rq, junk filling be disabled entirely\&. This is intended for debugging and will impact performance negatively\&. This option is
\(lqfalse\(rq
by default unless
\fB\-\-enable\-debug\fR \fB\-\-enable\-debug\fR
is specified during configuration, in which case it is "true" by default unless running inside is specified during configuration, in which case it is
\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2\&. \(lqtrue\(rq
by default unless running inside
\m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2\&.
.RE .RE
.PP .PP
"opt\&.quarantine" (\fBsize_t\fR) r\- [\fB\-\-enable\-fill\fR] opt\&.quarantine (\fBsize_t\fR) r\- [\fB\-\-enable\-fill\fR]
.RS 4 .RS 4
Per thread quarantine size in bytes\&. If non\-zero, each thread maintains a FIFO object quarantine that stores up to the specified number of bytes of memory\&. The quarantined memory is not freed until it is released from quarantine, though it is immediately junk\-filled if the Per thread quarantine size in bytes\&. If non\-zero, each thread maintains a FIFO object quarantine that stores up to the specified number of bytes of memory\&. The quarantined memory is not freed until it is released from quarantine, though it is immediately junk\-filled if the
"opt\&.junk" opt\&.junk
option is enabled\&. This feature is of particular use in combination with option is enabled\&. This feature is of particular use in combination with
\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, which can detect attempts to access quarantined objects\&. This is intended for debugging and will impact performance negatively\&. The default quarantine size is 0 unless running inside Valgrind, in which case the default is 16 MiB\&. \m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2, which can detect attempts to access quarantined objects\&. This is intended for debugging and will impact performance negatively\&. The default quarantine size is 0 unless running inside Valgrind, in which case the default is 16 MiB\&.
.RE .RE
.PP .PP
"opt\&.redzone" (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR] opt\&.redzone (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR]
.RS 4 .RS 4
Redzones enabled/disabled\&. If enabled, small allocations have redzones before and after them\&. Furthermore, if the Redzones enabled/disabled\&. If enabled, small allocations have redzones before and after them\&. Furthermore, if the
"opt\&.junk" opt\&.junk
option is enabled, the redzones are checked for corruption during deallocation\&. However, the primary intended purpose of this feature is to be used in combination with option is enabled, the redzones are checked for corruption during deallocation\&. However, the primary intended purpose of this feature is to be used in combination with
\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, which needs redzones in order to do effective buffer overflow/underflow detection\&. This option is intended for debugging and will impact performance negatively\&. This option is disabled by default unless running inside Valgrind\&. \m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2, which needs redzones in order to do effective buffer overflow/underflow detection\&. This option is intended for debugging and will impact performance negatively\&. This option is disabled by default unless running inside Valgrind\&.
.RE .RE
.PP .PP
"opt\&.zero" (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR] opt\&.zero (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR]
.RS 4 .RS 4
Zero filling enabled/disabled\&. If enabled, each byte of uninitialized allocated memory will be initialized to 0\&. Note that this initialization only happens once for each byte, so Zero filling enabled/disabled\&. If enabled, each byte of uninitialized allocated memory will be initialized to 0\&. Note that this initialization only happens once for each byte, so
\fBrealloc\fR\fB\fR realloc()
and and
\fBrallocx\fR\fB\fR rallocx()
calls do not zero memory that was previously allocated\&. This is intended for debugging and will impact performance negatively\&. This option is disabled by default\&. calls do not zero memory that was previously allocated\&. This is intended for debugging and will impact performance negatively\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.utrace" (\fBbool\fR) r\- [\fB\-\-enable\-utrace\fR] opt\&.utrace (\fBbool\fR) r\- [\fB\-\-enable\-utrace\fR]
.RS 4 .RS 4
Allocation tracing based on Allocation tracing based on
\fButrace\fR(2) \fButrace\fR(2)
enabled/disabled\&. This option is disabled by default\&. enabled/disabled\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.xmalloc" (\fBbool\fR) r\- [\fB\-\-enable\-xmalloc\fR] opt\&.xmalloc (\fBbool\fR) r\- [\fB\-\-enable\-xmalloc\fR]
.RS 4 .RS 4
Abort\-on\-out\-of\-memory enabled/disabled\&. If enabled, rather than returning failure for any allocation function, display a diagnostic message on Abort\-on\-out\-of\-memory enabled/disabled\&. If enabled, rather than returning failure for any allocation function, display a diagnostic message on
\fBSTDERR_FILENO\fR \fBSTDERR_FILENO\fR
...@@ -867,92 +942,94 @@ malloc_conf = "xmalloc:true"; ...@@ -867,92 +942,94 @@ malloc_conf = "xmalloc:true";
This option is disabled by default\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.tcache" (\fBbool\fR) r\- [\fB\-\-enable\-tcache\fR] opt\&.tcache (\fBbool\fR) r\- [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Thread\-specific caching (tcache) enabled/disabled\&. When there are multiple threads, each thread uses a tcache for objects up to a certain size\&. Thread\-specific caching allows many allocations to be satisfied without performing any thread synchronization, at the cost of increased memory use\&. See the Thread\-specific caching (tcache) enabled/disabled\&. When there are multiple threads, each thread uses a tcache for objects up to a certain size\&. Thread\-specific caching allows many allocations to be satisfied without performing any thread synchronization, at the cost of increased memory use\&. See the
"opt\&.lg_tcache_max" opt\&.lg_tcache_max
option for related tuning information\&. This option is enabled by default unless running inside option for related tuning information\&. This option is enabled by default unless running inside
\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, in which case it is forcefully disabled\&. \m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2, in which case it is forcefully disabled\&.
.RE .RE
.PP .PP
"opt\&.lg_tcache_max" (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR] opt\&.lg_tcache_max (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Maximum size class (log base 2) to cache in the thread\-specific cache (tcache)\&. At a minimum, all small size classes are cached, and at a maximum all large size classes are cached\&. The default maximum is 32 KiB (2^15)\&. Maximum size class (log base 2) to cache in the thread\-specific cache (tcache)\&. At a minimum, all small size classes are cached, and at a maximum all large size classes are cached\&. The default maximum is 32 KiB (2^15)\&.
.RE .RE
.PP .PP
"opt\&.prof" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Memory profiling enabled/disabled\&. If enabled, profile memory allocation activity\&. See the Memory profiling enabled/disabled\&. If enabled, profile memory allocation activity\&. See the
"opt\&.prof_active" opt\&.prof_active
option for on\-the\-fly activation/deactivation\&. See the option for on\-the\-fly activation/deactivation\&. See the
"opt\&.lg_prof_sample" opt\&.lg_prof_sample
option for probabilistic sampling control\&. See the option for probabilistic sampling control\&. See the
"opt\&.prof_accum" opt\&.prof_accum
option for control of cumulative sample reporting\&. See the option for control of cumulative sample reporting\&. See the
"opt\&.lg_prof_interval" opt\&.lg_prof_interval
option for information on interval\-triggered profile dumping, the option for information on interval\-triggered profile dumping, the
"opt\&.prof_gdump" opt\&.prof_gdump
option for information on high\-water\-triggered profile dumping, and the option for information on high\-water\-triggered profile dumping, and the
"opt\&.prof_final" opt\&.prof_final
option for final profile dumping\&. Profile output is compatible with the option for final profile dumping\&. Profile output is compatible with the
\fBjeprof\fR \fBjeprof\fR
command, which is based on the command, which is based on the
\fBpprof\fR \fBpprof\fR
that is developed as part of the that is developed as part of the
\m[blue]\fBgperftools package\fR\m[]\&\s-2\u[3]\d\s+2\&. \m[blue]\fBgperftools package\fR\m[]\&\s-2\u[4]\d\s+2\&. See
HEAP PROFILE FORMAT
for heap profile format documentation\&.
.RE .RE
.PP .PP
"opt\&.prof_prefix" (\fBconst char *\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_prefix (\fBconst char *\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Filename prefix for profile dumps\&. If the prefix is set to the empty string, no automatic dumps will occur; this is primarily useful for disabling the automatic final heap dump (which also disables leak reporting, if enabled)\&. The default prefix is Filename prefix for profile dumps\&. If the prefix is set to the empty string, no automatic dumps will occur; this is primarily useful for disabling the automatic final heap dump (which also disables leak reporting, if enabled)\&. The default prefix is
jeprof\&. jeprof\&.
.RE .RE
.PP .PP
"opt\&.prof_active" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_active (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Profiling activated/deactivated\&. This is a secondary control mechanism that makes it possible to start the application with profiling enabled (see the Profiling activated/deactivated\&. This is a secondary control mechanism that makes it possible to start the application with profiling enabled (see the
"opt\&.prof" opt\&.prof
option) but inactive, then toggle profiling at any time during program execution with the option) but inactive, then toggle profiling at any time during program execution with the
"prof\&.active" prof\&.active
mallctl\&. This option is enabled by default\&. mallctl\&. This option is enabled by default\&.
.RE .RE
.PP .PP
"opt\&.prof_thread_active_init" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_thread_active_init (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Initial setting for Initial setting for
"thread\&.prof\&.active" thread\&.prof\&.active
in newly created threads\&. The initial setting for newly created threads can also be changed during execution via the in newly created threads\&. The initial setting for newly created threads can also be changed during execution via the
"prof\&.thread_active_init" prof\&.thread_active_init
mallctl\&. This option is enabled by default\&. mallctl\&. This option is enabled by default\&.
.RE .RE
.PP .PP
"opt\&.lg_prof_sample" (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.lg_prof_sample (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Average interval (log base 2) between allocation samples, as measured in bytes of allocation activity\&. Increasing the sampling interval decreases profile fidelity, but also decreases the computational overhead\&. The default sample interval is 512 KiB (2^19 B)\&. Average interval (log base 2) between allocation samples, as measured in bytes of allocation activity\&. Increasing the sampling interval decreases profile fidelity, but also decreases the computational overhead\&. The default sample interval is 512 KiB (2^19 B)\&.
.RE .RE
.PP .PP
"opt\&.prof_accum" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_accum (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Reporting of cumulative object/byte counts in profile dumps enabled/disabled\&. If this option is enabled, every unique backtrace must be stored for the duration of execution\&. Depending on the application, this can impose a large memory overhead, and the cumulative counts are not always of interest\&. This option is disabled by default\&. Reporting of cumulative object/byte counts in profile dumps enabled/disabled\&. If this option is enabled, every unique backtrace must be stored for the duration of execution\&. Depending on the application, this can impose a large memory overhead, and the cumulative counts are not always of interest\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.lg_prof_interval" (\fBssize_t\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.lg_prof_interval (\fBssize_t\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Average interval (log base 2) between memory profile dumps, as measured in bytes of allocation activity\&. The actual interval between dumps may be sporadic because decentralized allocation counters are used to avoid synchronization bottlenecks\&. Profiles are dumped to files named according to the pattern Average interval (log base 2) between memory profile dumps, as measured in bytes of allocation activity\&. The actual interval between dumps may be sporadic because decentralized allocation counters are used to avoid synchronization bottlenecks\&. Profiles are dumped to files named according to the pattern
<prefix>\&.<pid>\&.<seq>\&.i<iseq>\&.heap, where <prefix>\&.<pid>\&.<seq>\&.i<iseq>\&.heap, where
<prefix> <prefix>
is controlled by the is controlled by the
"opt\&.prof_prefix" opt\&.prof_prefix
option\&. By default, interval\-triggered profile dumping is disabled (encoded as \-1)\&. option\&. By default, interval\-triggered profile dumping is disabled (encoded as \-1)\&.
.RE .RE
.PP .PP
"opt\&.prof_gdump" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_gdump (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Set the initial state of Set the initial state of
"prof\&.gdump", which when enabled triggers a memory profile dump every time the total virtual memory exceeds the previous maximum\&. This option is disabled by default\&. prof\&.gdump, which when enabled triggers a memory profile dump every time the total virtual memory exceeds the previous maximum\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.prof_final" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_final (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Use an Use an
\fBatexit\fR(3) \fBatexit\fR(3)
...@@ -960,127 +1037,150 @@ function to dump final memory usage to a file named according to the pattern ...@@ -960,127 +1037,150 @@ function to dump final memory usage to a file named according to the pattern
<prefix>\&.<pid>\&.<seq>\&.f\&.heap, where <prefix>\&.<pid>\&.<seq>\&.f\&.heap, where
<prefix> <prefix>
is controlled by the is controlled by the
"opt\&.prof_prefix" opt\&.prof_prefix
option\&. Note that option\&. Note that
\fBatexit\fR\fB\fR atexit()
may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls
\fBatexit\fR\fB\fR, so this option is not univerally usable (though the application can register its own atexit(), so this option is not universally usable (though the application can register its own
\fBatexit\fR\fB\fR atexit()
function with equivalent functionality)\&. This option is disabled by default\&. function with equivalent functionality)\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"opt\&.prof_leak" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] opt\&.prof_leak (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Leak reporting enabled/disabled\&. If enabled, use an Leak reporting enabled/disabled\&. If enabled, use an
\fBatexit\fR(3) \fBatexit\fR(3)
function to report memory leaks detected by allocation sampling\&. See the function to report memory leaks detected by allocation sampling\&. See the
"opt\&.prof" opt\&.prof
option for information on analyzing heap profile output\&. This option is disabled by default\&. option for information on analyzing heap profile output\&. This option is disabled by default\&.
.RE .RE
.PP .PP
"thread\&.arena" (\fBunsigned\fR) rw thread\&.arena (\fBunsigned\fR) rw
.RS 4 .RS 4
Get or set the arena associated with the calling thread\&. If the specified arena was not initialized beforehand (see the Get or set the arena associated with the calling thread\&. If the specified arena was not initialized beforehand (see the
"arenas\&.initialized" arenas\&.initialized
mallctl), it will be automatically initialized as a side effect of calling this interface\&. mallctl), it will be automatically initialized as a side effect of calling this interface\&.
.RE .RE
.PP .PP
"thread\&.allocated" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] thread\&.allocated (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Get the total number of bytes ever allocated by the calling thread\&. This counter has the potential to wrap around; it is up to the application to appropriately interpret the counter in such cases\&. Get the total number of bytes ever allocated by the calling thread\&. This counter has the potential to wrap around; it is up to the application to appropriately interpret the counter in such cases\&.
.RE .RE
.PP .PP
"thread\&.allocatedp" (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR] thread\&.allocatedp (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Get a pointer to the the value that is returned by the Get a pointer to the the value that is returned by the
"thread\&.allocated" thread\&.allocated
mallctl\&. This is useful for avoiding the overhead of repeated mallctl\&. This is useful for avoiding the overhead of repeated
\fBmallctl*\fR\fB\fR mallctl*()
calls\&. calls\&.
.RE .RE
.PP .PP
"thread\&.deallocated" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] thread\&.deallocated (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Get the total number of bytes ever deallocated by the calling thread\&. This counter has the potential to wrap around; it is up to the application to appropriately interpret the counter in such cases\&. Get the total number of bytes ever deallocated by the calling thread\&. This counter has the potential to wrap around; it is up to the application to appropriately interpret the counter in such cases\&.
.RE .RE
.PP .PP
"thread\&.deallocatedp" (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR] thread\&.deallocatedp (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Get a pointer to the the value that is returned by the Get a pointer to the the value that is returned by the
"thread\&.deallocated" thread\&.deallocated
mallctl\&. This is useful for avoiding the overhead of repeated mallctl\&. This is useful for avoiding the overhead of repeated
\fBmallctl*\fR\fB\fR mallctl*()
calls\&. calls\&.
.RE .RE
.PP .PP
"thread\&.tcache\&.enabled" (\fBbool\fR) rw [\fB\-\-enable\-tcache\fR] thread\&.tcache\&.enabled (\fBbool\fR) rw [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Enable/disable calling thread\*(Aqs tcache\&. The tcache is implicitly flushed as a side effect of becoming disabled (see Enable/disable calling thread\*(Aqs tcache\&. The tcache is implicitly flushed as a side effect of becoming disabled (see
"thread\&.tcache\&.flush")\&. thread\&.tcache\&.flush)\&.
.RE .RE
.PP .PP
"thread\&.tcache\&.flush" (\fBvoid\fR) \-\- [\fB\-\-enable\-tcache\fR] thread\&.tcache\&.flush (\fBvoid\fR) \-\- [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Flush calling thread\*(Aqs thread\-specific cache (tcache)\&. This interface releases all cached objects and internal data structures associated with the calling thread\*(Aqs tcache\&. Ordinarily, this interface need not be called, since automatic periodic incremental garbage collection occurs, and the thread cache is automatically discarded when a thread exits\&. However, garbage collection is triggered by allocation activity, so it is possible for a thread that stops allocating/deallocating to retain its cache indefinitely, in which case the developer may find manual flushing useful\&. Flush calling thread\*(Aqs thread\-specific cache (tcache)\&. This interface releases all cached objects and internal data structures associated with the calling thread\*(Aqs tcache\&. Ordinarily, this interface need not be called, since automatic periodic incremental garbage collection occurs, and the thread cache is automatically discarded when a thread exits\&. However, garbage collection is triggered by allocation activity, so it is possible for a thread that stops allocating/deallocating to retain its cache indefinitely, in which case the developer may find manual flushing useful\&.
.RE .RE
.PP .PP
"thread\&.prof\&.name" (\fBconst char *\fR) r\- or \-w [\fB\-\-enable\-prof\fR] thread\&.prof\&.name (\fBconst char *\fR) r\- or \-w [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Get/set the descriptive name associated with the calling thread in memory profile dumps\&. An internal copy of the name string is created, so the input string need not be maintained after this interface completes execution\&. The output string of this interface should be copied for non\-ephemeral uses, because multiple implementation details can cause asynchronous string deallocation\&. Furthermore, each invocation of this interface can only read or write; simultaneous read/write is not supported due to string lifetime limitations\&. The name string must nil\-terminated and comprised only of characters in the sets recognized by Get/set the descriptive name associated with the calling thread in memory profile dumps\&. An internal copy of the name string is created, so the input string need not be maintained after this interface completes execution\&. The output string of this interface should be copied for non\-ephemeral uses, because multiple implementation details can cause asynchronous string deallocation\&. Furthermore, each invocation of this interface can only read or write; simultaneous read/write is not supported due to string lifetime limitations\&. The name string must be nil\-terminated and comprised only of characters in the sets recognized by
\fBisgraph\fR(3) \fBisgraph\fR(3)
and and
\fBisblank\fR(3)\&. \fBisblank\fR(3)\&.
.RE .RE
.PP .PP
"thread\&.prof\&.active" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR] thread\&.prof\&.active (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Control whether sampling is currently active for the calling thread\&. This is an activation mechanism in addition to Control whether sampling is currently active for the calling thread\&. This is an activation mechanism in addition to
"prof\&.active"; both must be active for the calling thread to sample\&. This flag is enabled by default\&. prof\&.active; both must be active for the calling thread to sample\&. This flag is enabled by default\&.
.RE .RE
.PP .PP
"tcache\&.create" (\fBunsigned\fR) r\- [\fB\-\-enable\-tcache\fR] tcache\&.create (\fBunsigned\fR) r\- [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Create an explicit thread\-specific cache (tcache) and return an identifier that can be passed to the Create an explicit thread\-specific cache (tcache) and return an identifier that can be passed to the
\fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR
macro to explicitly use the specified cache rather than the automatically managed one that is used by default\&. Each explicit cache can be used by only one thread at a time; the application must assure that this constraint holds\&. macro to explicitly use the specified cache rather than the automatically managed one that is used by default\&. Each explicit cache can be used by only one thread at a time; the application must assure that this constraint holds\&.
.RE .RE
.PP .PP
"tcache\&.flush" (\fBunsigned\fR) \-w [\fB\-\-enable\-tcache\fR] tcache\&.flush (\fBunsigned\fR) \-w [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Flush the specified thread\-specific cache (tcache)\&. The same considerations apply to this interface as to Flush the specified thread\-specific cache (tcache)\&. The same considerations apply to this interface as to
"thread\&.tcache\&.flush", except that the tcache will never be automatically be discarded\&. thread\&.tcache\&.flush, except that the tcache will never be automatically discarded\&.
.RE .RE
.PP .PP
"tcache\&.destroy" (\fBunsigned\fR) \-w [\fB\-\-enable\-tcache\fR] tcache\&.destroy (\fBunsigned\fR) \-w [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Flush the specified thread\-specific cache (tcache) and make the identifier available for use during a future tcache creation\&. Flush the specified thread\-specific cache (tcache) and make the identifier available for use during a future tcache creation\&.
.RE .RE
.PP .PP
"arena\&.<i>\&.purge" (\fBvoid\fR) \-\- arena\&.<i>\&.purge (\fBvoid\fR) \-\-
.RS 4 .RS 4
Purge unused dirty pages for arena <i>, or for all arenas if <i> equals Purge all unused dirty pages for arena <i>, or for all arenas if <i> equals
"arenas\&.narenas"\&. arenas\&.narenas\&.
.RE
.PP
arena\&.<i>\&.decay (\fBvoid\fR) \-\-
.RS 4
Trigger decay\-based purging of unused dirty pages for arena <i>, or for all arenas if <i> equals
arenas\&.narenas\&. The proportion of unused dirty pages to be purged depends on the current time; see
opt\&.decay_time
for details\&.
.RE .RE
.PP .PP
"arena\&.<i>\&.dss" (\fBconst char *\fR) rw arena\&.<i>\&.reset (\fBvoid\fR) \-\-
.RS 4
Discard all of the arena\*(Aqs extant allocations\&. This interface can only be used with arenas created via
arenas\&.extend\&. None of the arena\*(Aqs discarded/cached allocations may accessed afterward\&. As part of this requirement, all thread caches which were used to allocate/deallocate in conjunction with the arena must be flushed beforehand\&. This interface cannot be used if running inside Valgrind, nor if the
quarantine
size is non\-zero\&.
.RE
.PP
arena\&.<i>\&.dss (\fBconst char *\fR) rw
.RS 4 .RS 4
Set the precedence of dss allocation as related to mmap allocation for arena <i>, or for all arenas if <i> equals Set the precedence of dss allocation as related to mmap allocation for arena <i>, or for all arenas if <i> equals
"arenas\&.narenas"\&. See arenas\&.narenas\&. See
"opt\&.dss" opt\&.dss
for supported settings\&. for supported settings\&.
.RE .RE
.PP .PP
"arena\&.<i>\&.lg_dirty_mult" (\fBssize_t\fR) rw arena\&.<i>\&.lg_dirty_mult (\fBssize_t\fR) rw
.RS 4 .RS 4
Current per\-arena minimum ratio (log base 2) of active to dirty pages for arena <i>\&. Each time this interface is set and the ratio is increased, pages are synchronously purged as necessary to impose the new ratio\&. See Current per\-arena minimum ratio (log base 2) of active to dirty pages for arena <i>\&. Each time this interface is set and the ratio is increased, pages are synchronously purged as necessary to impose the new ratio\&. See
"opt\&.lg_dirty_mult" opt\&.lg_dirty_mult
for additional information\&.
.RE
.PP
arena\&.<i>\&.decay_time (\fBssize_t\fR) rw
.RS 4
Current per\-arena approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. Each time this interface is set, all currently unused dirty pages are considered to have fully decayed, which causes immediate purging of all unused dirty pages unless the decay time is set to \-1 (i\&.e\&. purging disabled)\&. See
opt\&.decay_time
for additional information\&. for additional information\&.
.RE .RE
.PP .PP
"arena\&.<i>\&.chunk_hooks" (\fBchunk_hooks_t\fR) rw arena\&.<i>\&.chunk_hooks (\fBchunk_hooks_t\fR) rw
.RS 4 .RS 4
Get or set the chunk management hook functions for arena <i>\&. The functions must be capable of operating on all extant chunks associated with arena <i>, usually by passing unknown chunks to the replaced functions\&. In practice, it is feasible to control allocation for arenas created via Get or set the chunk management hook functions for arena <i>\&. The functions must be capable of operating on all extant chunks associated with arena <i>, usually by passing unknown chunks to the replaced functions\&. In practice, it is feasible to control allocation for arenas created via
"arenas\&.extend" arenas\&.extend
such that all chunks originate from an application\-supplied chunk allocator (by setting custom chunk hook functions just after arena creation), but the automatically created arenas may have already created chunks prior to the application having an opportunity to take over chunk allocation\&. such that all chunks originate from an application\-supplied chunk allocator (by setting custom chunk hook functions just after arena creation), but the automatically created arenas may have already created chunks prior to the application having an opportunity to take over chunk allocation\&.
.sp .sp
.if n \{\ .if n \{\
...@@ -1149,7 +1249,7 @@ is not ...@@ -1149,7 +1249,7 @@ is not
on success or on success or
\fBNULL\fR \fBNULL\fR
on error\&. Committed memory may be committed in absolute terms as on a system that does not overcommit, or in implicit terms as on a system that overcommits and satisfies physical memory needs on demand via soft page faults\&. Note that replacing the default chunk allocation function makes the arena\*(Aqs on error\&. Committed memory may be committed in absolute terms as on a system that does not overcommit, or in implicit terms as on a system that overcommits and satisfies physical memory needs on demand via soft page faults\&. Note that replacing the default chunk allocation function makes the arena\*(Aqs
"arena\&.<i>\&.dss" arena\&.<i>\&.dss
setting irrelevant\&. setting irrelevant\&.
.HP \w'typedef\ bool\ (chunk_dalloc_t)('u .HP \w'typedef\ bool\ (chunk_dalloc_t)('u
.BI "typedef bool (chunk_dalloc_t)(void\ *" "chunk" ", size_t\ " "size" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");" .BI "typedef bool (chunk_dalloc_t)(void\ *" "chunk" ", size_t\ " "size" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
...@@ -1296,407 +1396,504 @@ into one contiguous chunk, operating on ...@@ -1296,407 +1396,504 @@ into one contiguous chunk, operating on
\fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates that the chunks remain distinct mappings and therefore should continue to be operated on independently\&. \fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates that the chunks remain distinct mappings and therefore should continue to be operated on independently\&.
.RE .RE
.PP .PP
"arenas\&.narenas" (\fBunsigned\fR) r\- arenas\&.narenas (\fBunsigned\fR) r\-
.RS 4 .RS 4
Current limit on number of arenas\&. Current limit on number of arenas\&.
.RE .RE
.PP .PP
"arenas\&.initialized" (\fBbool *\fR) r\- arenas\&.initialized (\fBbool *\fR) r\-
.RS 4 .RS 4
An array of An array of
"arenas\&.narenas" arenas\&.narenas
booleans\&. Each boolean indicates whether the corresponding arena is initialized\&. booleans\&. Each boolean indicates whether the corresponding arena is initialized\&.
.RE .RE
.PP .PP
"arenas\&.lg_dirty_mult" (\fBssize_t\fR) rw arenas\&.lg_dirty_mult (\fBssize_t\fR) rw
.RS 4 .RS 4
Current default per\-arena minimum ratio (log base 2) of active to dirty pages, used to initialize Current default per\-arena minimum ratio (log base 2) of active to dirty pages, used to initialize
"arena\&.<i>\&.lg_dirty_mult" arena\&.<i>\&.lg_dirty_mult
during arena creation\&. See during arena creation\&. See
"opt\&.lg_dirty_mult" opt\&.lg_dirty_mult
for additional information\&. for additional information\&.
.RE .RE
.PP .PP
"arenas\&.quantum" (\fBsize_t\fR) r\- arenas\&.decay_time (\fBssize_t\fR) rw
.RS 4
Current default per\-arena approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused, used to initialize
arena\&.<i>\&.decay_time
during arena creation\&. See
opt\&.decay_time
for additional information\&.
.RE
.PP
arenas\&.quantum (\fBsize_t\fR) r\-
.RS 4 .RS 4
Quantum size\&. Quantum size\&.
.RE .RE
.PP .PP
"arenas\&.page" (\fBsize_t\fR) r\- arenas\&.page (\fBsize_t\fR) r\-
.RS 4 .RS 4
Page size\&. Page size\&.
.RE .RE
.PP .PP
"arenas\&.tcache_max" (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR] arenas\&.tcache_max (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Maximum thread\-cached size class\&. Maximum thread\-cached size class\&.
.RE .RE
.PP .PP
"arenas\&.nbins" (\fBunsigned\fR) r\- arenas\&.nbins (\fBunsigned\fR) r\-
.RS 4 .RS 4
Number of bin size classes\&. Number of bin size classes\&.
.RE .RE
.PP .PP
"arenas\&.nhbins" (\fBunsigned\fR) r\- [\fB\-\-enable\-tcache\fR] arenas\&.nhbins (\fBunsigned\fR) r\- [\fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Total number of thread cache bin size classes\&. Total number of thread cache bin size classes\&.
.RE .RE
.PP .PP
"arenas\&.bin\&.<i>\&.size" (\fBsize_t\fR) r\- arenas\&.bin\&.<i>\&.size (\fBsize_t\fR) r\-
.RS 4 .RS 4
Maximum size supported by size class\&. Maximum size supported by size class\&.
.RE .RE
.PP .PP
"arenas\&.bin\&.<i>\&.nregs" (\fBuint32_t\fR) r\- arenas\&.bin\&.<i>\&.nregs (\fBuint32_t\fR) r\-
.RS 4 .RS 4
Number of regions per page run\&. Number of regions per page run\&.
.RE .RE
.PP .PP
"arenas\&.bin\&.<i>\&.run_size" (\fBsize_t\fR) r\- arenas\&.bin\&.<i>\&.run_size (\fBsize_t\fR) r\-
.RS 4 .RS 4
Number of bytes per page run\&. Number of bytes per page run\&.
.RE .RE
.PP .PP
"arenas\&.nlruns" (\fBunsigned\fR) r\- arenas\&.nlruns (\fBunsigned\fR) r\-
.RS 4 .RS 4
Total number of large size classes\&. Total number of large size classes\&.
.RE .RE
.PP .PP
"arenas\&.lrun\&.<i>\&.size" (\fBsize_t\fR) r\- arenas\&.lrun\&.<i>\&.size (\fBsize_t\fR) r\-
.RS 4 .RS 4
Maximum size supported by this large size class\&. Maximum size supported by this large size class\&.
.RE .RE
.PP .PP
"arenas\&.nhchunks" (\fBunsigned\fR) r\- arenas\&.nhchunks (\fBunsigned\fR) r\-
.RS 4 .RS 4
Total number of huge size classes\&. Total number of huge size classes\&.
.RE .RE
.PP .PP
"arenas\&.hchunk\&.<i>\&.size" (\fBsize_t\fR) r\- arenas\&.hchunk\&.<i>\&.size (\fBsize_t\fR) r\-
.RS 4 .RS 4
Maximum size supported by this huge size class\&. Maximum size supported by this huge size class\&.
.RE .RE
.PP .PP
"arenas\&.extend" (\fBunsigned\fR) r\- arenas\&.extend (\fBunsigned\fR) r\-
.RS 4 .RS 4
Extend the array of arenas by appending a new arena, and returning the new arena index\&. Extend the array of arenas by appending a new arena, and returning the new arena index\&.
.RE .RE
.PP .PP
"prof\&.thread_active_init" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR] prof\&.thread_active_init (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Control the initial setting for Control the initial setting for
"thread\&.prof\&.active" thread\&.prof\&.active
in newly created threads\&. See the in newly created threads\&. See the
"opt\&.prof_thread_active_init" opt\&.prof_thread_active_init
option for additional information\&. option for additional information\&.
.RE .RE
.PP .PP
"prof\&.active" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR] prof\&.active (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Control whether sampling is currently active\&. See the Control whether sampling is currently active\&. See the
"opt\&.prof_active" opt\&.prof_active
option for additional information, as well as the interrelated option for additional information, as well as the interrelated
"thread\&.prof\&.active" thread\&.prof\&.active
mallctl\&. mallctl\&.
.RE .RE
.PP .PP
"prof\&.dump" (\fBconst char *\fR) \-w [\fB\-\-enable\-prof\fR] prof\&.dump (\fBconst char *\fR) \-w [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Dump a memory profile to the specified file, or if NULL is specified, to a file according to the pattern Dump a memory profile to the specified file, or if NULL is specified, to a file according to the pattern
<prefix>\&.<pid>\&.<seq>\&.m<mseq>\&.heap, where <prefix>\&.<pid>\&.<seq>\&.m<mseq>\&.heap, where
<prefix> <prefix>
is controlled by the is controlled by the
"opt\&.prof_prefix" opt\&.prof_prefix
option\&. option\&.
.RE .RE
.PP .PP
"prof\&.gdump" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR] prof\&.gdump (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
When enabled, trigger a memory profile dump every time the total virtual memory exceeds the previous maximum\&. Profiles are dumped to files named according to the pattern When enabled, trigger a memory profile dump every time the total virtual memory exceeds the previous maximum\&. Profiles are dumped to files named according to the pattern
<prefix>\&.<pid>\&.<seq>\&.u<useq>\&.heap, where <prefix>\&.<pid>\&.<seq>\&.u<useq>\&.heap, where
<prefix> <prefix>
is controlled by the is controlled by the
"opt\&.prof_prefix" opt\&.prof_prefix
option\&. option\&.
.RE .RE
.PP .PP
"prof\&.reset" (\fBsize_t\fR) \-w [\fB\-\-enable\-prof\fR] prof\&.reset (\fBsize_t\fR) \-w [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Reset all memory profile statistics, and optionally update the sample rate (see Reset all memory profile statistics, and optionally update the sample rate (see
"opt\&.lg_prof_sample" opt\&.lg_prof_sample
and and
"prof\&.lg_sample")\&. prof\&.lg_sample)\&.
.RE .RE
.PP .PP
"prof\&.lg_sample" (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR] prof\&.lg_sample (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Get the current sample rate (see Get the current sample rate (see
"opt\&.lg_prof_sample")\&. opt\&.lg_prof_sample)\&.
.RE .RE
.PP .PP
"prof\&.interval" (\fBuint64_t\fR) r\- [\fB\-\-enable\-prof\fR] prof\&.interval (\fBuint64_t\fR) r\- [\fB\-\-enable\-prof\fR]
.RS 4 .RS 4
Average number of bytes allocated between inverval\-based profile dumps\&. See the Average number of bytes allocated between interval\-based profile dumps\&. See the
"opt\&.lg_prof_interval" opt\&.lg_prof_interval
option for additional information\&. option for additional information\&.
.RE .RE
.PP .PP
"stats\&.cactive" (\fBsize_t *\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.cactive (\fBsize_t *\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Pointer to a counter that contains an approximate count of the current number of bytes in active pages\&. The estimate may be high, but never low, because each arena rounds up when computing its contribution to the counter\&. Note that the Pointer to a counter that contains an approximate count of the current number of bytes in active pages\&. The estimate may be high, but never low, because each arena rounds up when computing its contribution to the counter\&. Note that the
"epoch" epoch
mallctl has no bearing on this counter\&. Furthermore, counter consistency is maintained via atomic operations, so it is necessary to use an atomic operation in order to guarantee a consistent read when dereferencing the pointer\&. mallctl has no bearing on this counter\&. Furthermore, counter consistency is maintained via atomic operations, so it is necessary to use an atomic operation in order to guarantee a consistent read when dereferencing the pointer\&.
.RE .RE
.PP .PP
"stats\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Total number of bytes allocated by the application\&. Total number of bytes allocated by the application\&.
.RE .RE
.PP .PP
"stats\&.active" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.active (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Total number of bytes in active pages allocated by the application\&. This is a multiple of the page size, and greater than or equal to Total number of bytes in active pages allocated by the application\&. This is a multiple of the page size, and greater than or equal to
"stats\&.allocated"\&. This does not include stats\&.allocated\&. This does not include
"stats\&.arenas\&.<i>\&.pdirty", nor pages entirely devoted to allocator metadata\&. stats\&.arenas\&.<i>\&.pdirty, nor pages entirely devoted to allocator metadata\&.
.RE .RE
.PP .PP
"stats\&.metadata" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.metadata (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Total number of bytes dedicated to metadata, which comprise base allocations used for bootstrap\-sensitive internal allocator data structures, arena chunk headers (see Total number of bytes dedicated to metadata, which comprise base allocations used for bootstrap\-sensitive internal allocator data structures, arena chunk headers (see
"stats\&.arenas\&.<i>\&.metadata\&.mapped"), and internal allocations (see stats\&.arenas\&.<i>\&.metadata\&.mapped), and internal allocations (see
"stats\&.arenas\&.<i>\&.metadata\&.allocated")\&. stats\&.arenas\&.<i>\&.metadata\&.allocated)\&.
.RE .RE
.PP .PP
"stats\&.resident" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.resident (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Maximum number of bytes in physically resident data pages mapped by the allocator, comprising all pages dedicated to allocator metadata, pages backing active allocations, and unused dirty pages\&. This is a maximum rather than precise because pages may not actually be physically resident if they correspond to demand\-zeroed virtual memory that has not yet been touched\&. This is a multiple of the page size, and is larger than Maximum number of bytes in physically resident data pages mapped by the allocator, comprising all pages dedicated to allocator metadata, pages backing active allocations, and unused dirty pages\&. This is a maximum rather than precise because pages may not actually be physically resident if they correspond to demand\-zeroed virtual memory that has not yet been touched\&. This is a multiple of the page size, and is larger than
"stats\&.active"\&. stats\&.active\&.
.RE .RE
.PP .PP
"stats\&.mapped" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.mapped (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Total number of bytes in active chunks mapped by the allocator\&. This is a multiple of the chunk size, and is larger than Total number of bytes in active chunks mapped by the allocator\&. This is a multiple of the chunk size, and is larger than
"stats\&.active"\&. This does not include inactive chunks, even those that contain unused dirty pages, which means that there is no strict ordering between this and stats\&.active\&. This does not include inactive chunks, even those that contain unused dirty pages, which means that there is no strict ordering between this and
"stats\&.resident"\&. stats\&.resident\&.
.RE
.PP
stats\&.retained (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4
Total number of bytes in virtual memory mappings that were retained rather than being returned to the operating system via e\&.g\&.
\fBmunmap\fR(2)\&. Retained virtual memory is typically untouched, decommitted, or purged, so it has no strongly associated physical memory (see
chunk hooks
for details)\&. Retained memory is excluded from mapped memory statistics, e\&.g\&.
stats\&.mapped\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.dss" (\fBconst char *\fR) r\- stats\&.arenas\&.<i>\&.dss (\fBconst char *\fR) r\-
.RS 4 .RS 4
dss (\fBsbrk\fR(2)) allocation precedence as related to dss (\fBsbrk\fR(2)) allocation precedence as related to
\fBmmap\fR(2) \fBmmap\fR(2)
allocation\&. See allocation\&. See
"opt\&.dss" opt\&.dss
for details\&. for details\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.lg_dirty_mult" (\fBssize_t\fR) r\- stats\&.arenas\&.<i>\&.lg_dirty_mult (\fBssize_t\fR) r\-
.RS 4 .RS 4
Minimum ratio (log base 2) of active to dirty pages\&. See Minimum ratio (log base 2) of active to dirty pages\&. See
"opt\&.lg_dirty_mult" opt\&.lg_dirty_mult
for details\&. for details\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.nthreads" (\fBunsigned\fR) r\- stats\&.arenas\&.<i>\&.decay_time (\fBssize_t\fR) r\-
.RS 4
Approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. See
opt\&.decay_time
for details\&.
.RE
.PP
stats\&.arenas\&.<i>\&.nthreads (\fBunsigned\fR) r\-
.RS 4 .RS 4
Number of threads currently assigned to arena\&. Number of threads currently assigned to arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.pactive" (\fBsize_t\fR) r\- stats\&.arenas\&.<i>\&.pactive (\fBsize_t\fR) r\-
.RS 4 .RS 4
Number of pages in active runs\&. Number of pages in active runs\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.pdirty" (\fBsize_t\fR) r\- stats\&.arenas\&.<i>\&.pdirty (\fBsize_t\fR) r\-
.RS 4 .RS 4
Number of pages within unused runs that are potentially dirty, and for which Number of pages within unused runs that are potentially dirty, and for which
\fBmadvise\fR\fB\fI\&.\&.\&.\fR\fR\fB \fR\fB\fI\fBMADV_DONTNEED\fR\fR\fR madvise\fI\&.\&.\&.\fR \fI\fBMADV_DONTNEED\fR\fR
or similar has not been called\&. or similar has not been called\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.mapped" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.mapped (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of mapped bytes\&. Number of mapped bytes\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.metadata\&.mapped" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.retained (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4
Number of retained bytes\&. See
stats\&.retained
for details\&.
.RE
.PP
stats\&.arenas\&.<i>\&.metadata\&.mapped (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of mapped bytes in arena chunk headers, which track the states of the non\-metadata pages\&. Number of mapped bytes in arena chunk headers, which track the states of the non\-metadata pages\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.metadata\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.metadata\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of bytes dedicated to internal allocations\&. Internal allocations differ from application\-originated allocations in that they are for internal use, and that they are omitted from heap profiles\&. This statistic is reported separately from Number of bytes dedicated to internal allocations\&. Internal allocations differ from application\-originated allocations in that they are for internal use, and that they are omitted from heap profiles\&. This statistic is reported separately from
"stats\&.metadata" stats\&.metadata
and and
"stats\&.arenas\&.<i>\&.metadata\&.mapped" stats\&.arenas\&.<i>\&.metadata\&.mapped
because it overlaps with e\&.g\&. the because it overlaps with e\&.g\&. the
"stats\&.allocated" stats\&.allocated
and and
"stats\&.active" stats\&.active
statistics, whereas the other metadata statistics do not\&. statistics, whereas the other metadata statistics do not\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.npurge" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.npurge (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of dirty page purge sweeps performed\&. Number of dirty page purge sweeps performed\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.nmadvise" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.nmadvise (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of Number of
\fBmadvise\fR\fB\fI\&.\&.\&.\fR\fR\fB \fR\fB\fI\fBMADV_DONTNEED\fR\fR\fR madvise\fI\&.\&.\&.\fR \fI\fBMADV_DONTNEED\fR\fR
or similar calls made to purge dirty pages\&. or similar calls made to purge dirty pages\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.purged" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.purged (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of pages purged\&. Number of pages purged\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.small\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.small\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of bytes currently allocated by small objects\&. Number of bytes currently allocated by small objects\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.small\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.small\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocation requests served by small bins\&. Cumulative number of allocation requests served by small bins\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.small\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.small\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of small objects returned to bins\&. Cumulative number of small objects returned to bins\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.small\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.small\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of small allocation requests\&. Cumulative number of small allocation requests\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.large\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.large\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of bytes currently allocated by large objects\&. Number of bytes currently allocated by large objects\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.large\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.large\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of large allocation requests served directly by the arena\&. Cumulative number of large allocation requests served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.large\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.large\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of large deallocation requests served directly by the arena\&. Cumulative number of large deallocation requests served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.large\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.large\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of large allocation requests\&. Cumulative number of large allocation requests\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.huge\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.huge\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Number of bytes currently allocated by huge objects\&. Number of bytes currently allocated by huge objects\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.huge\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.huge\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of huge allocation requests served directly by the arena\&. Cumulative number of huge allocation requests served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.huge\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.huge\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of huge deallocation requests served directly by the arena\&. Cumulative number of huge deallocation requests served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.huge\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.huge\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of huge allocation requests\&. Cumulative number of huge allocation requests\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocations served by bin\&. Cumulative number of allocations served by bin\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocations returned to bin\&. Cumulative number of allocations returned to bin\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocation requests\&. Cumulative number of allocation requests\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.curregs" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.curregs (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Current number of regions for this size class\&. Current number of regions for this size class\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.nfills" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR \fB\-\-enable\-tcache\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.nfills (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR \fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Cumulative number of tcache fills\&. Cumulative number of tcache fills\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.nflushes" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR \fB\-\-enable\-tcache\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.nflushes (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR \fB\-\-enable\-tcache\fR]
.RS 4 .RS 4
Cumulative number of tcache flushes\&. Cumulative number of tcache flushes\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.nruns" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.nruns (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of runs created\&. Cumulative number of runs created\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.nreruns" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.nreruns (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of times the current run from which to allocate changed\&. Cumulative number of times the current run from which to allocate changed\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.bins\&.<j>\&.curruns" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.bins\&.<j>\&.curruns (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Current number of runs\&. Current number of runs\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.lruns\&.<j>\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.lruns\&.<j>\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocation requests for this size class served directly by the arena\&. Cumulative number of allocation requests for this size class served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.lruns\&.<j>\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.lruns\&.<j>\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of deallocation requests for this size class served directly by the arena\&. Cumulative number of deallocation requests for this size class served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.lruns\&.<j>\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.lruns\&.<j>\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocation requests for this size class\&. Cumulative number of allocation requests for this size class\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.lruns\&.<j>\&.curruns" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.lruns\&.<j>\&.curruns (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Current number of runs for this size class\&. Current number of runs for this size class\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocation requests for this size class served directly by the arena\&. Cumulative number of allocation requests for this size class served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of deallocation requests for this size class served directly by the arena\&. Cumulative number of deallocation requests for this size class served directly by the arena\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Cumulative number of allocation requests for this size class\&. Cumulative number of allocation requests for this size class\&.
.RE .RE
.PP .PP
"stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.curhchunks" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.curhchunks (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
.RS 4 .RS 4
Current number of huge allocations for this size class\&. Current number of huge allocations for this size class\&.
.RE .RE
.SH "HEAP PROFILE FORMAT"
.PP
Although the heap profiling functionality was originally designed to be compatible with the
\fBpprof\fR
command that is developed as part of the
\m[blue]\fBgperftools package\fR\m[]\&\s-2\u[4]\d\s+2, the addition of per thread heap profiling functionality required a different heap profile format\&. The
\fBjeprof\fR
command is derived from
\fBpprof\fR, with enhancements to support the heap profile format described here\&.
.PP
In the following hypothetical heap profile,
\fB[\&.\&.\&.]\fR
indicates elision for the sake of compactness\&.
.sp
.if n \{\
.RS 4
.\}
.nf
heap_v2/524288
t*: 28106: 56637512 [0: 0]
[\&.\&.\&.]
t3: 352: 16777344 [0: 0]
[\&.\&.\&.]
t99: 17754: 29341640 [0: 0]
[\&.\&.\&.]
@ 0x5f86da8 0x5f5a1dc [\&.\&.\&.] 0x29e4d4e 0xa200316 0xabb2988 [\&.\&.\&.]
t*: 13: 6688 [0: 0]
t3: 12: 6496 [0: ]
t99: 1: 192 [0: 0]
[\&.\&.\&.]
MAPPED_LIBRARIES:
[\&.\&.\&.]
.fi
.if n \{\
.RE
.\}
.sp
The following matches the above heap profile, but most tokens are replaced with
\fB<description>\fR
to indicate descriptions of the corresponding fields\&.
.sp
.if n \{\
.RS 4
.\}
.nf
<heap_profile_format_version>/<mean_sample_interval>
<aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[\&.\&.\&.]
<thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
[\&.\&.\&.]
<thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
[\&.\&.\&.]
@ <top_frame> <frame> [\&.\&.\&.] <frame> <frame> <frame> [\&.\&.\&.]
<backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
<backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
<backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[\&.\&.\&.]
MAPPED_LIBRARIES:
</proc/<pid>/maps>
.fi
.if n \{\
.RE
.\}
.SH "DEBUGGING MALLOC PROBLEMS" .SH "DEBUGGING MALLOC PROBLEMS"
.PP .PP
When debugging, it is a good idea to configure/build jemalloc with the When debugging, it is a good idea to configure/build jemalloc with the
...@@ -1705,14 +1902,16 @@ and ...@@ -1705,14 +1902,16 @@ and
\fB\-\-enable\-fill\fR \fB\-\-enable\-fill\fR
options, and recompile the program with suitable options and symbols for debugger support\&. When so configured, jemalloc incorporates a wide variety of run\-time assertions that catch application errors such as double\-free, write\-after\-free, etc\&. options, and recompile the program with suitable options and symbols for debugger support\&. When so configured, jemalloc incorporates a wide variety of run\-time assertions that catch application errors such as double\-free, write\-after\-free, etc\&.
.PP .PP
Programs often accidentally depend on \(lquninitialized\(rq memory actually being filled with zero bytes\&. Junk filling (see the Programs often accidentally depend on
"opt\&.junk" \(lquninitialized\(rq
memory actually being filled with zero bytes\&. Junk filling (see the
opt\&.junk
option) tends to expose such bugs in the form of obviously incorrect results and/or coredumps\&. Conversely, zero filling (see the option) tends to expose such bugs in the form of obviously incorrect results and/or coredumps\&. Conversely, zero filling (see the
"opt\&.zero" opt\&.zero
option) eliminates the symptoms of such bugs\&. Between these two options, it is usually possible to quickly detect, diagnose, and eliminate such bugs\&. option) eliminates the symptoms of such bugs\&. Between these two options, it is usually possible to quickly detect, diagnose, and eliminate such bugs\&.
.PP .PP
This implementation does not provide much detail about the problems it detects, because the performance impact for storing such information would be prohibitive\&. However, jemalloc does integrate with the most excellent This implementation does not provide much detail about the problems it detects, because the performance impact for storing such information would be prohibitive\&. However, jemalloc does integrate with the most excellent
\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2 \m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2
tool if the tool if the
\fB\-\-enable\-valgrind\fR \fB\-\-enable\-valgrind\fR
configuration option is enabled\&. configuration option is enabled\&.
...@@ -1720,7 +1919,7 @@ configuration option is enabled\&. ...@@ -1720,7 +1919,7 @@ configuration option is enabled\&.
.PP .PP
If any of the memory allocation/deallocation functions detect an error or warning condition, a message will be printed to file descriptor If any of the memory allocation/deallocation functions detect an error or warning condition, a message will be printed to file descriptor
\fBSTDERR_FILENO\fR\&. Errors will result in the process dumping core\&. If the \fBSTDERR_FILENO\fR\&. Errors will result in the process dumping core\&. If the
"opt\&.abort" opt\&.abort
option is set, most warnings are treated as errors\&. option is set, most warnings are treated as errors\&.
.PP .PP
The The
...@@ -1728,22 +1927,23 @@ The ...@@ -1728,22 +1927,23 @@ The
variable allows the programmer to override the function which emits the text strings forming the errors and warnings if for some reason the variable allows the programmer to override the function which emits the text strings forming the errors and warnings if for some reason the
\fBSTDERR_FILENO\fR \fBSTDERR_FILENO\fR
file descriptor is not suitable for this\&. file descriptor is not suitable for this\&.
\fBmalloc_message\fR\fB\fR malloc_message()
takes the takes the
\fIcbopaque\fR \fIcbopaque\fR
pointer argument that is pointer argument that is
\fBNULL\fR \fBNULL\fR
unless overridden by the arguments in a call to unless overridden by the arguments in a call to
\fBmalloc_stats_print\fR\fB\fR, followed by a string pointer\&. Please note that doing anything which tries to allocate memory in this function is likely to result in a crash or deadlock\&. malloc_stats_print(), followed by a string pointer\&. Please note that doing anything which tries to allocate memory in this function is likely to result in a crash or deadlock\&.
.PP .PP
All messages are prefixed by \(lq<jemalloc>:\(rq\&. All messages are prefixed by
\(lq<jemalloc>: \(rq\&.
.SH "RETURN VALUES" .SH "RETURN VALUES"
.SS "Standard API" .SS "Standard API"
.PP .PP
The The
\fBmalloc\fR\fB\fR malloc()
and and
\fBcalloc\fR\fB\fR calloc()
functions return a pointer to the allocated memory if successful; otherwise a functions return a pointer to the allocated memory if successful; otherwise a
\fBNULL\fR \fBNULL\fR
pointer is returned and pointer is returned and
...@@ -1752,9 +1952,9 @@ is set to ...@@ -1752,9 +1952,9 @@ is set to
ENOMEM\&. ENOMEM\&.
.PP .PP
The The
\fBposix_memalign\fR\fB\fR posix_memalign()
function returns the value 0 if successful; otherwise it returns an error value\&. The function returns the value 0 if successful; otherwise it returns an error value\&. The
\fBposix_memalign\fR\fB\fR posix_memalign()
function will fail if: function will fail if:
.PP .PP
EINVAL EINVAL
...@@ -1771,13 +1971,13 @@ Memory allocation error\&. ...@@ -1771,13 +1971,13 @@ Memory allocation error\&.
.RE .RE
.PP .PP
The The
\fBaligned_alloc\fR\fB\fR aligned_alloc()
function returns a pointer to the allocated memory if successful; otherwise a function returns a pointer to the allocated memory if successful; otherwise a
\fBNULL\fR \fBNULL\fR
pointer is returned and pointer is returned and
\fIerrno\fR \fIerrno\fR
is set\&. The is set\&. The
\fBaligned_alloc\fR\fB\fR aligned_alloc()
function will fail if: function will fail if:
.PP .PP
EINVAL EINVAL
...@@ -1793,7 +1993,7 @@ Memory allocation error\&. ...@@ -1793,7 +1993,7 @@ Memory allocation error\&.
.RE .RE
.PP .PP
The The
\fBrealloc\fR\fB\fR realloc()
function returns a pointer, possibly identical to function returns a pointer, possibly identical to
\fIptr\fR, to the allocated memory if successful; otherwise a \fIptr\fR, to the allocated memory if successful; otherwise a
\fBNULL\fR \fBNULL\fR
...@@ -1802,44 +2002,44 @@ pointer is returned, and ...@@ -1802,44 +2002,44 @@ pointer is returned, and
is set to is set to
ENOMEM ENOMEM
if the error was the result of an allocation failure\&. The if the error was the result of an allocation failure\&. The
\fBrealloc\fR\fB\fR realloc()
function always leaves the original buffer intact when an error occurs\&. function always leaves the original buffer intact when an error occurs\&.
.PP .PP
The The
\fBfree\fR\fB\fR free()
function returns no value\&. function returns no value\&.
.SS "Non\-standard API" .SS "Non\-standard API"
.PP .PP
The The
\fBmallocx\fR\fB\fR mallocx()
and and
\fBrallocx\fR\fB\fR rallocx()
functions return a pointer to the allocated memory if successful; otherwise a functions return a pointer to the allocated memory if successful; otherwise a
\fBNULL\fR \fBNULL\fR
pointer is returned to indicate insufficient contiguous memory was available to service the allocation request\&. pointer is returned to indicate insufficient contiguous memory was available to service the allocation request\&.
.PP .PP
The The
\fBxallocx\fR\fB\fR xallocx()
function returns the real size of the resulting resized allocation pointed to by function returns the real size of the resulting resized allocation pointed to by
\fIptr\fR, which is a value less than \fIptr\fR, which is a value less than
\fIsize\fR \fIsize\fR
if the allocation could not be adequately grown in place\&. if the allocation could not be adequately grown in place\&.
.PP .PP
The The
\fBsallocx\fR\fB\fR sallocx()
function returns the real size of the allocation pointed to by function returns the real size of the allocation pointed to by
\fIptr\fR\&. \fIptr\fR\&.
.PP .PP
The The
\fBnallocx\fR\fB\fR nallocx()
returns the real size that would result from a successful equivalent returns the real size that would result from a successful equivalent
\fBmallocx\fR\fB\fR mallocx()
function call, or zero if insufficient memory is available to perform the size computation\&. function call, or zero if insufficient memory is available to perform the size computation\&.
.PP .PP
The The
\fBmallctl\fR\fB\fR, mallctl(),
\fBmallctlnametomib\fR\fB\fR, and mallctlnametomib(), and
\fBmallctlbymib\fR\fB\fR mallctlbymib()
functions return 0 on success; otherwise they return an error value\&. The functions will fail if: functions return 0 on success; otherwise they return an error value\&. The functions will fail if:
.PP .PP
EINVAL EINVAL
...@@ -1874,12 +2074,12 @@ A memory allocation failure occurred\&. ...@@ -1874,12 +2074,12 @@ A memory allocation failure occurred\&.
EFAULT EFAULT
.RS 4 .RS 4
An interface with side effects failed in some way not directly related to An interface with side effects failed in some way not directly related to
\fBmallctl*\fR\fB\fR mallctl*()
read/write processing\&. read/write processing\&.
.RE .RE
.PP .PP
The The
\fBmalloc_usable_size\fR\fB\fR malloc_usable_size()
function returns the usable size of the allocation pointed to by function returns the usable size of the allocation pointed to by
\fIptr\fR\&. \fIptr\fR\&.
.SH "ENVIRONMENT" .SH "ENVIRONMENT"
...@@ -1929,14 +2129,14 @@ malloc_conf = "lg_chunk:24"; ...@@ -1929,14 +2129,14 @@ malloc_conf = "lg_chunk:24";
.SH "STANDARDS" .SH "STANDARDS"
.PP .PP
The The
\fBmalloc\fR\fB\fR, malloc(),
\fBcalloc\fR\fB\fR, calloc(),
\fBrealloc\fR\fB\fR, and realloc(), and
\fBfree\fR\fB\fR free()
functions conform to ISO/IEC 9899:1990 (\(lqISO C90\(rq)\&. functions conform to ISO/IEC 9899:1990 (\(lqISO C90\(rq)\&.
.PP .PP
The The
\fBposix_memalign\fR\fB\fR posix_memalign()
function conforms to IEEE Std 1003\&.1\-2001 (\(lqPOSIX\&.1\(rq)\&. function conforms to IEEE Std 1003\&.1\-2001 (\(lqPOSIX\&.1\(rq)\&.
.SH "AUTHOR" .SH "AUTHOR"
.PP .PP
...@@ -1947,14 +2147,19 @@ function conforms to IEEE Std 1003\&.1\-2001 (\(lqPOSIX\&.1\(rq)\&. ...@@ -1947,14 +2147,19 @@ function conforms to IEEE Std 1003\&.1\-2001 (\(lqPOSIX\&.1\(rq)\&.
.IP " 1." 4 .IP " 1." 4
jemalloc website jemalloc website
.RS 4 .RS 4
\%http://www.canonware.com/jemalloc/ \%http://jemalloc.net/
.RE .RE
.IP " 2." 4 .IP " 2." 4
JSON format
.RS 4
\%http://www.json.org/
.RE
.IP " 3." 4
Valgrind Valgrind
.RS 4 .RS 4
\%http://valgrind.org/ \%http://valgrind.org/
.RE .RE
.IP " 3." 4 .IP " 4." 4
gperftools package gperftools package
.RS 4 .RS 4
\%http://code.google.com/p/gperftools/ \%http://code.google.com/p/gperftools/
......
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>JEMALLOC</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idp45223136"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>jemalloc &#8212; general purpose memory allocation functions</p></div><div class="refsect1"><a name="library"></a><h2>LIBRARY</h2><p>This manual describes jemalloc 4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c. More information <?xml version="1.0" encoding="utf-8"?>
can be found at the <a class="ulink" href="http://www.canonware.com/jemalloc/" target="_top">jemalloc website</a>.</p></div><div class="refsynopsisdiv"><h2>SYNOPSIS</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;<code class="filename">jemalloc/jemalloc.h</code>&gt;</pre><div class="refsect2"><a name="idp44244480"></a><h3>Standard API</h3><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">malloc</b>(</code></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">calloc</b>(</code></td><td>size_t <var class="pdparam">number</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">posix_memalign</b>(</code></td><td>void **<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">aligned_alloc</b>(</code></td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">realloc</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">free</b>(</code></td><td>void *<var class="pdparam">ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="refsect2"><a name="idp46062768"></a><h3>Non-standard API</h3><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">mallocx</b>(</code></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">rallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">xallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">extra</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">sallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">dallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">sdallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">nallocx</b>(</code></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">mallctl</b>(</code></td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td></td><td>void *<var class="pdparam">oldp</var>, </td></tr><tr><td></td><td>size_t *<var class="pdparam">oldlenp</var>, </td></tr><tr><td></td><td>void *<var class="pdparam">newp</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">newlen</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">mallctlnametomib</b>(</code></td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td></td><td>size_t *<var class="pdparam">mibp</var>, </td></tr><tr><td></td><td>size_t *<var class="pdparam">miblenp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">mallctlbymib</b>(</code></td><td>const size_t *<var class="pdparam">mib</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">miblen</var>, </td></tr><tr><td></td><td>void *<var class="pdparam">oldp</var>, </td></tr><tr><td></td><td>size_t *<var class="pdparam">oldlenp</var>, </td></tr><tr><td></td><td>void *<var class="pdparam">newp</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">newlen</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">malloc_stats_print</b>(</code></td><td>void <var class="pdparam">(*write_cb)</var> <html><head><title>JEMALLOC</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm45291902356496"/><div class="titlepage"/><div class="refnamediv"><h2>Name</h2><p>jemalloc — general purpose memory allocation functions</p></div><div class="refsect1"><a name="library"/><h2>LIBRARY</h2><p>This manual describes jemalloc 4.4.0-0-gf1f76357313e7dcad7262f17a48ff0a2e005fcdc. More information
can be found at the <a class="ulink" href="http://jemalloc.net/" target="_top">jemalloc website</a>.</p></div><div class="refsynopsisdiv"><h2>SYNOPSIS</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;<code class="filename">jemalloc/jemalloc.h</code>&gt;</pre><div class="refsect2"><a name="idm45291899537440"/><h3>Standard API</h3><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">malloc</b>(</code></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">calloc</b>(</code></td><td>size_t <var class="pdparam">number</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">posix_memalign</b>(</code></td><td>void **<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">aligned_alloc</b>(</code></td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">realloc</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">free</b>(</code></td><td>void *<var class="pdparam">ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="refsect2"><a name="idm45291903783248"/><h3>Non-standard API</h3><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">mallocx</b>(</code></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<b class="fsfunc">rallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">xallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">extra</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">sallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">dallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">sdallocx</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">nallocx</b>(</code></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">mallctl</b>(</code></td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td> </td><td>void *<var class="pdparam">oldp</var>, </td></tr><tr><td> </td><td>size_t *<var class="pdparam">oldlenp</var>, </td></tr><tr><td> </td><td>void *<var class="pdparam">newp</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">newlen</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">mallctlnametomib</b>(</code></td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td> </td><td>size_t *<var class="pdparam">mibp</var>, </td></tr><tr><td> </td><td>size_t *<var class="pdparam">miblenp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">mallctlbymib</b>(</code></td><td>const size_t *<var class="pdparam">mib</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">miblen</var>, </td></tr><tr><td> </td><td>void *<var class="pdparam">oldp</var>, </td></tr><tr><td> </td><td>size_t *<var class="pdparam">oldlenp</var>, </td></tr><tr><td> </td><td>void *<var class="pdparam">newp</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">newlen</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">malloc_stats_print</b>(</code></td><td>void <var class="pdparam">(*write_cb)</var>
<code>(</code>void *, const char *<code>)</code> <code>(</code>void *, const char *<code>)</code>
, </td></tr><tr><td></td><td>void *<var class="pdparam">cbopaque</var>, </td></tr><tr><td></td><td>const char *<var class="pdparam">opts</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">malloc_usable_size</b>(</code></td><td>const void *<var class="pdparam">ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">(*malloc_message)</b>(</code></td><td>void *<var class="pdparam">cbopaque</var>, </td></tr><tr><td></td><td>const char *<var class="pdparam">s</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div><p><span class="type">const char *</span><code class="varname">malloc_conf</code>;</p></div></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><div class="refsect2"><a name="idp46115952"></a><h3>Standard API</h3><p>The <code class="function">malloc</code>(<em class="parameter"><code></code></em>) function allocates , </td></tr><tr><td> </td><td>void *<var class="pdparam">cbopaque</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">opts</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">size_t <b class="fsfunc">malloc_usable_size</b>(</code></td><td>const void *<var class="pdparam">ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">(*malloc_message)</b>(</code></td><td>void *<var class="pdparam">cbopaque</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">s</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><p><span class="type">const char *</span><code class="varname">malloc_conf</code>;</p></div></div></div><div class="refsect1"><a name="description"/><h2>DESCRIPTION</h2><div class="refsect2"><a name="idm45291898401136"/><h3>Standard API</h3><p>The <code class="function">malloc()</code> function allocates
<em class="parameter"><code>size</code></em> bytes of uninitialized memory. The allocated <em class="parameter"><code>size</code></em> bytes of uninitialized memory. The allocated
space is suitably aligned (after possible pointer coercion) for storage space is suitably aligned (after possible pointer coercion) for storage
of any type of object.</p><p>The <code class="function">calloc</code>(<em class="parameter"><code></code></em>) function allocates of any type of object.</p><p>The <code class="function">calloc()</code> function allocates
space for <em class="parameter"><code>number</code></em> objects, each space for <em class="parameter"><code>number</code></em> objects, each
<em class="parameter"><code>size</code></em> bytes in length. The result is identical to <em class="parameter"><code>size</code></em> bytes in length. The result is identical to
calling <code class="function">malloc</code>(<em class="parameter"><code></code></em>) with an argument of calling <code class="function">malloc()</code> with an argument of
<em class="parameter"><code>number</code></em> * <em class="parameter"><code>size</code></em>, with the <em class="parameter"><code>number</code></em> * <em class="parameter"><code>size</code></em>, with the
exception that the allocated memory is explicitly initialized to zero exception that the allocated memory is explicitly initialized to zero
bytes.</p><p>The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function bytes.</p><p>The <code class="function">posix_memalign()</code> function
allocates <em class="parameter"><code>size</code></em> bytes of memory such that the allocates <em class="parameter"><code>size</code></em> bytes of memory such that the
allocation's base address is a multiple of allocation's base address is a multiple of
<em class="parameter"><code>alignment</code></em>, and returns the allocation in the value <em class="parameter"><code>alignment</code></em>, and returns the allocation in the value
pointed to by <em class="parameter"><code>ptr</code></em>. The requested pointed to by <em class="parameter"><code>ptr</code></em>. The requested
<em class="parameter"><code>alignment</code></em> must be a power of 2 at least as large as <em class="parameter"><code>alignment</code></em> must be a power of 2 at least as large as
<code class="code">sizeof(<span class="type">void *</span>)</code>.</p><p>The <code class="function">aligned_alloc</code>(<em class="parameter"><code></code></em>) function <code class="code">sizeof(<span class="type">void *</span>)</code>.</p><p>The <code class="function">aligned_alloc()</code> function
allocates <em class="parameter"><code>size</code></em> bytes of memory such that the allocates <em class="parameter"><code>size</code></em> bytes of memory such that the
allocation's base address is a multiple of allocation's base address is a multiple of
<em class="parameter"><code>alignment</code></em>. The requested <em class="parameter"><code>alignment</code></em>. The requested
<em class="parameter"><code>alignment</code></em> must be a power of 2. Behavior is <em class="parameter"><code>alignment</code></em> must be a power of 2. Behavior is
undefined if <em class="parameter"><code>size</code></em> is not an integral multiple of undefined if <em class="parameter"><code>size</code></em> is not an integral multiple of
<em class="parameter"><code>alignment</code></em>.</p><p>The <code class="function">realloc</code>(<em class="parameter"><code></code></em>) function changes the <em class="parameter"><code>alignment</code></em>.</p><p>The <code class="function">realloc()</code> function changes the
size of the previously allocated memory referenced by size of the previously allocated memory referenced by
<em class="parameter"><code>ptr</code></em> to <em class="parameter"><code>size</code></em> bytes. The <em class="parameter"><code>ptr</code></em> to <em class="parameter"><code>size</code></em> bytes. The
contents of the memory are unchanged up to the lesser of the new and old contents of the memory are unchanged up to the lesser of the new and old
...@@ -30,69 +31,65 @@ ...@@ -30,69 +31,65 @@
portion of the memory are undefined. Upon success, the memory referenced portion of the memory are undefined. Upon success, the memory referenced
by <em class="parameter"><code>ptr</code></em> is freed and a pointer to the newly by <em class="parameter"><code>ptr</code></em> is freed and a pointer to the newly
allocated memory is returned. Note that allocated memory is returned. Note that
<code class="function">realloc</code>(<em class="parameter"><code></code></em>) may move the memory allocation, <code class="function">realloc()</code> may move the memory allocation,
resulting in a different return value than <em class="parameter"><code>ptr</code></em>. resulting in a different return value than <em class="parameter"><code>ptr</code></em>.
If <em class="parameter"><code>ptr</code></em> is <code class="constant">NULL</code>, the If <em class="parameter"><code>ptr</code></em> is <code class="constant">NULL</code>, the
<code class="function">realloc</code>(<em class="parameter"><code></code></em>) function behaves identically to <code class="function">realloc()</code> function behaves identically to
<code class="function">malloc</code>(<em class="parameter"><code></code></em>) for the specified size.</p><p>The <code class="function">free</code>(<em class="parameter"><code></code></em>) function causes the <code class="function">malloc()</code> for the specified size.</p><p>The <code class="function">free()</code> function causes the
allocated memory referenced by <em class="parameter"><code>ptr</code></em> to be made allocated memory referenced by <em class="parameter"><code>ptr</code></em> to be made
available for future allocations. If <em class="parameter"><code>ptr</code></em> is available for future allocations. If <em class="parameter"><code>ptr</code></em> is
<code class="constant">NULL</code>, no action occurs.</p></div><div class="refsect2"><a name="idp46144704"></a><h3>Non-standard API</h3><p>The <code class="function">mallocx</code>(<em class="parameter"><code></code></em>), <code class="constant">NULL</code>, no action occurs.</p></div><div class="refsect2"><a name="idm45291898376160"/><h3>Non-standard API</h3><p>The <code class="function">mallocx()</code>,
<code class="function">rallocx</code>(<em class="parameter"><code></code></em>), <code class="function">rallocx()</code>,
<code class="function">xallocx</code>(<em class="parameter"><code></code></em>), <code class="function">xallocx()</code>,
<code class="function">sallocx</code>(<em class="parameter"><code></code></em>), <code class="function">sallocx()</code>,
<code class="function">dallocx</code>(<em class="parameter"><code></code></em>), <code class="function">dallocx()</code>,
<code class="function">sdallocx</code>(<em class="parameter"><code></code></em>), and <code class="function">sdallocx()</code>, and
<code class="function">nallocx</code>(<em class="parameter"><code></code></em>) functions all have a <code class="function">nallocx()</code> functions all have a
<em class="parameter"><code>flags</code></em> argument that can be used to specify <em class="parameter"><code>flags</code></em> argument that can be used to specify
options. The functions only check the options that are contextually options. The functions only check the options that are contextually
relevant. Use bitwise or (<code class="code">|</code>) operations to relevant. Use bitwise or (<code class="code">|</code>) operations to
specify one or more of the following: specify one or more of the following:
</p><div class="variablelist"><dl class="variablelist"><dt><a name="MALLOCX_LG_ALIGN"></a><span class="term"><code class="constant">MALLOCX_LG_ALIGN(<em class="parameter"><code>la</code></em>) </p><div class="variablelist"><dl class="variablelist"><dt><a name="MALLOCX_LG_ALIGN"/><span class="term"><code class="constant">MALLOCX_LG_ALIGN(<em class="parameter"><code>la</code></em>)
</code></span></dt><dd><p>Align the memory allocation to start at an address </code></span></dt><dd><p>Align the memory allocation to start at an address
that is a multiple of <code class="code">(1 &lt;&lt; that is a multiple of <code class="code">(1 &lt;&lt;
<em class="parameter"><code>la</code></em>)</code>. This macro does not validate <em class="parameter"><code>la</code></em>)</code>. This macro does not validate
that <em class="parameter"><code>la</code></em> is within the valid that <em class="parameter"><code>la</code></em> is within the valid
range.</p></dd><dt><a name="MALLOCX_ALIGN"></a><span class="term"><code class="constant">MALLOCX_ALIGN(<em class="parameter"><code>a</code></em>) range.</p></dd><dt><a name="MALLOCX_ALIGN"/><span class="term"><code class="constant">MALLOCX_ALIGN(<em class="parameter"><code>a</code></em>)
</code></span></dt><dd><p>Align the memory allocation to start at an address </code></span></dt><dd><p>Align the memory allocation to start at an address
that is a multiple of <em class="parameter"><code>a</code></em>, where that is a multiple of <em class="parameter"><code>a</code></em>, where
<em class="parameter"><code>a</code></em> is a power of two. This macro does not <em class="parameter"><code>a</code></em> is a power of two. This macro does not
validate that <em class="parameter"><code>a</code></em> is a power of 2. validate that <em class="parameter"><code>a</code></em> is a power of 2.
</p></dd><dt><a name="MALLOCX_ZERO"></a><span class="term"><code class="constant">MALLOCX_ZERO</code></span></dt><dd><p>Initialize newly allocated memory to contain zero </p></dd><dt><a name="MALLOCX_ZERO"/><span class="term"><code class="constant">MALLOCX_ZERO</code></span></dt><dd><p>Initialize newly allocated memory to contain zero
bytes. In the growing reallocation case, the real size prior to bytes. In the growing reallocation case, the real size prior to
reallocation defines the boundary between untouched bytes and those reallocation defines the boundary between untouched bytes and those
that are initialized to contain zero bytes. If this macro is that are initialized to contain zero bytes. If this macro is
absent, newly allocated memory is uninitialized.</p></dd><dt><a name="MALLOCX_TCACHE"></a><span class="term"><code class="constant">MALLOCX_TCACHE(<em class="parameter"><code>tc</code></em>) absent, newly allocated memory is uninitialized.</p></dd><dt><a name="MALLOCX_TCACHE"/><span class="term"><code class="constant">MALLOCX_TCACHE(<em class="parameter"><code>tc</code></em>)
</code></span></dt><dd><p>Use the thread-specific cache (tcache) specified by </code></span></dt><dd><p>Use the thread-specific cache (tcache) specified by
the identifier <em class="parameter"><code>tc</code></em>, which must have been the identifier <em class="parameter"><code>tc</code></em>, which must have been
acquired via the <a class="link" href="#tcache.create"> acquired via the <a class="link" href="#tcache.create"><quote><code class="mallctl">tcache.create</code></quote></a>
"<code class="mallctl">tcache.create</code>"
</a>
mallctl. This macro does not validate that mallctl. This macro does not validate that
<em class="parameter"><code>tc</code></em> specifies a valid <em class="parameter"><code>tc</code></em> specifies a valid
identifier.</p></dd><dt><a name="MALLOC_TCACHE_NONE"></a><span class="term"><code class="constant">MALLOCX_TCACHE_NONE</code></span></dt><dd><p>Do not use a thread-specific cache (tcache). Unless identifier.</p></dd><dt><a name="MALLOC_TCACHE_NONE"/><span class="term"><code class="constant">MALLOCX_TCACHE_NONE</code></span></dt><dd><p>Do not use a thread-specific cache (tcache). Unless
<code class="constant">MALLOCX_TCACHE(<em class="parameter"><code>tc</code></em>)</code> or <code class="constant">MALLOCX_TCACHE(<em class="parameter"><code>tc</code></em>)</code> or
<code class="constant">MALLOCX_TCACHE_NONE</code> is specified, an <code class="constant">MALLOCX_TCACHE_NONE</code> is specified, an
automatically managed tcache will be used under many circumstances. automatically managed tcache will be used under many circumstances.
This macro cannot be used in the same <em class="parameter"><code>flags</code></em> This macro cannot be used in the same <em class="parameter"><code>flags</code></em>
argument as argument as
<code class="constant">MALLOCX_TCACHE(<em class="parameter"><code>tc</code></em>)</code>.</p></dd><dt><a name="MALLOCX_ARENA"></a><span class="term"><code class="constant">MALLOCX_ARENA(<em class="parameter"><code>a</code></em>) <code class="constant">MALLOCX_TCACHE(<em class="parameter"><code>tc</code></em>)</code>.</p></dd><dt><a name="MALLOCX_ARENA"/><span class="term"><code class="constant">MALLOCX_ARENA(<em class="parameter"><code>a</code></em>)
</code></span></dt><dd><p>Use the arena specified by the index </code></span></dt><dd><p>Use the arena specified by the index
<em class="parameter"><code>a</code></em>. This macro has no effect for regions that <em class="parameter"><code>a</code></em>. This macro has no effect for regions that
were allocated via an arena other than the one specified. This were allocated via an arena other than the one specified. This
macro does not validate that <em class="parameter"><code>a</code></em> specifies an macro does not validate that <em class="parameter"><code>a</code></em> specifies an
arena index in the valid range.</p></dd></dl></div><p> arena index in the valid range.</p></dd></dl></div><p>
</p><p>The <code class="function">mallocx</code>(<em class="parameter"><code></code></em>) function allocates at </p><p>The <code class="function">mallocx()</code> function allocates at
least <em class="parameter"><code>size</code></em> bytes of memory, and returns a pointer least <em class="parameter"><code>size</code></em> bytes of memory, and returns a pointer
to the base address of the allocation. Behavior is undefined if to the base address of the allocation. Behavior is undefined if
<em class="parameter"><code>size</code></em> is <code class="constant">0</code>, or if request size <em class="parameter"><code>size</code></em> is <code class="constant">0</code>.</p><p>The <code class="function">rallocx()</code> function resizes the
overflows due to size class and/or alignment constraints.</p><p>The <code class="function">rallocx</code>(<em class="parameter"><code></code></em>) function resizes the
allocation at <em class="parameter"><code>ptr</code></em> to be at least allocation at <em class="parameter"><code>ptr</code></em> to be at least
<em class="parameter"><code>size</code></em> bytes, and returns a pointer to the base <em class="parameter"><code>size</code></em> bytes, and returns a pointer to the base
address of the resulting allocation, which may or may not have moved from address of the resulting allocation, which may or may not have moved from
its original location. Behavior is undefined if its original location. Behavior is undefined if
<em class="parameter"><code>size</code></em> is <code class="constant">0</code>, or if request size <em class="parameter"><code>size</code></em> is <code class="constant">0</code>.</p><p>The <code class="function">xallocx()</code> function resizes the
overflows due to size class and/or alignment constraints.</p><p>The <code class="function">xallocx</code>(<em class="parameter"><code></code></em>) function resizes the
allocation at <em class="parameter"><code>ptr</code></em> in place to be at least allocation at <em class="parameter"><code>ptr</code></em> in place to be at least
<em class="parameter"><code>size</code></em> bytes, and returns the real size of the <em class="parameter"><code>size</code></em> bytes, and returns the real size of the
allocation. If <em class="parameter"><code>extra</code></em> is non-zero, an attempt is allocation. If <em class="parameter"><code>extra</code></em> is non-zero, an attempt is
...@@ -101,24 +98,24 @@ ...@@ -101,24 +98,24 @@
the extra byte(s) will not by itself result in failure to resize. the extra byte(s) will not by itself result in failure to resize.
Behavior is undefined if <em class="parameter"><code>size</code></em> is Behavior is undefined if <em class="parameter"><code>size</code></em> is
<code class="constant">0</code>, or if <code class="code">(<em class="parameter"><code>size</code></em> + <em class="parameter"><code>extra</code></em> <code class="constant">0</code>, or if <code class="code">(<em class="parameter"><code>size</code></em> + <em class="parameter"><code>extra</code></em>
&gt; <code class="constant">SIZE_T_MAX</code>)</code>.</p><p>The <code class="function">sallocx</code>(<em class="parameter"><code></code></em>) function returns the &gt; <code class="constant">SIZE_T_MAX</code>)</code>.</p><p>The <code class="function">sallocx()</code> function returns the
real size of the allocation at <em class="parameter"><code>ptr</code></em>.</p><p>The <code class="function">dallocx</code>(<em class="parameter"><code></code></em>) function causes the real size of the allocation at <em class="parameter"><code>ptr</code></em>.</p><p>The <code class="function">dallocx()</code> function causes the
memory referenced by <em class="parameter"><code>ptr</code></em> to be made available for memory referenced by <em class="parameter"><code>ptr</code></em> to be made available for
future allocations.</p><p>The <code class="function">sdallocx</code>(<em class="parameter"><code></code></em>) function is an future allocations.</p><p>The <code class="function">sdallocx()</code> function is an
extension of <code class="function">dallocx</code>(<em class="parameter"><code></code></em>) with a extension of <code class="function">dallocx()</code> with a
<em class="parameter"><code>size</code></em> parameter to allow the caller to pass in the <em class="parameter"><code>size</code></em> parameter to allow the caller to pass in the
allocation size as an optimization. The minimum valid input size is the allocation size as an optimization. The minimum valid input size is the
original requested size of the allocation, and the maximum valid input original requested size of the allocation, and the maximum valid input
size is the corresponding value returned by size is the corresponding value returned by
<code class="function">nallocx</code>(<em class="parameter"><code></code></em>) or <code class="function">nallocx()</code> or
<code class="function">sallocx</code>(<em class="parameter"><code></code></em>).</p><p>The <code class="function">nallocx</code>(<em class="parameter"><code></code></em>) function allocates no <code class="function">sallocx()</code>.</p><p>The <code class="function">nallocx()</code> function allocates no
memory, but it performs the same size computation as the memory, but it performs the same size computation as the
<code class="function">mallocx</code>(<em class="parameter"><code></code></em>) function, and returns the real <code class="function">mallocx()</code> function, and returns the real
size of the allocation that would result from the equivalent size of the allocation that would result from the equivalent
<code class="function">mallocx</code>(<em class="parameter"><code></code></em>) function call. Behavior is <code class="function">mallocx()</code> function call, or
undefined if <em class="parameter"><code>size</code></em> is <code class="constant">0</code>, or if <code class="constant">0</code> if the inputs exceed the maximum supported size
request size overflows due to size class and/or alignment class and/or alignment. Behavior is undefined if
constraints.</p><p>The <code class="function">mallctl</code>(<em class="parameter"><code></code></em>) function provides a <em class="parameter"><code>size</code></em> is <code class="constant">0</code>.</p><p>The <code class="function">mallctl()</code> function provides a
general interface for introspecting the memory allocator, as well as general interface for introspecting the memory allocator, as well as
setting modifiable parameters and triggering actions. The setting modifiable parameters and triggering actions. The
period-separated <em class="parameter"><code>name</code></em> argument specifies a period-separated <em class="parameter"><code>name</code></em> argument specifies a
...@@ -130,12 +127,12 @@ ...@@ -130,12 +127,12 @@
write a value, pass a pointer to the value via write a value, pass a pointer to the value via
<em class="parameter"><code>newp</code></em>, and its length via <em class="parameter"><code>newp</code></em>, and its length via
<em class="parameter"><code>newlen</code></em>; otherwise pass <code class="constant">NULL</code> <em class="parameter"><code>newlen</code></em>; otherwise pass <code class="constant">NULL</code>
and <code class="constant">0</code>.</p><p>The <code class="function">mallctlnametomib</code>(<em class="parameter"><code></code></em>) function and <code class="constant">0</code>.</p><p>The <code class="function">mallctlnametomib()</code> function
provides a way to avoid repeated name lookups for applications that provides a way to avoid repeated name lookups for applications that
repeatedly query the same portion of the namespace, by translating a name repeatedly query the same portion of the namespace, by translating a name
to a &#8220;Management Information Base&#8221; (MIB) that can be passed to a <span class="quote"><span class="quote">Management Information Base</span></span> (MIB) that can be passed
repeatedly to <code class="function">mallctlbymib</code>(<em class="parameter"><code></code></em>). Upon repeatedly to <code class="function">mallctlbymib()</code>. Upon
successful return from <code class="function">mallctlnametomib</code>(<em class="parameter"><code></code></em>), successful return from <code class="function">mallctlnametomib()</code>,
<em class="parameter"><code>mibp</code></em> contains an array of <em class="parameter"><code>mibp</code></em> contains an array of
<em class="parameter"><code>*miblenp</code></em> integers, where <em class="parameter"><code>*miblenp</code></em> integers, where
<em class="parameter"><code>*miblenp</code></em> is the lesser of the number of components <em class="parameter"><code>*miblenp</code></em> is the lesser of the number of components
...@@ -145,9 +142,7 @@ ...@@ -145,9 +142,7 @@
period-separated name components, which results in a partial MIB that can period-separated name components, which results in a partial MIB that can
be used as the basis for constructing a complete MIB. For name be used as the basis for constructing a complete MIB. For name
components that are integers (e.g. the 2 in components that are integers (e.g. the 2 in
<a class="link" href="#arenas.bin.i.size"> <a class="link" href="#arenas.bin.i.size"><quote><code class="mallctl">arenas.bin.2.size</code></quote></a>),
"<code class="mallctl">arenas.bin.2.size</code>"
</a>),
the corresponding MIB component will always be that integer. Therefore, the corresponding MIB component will always be that integer. Therefore,
it is legitimate to construct code like the following: </p><pre class="programlisting"> it is legitimate to construct code like the following: </p><pre class="programlisting">
unsigned nbins, i; unsigned nbins, i;
...@@ -164,65 +159,62 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -164,65 +159,62 @@ for (i = 0; i &lt; nbins; i++) {
mib[2] = i; mib[2] = i;
len = sizeof(bin_size); len = sizeof(bin_size);
mallctlbymib(mib, miblen, &amp;bin_size, &amp;len, NULL, 0); mallctlbymib(mib, miblen, (void *)&amp;bin_size, &amp;len, NULL, 0);
/* Do something with bin_size... */ /* Do something with bin_size... */
}</pre><p>The <code class="function">malloc_stats_print</code>(<em class="parameter"><code></code></em>) function }</pre><p>The <code class="function">malloc_stats_print()</code> function writes
writes human-readable summary statistics via the summary statistics via the <em class="parameter"><code>write_cb</code></em> callback
<em class="parameter"><code>write_cb</code></em> callback function pointer and function pointer and <em class="parameter"><code>cbopaque</code></em> data passed to
<em class="parameter"><code>cbopaque</code></em> data passed to <em class="parameter"><code>write_cb</code></em>, or <code class="function">malloc_message()</code>
<em class="parameter"><code>write_cb</code></em>, or if <em class="parameter"><code>write_cb</code></em> is <code class="constant">NULL</code>. The
<code class="function">malloc_message</code>(<em class="parameter"><code></code></em>) if statistics are presented in human-readable form unless <span class="quote"><span class="quote">J</span></span> is
<em class="parameter"><code>write_cb</code></em> is <code class="constant">NULL</code>. This specified as a character within the <em class="parameter"><code>opts</code></em> string, in
function can be called repeatedly. General information that never which case the statistics are presented in <a class="ulink" href="http://www.json.org/" target="_top">JSON format</a>. This function can be
changes during execution can be omitted by specifying "g" as a character called repeatedly. General information that never changes during
execution can be omitted by specifying <span class="quote"><span class="quote">g</span></span> as a character
within the <em class="parameter"><code>opts</code></em> string. Note that within the <em class="parameter"><code>opts</code></em> string. Note that
<code class="function">malloc_message</code>(<em class="parameter"><code></code></em>) uses the <code class="function">malloc_message()</code> uses the
<code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) functions internally, so <code class="function">mallctl*()</code> functions internally, so inconsistent
inconsistent statistics can be reported if multiple threads use these statistics can be reported if multiple threads use these functions
functions simultaneously. If <code class="option">--enable-stats</code> is simultaneously. If <code class="option">--enable-stats</code> is specified during
specified during configuration, &#8220;m&#8221; and &#8220;a&#8221; can configuration, <span class="quote"><span class="quote">m</span></span> and <span class="quote"><span class="quote">a</span></span> can be specified to
be specified to omit merged arena and per arena statistics, respectively; omit merged arena and per arena statistics, respectively;
&#8220;b&#8221;, &#8220;l&#8221;, and &#8220;h&#8221; can be specified to <span class="quote"><span class="quote">b</span></span>, <span class="quote"><span class="quote">l</span></span>, and <span class="quote"><span class="quote">h</span></span> can be specified
omit per size class statistics for bins, large objects, and huge objects, to omit per size class statistics for bins, large objects, and huge
respectively. Unrecognized characters are silently ignored. Note that objects, respectively. Unrecognized characters are silently ignored.
thread caching may prevent some statistics from being completely up to Note that thread caching may prevent some statistics from being completely
date, since extra locking would be required to merge counters that track up to date, since extra locking would be required to merge counters that
thread cache operations. track thread cache operations.</p><p>The <code class="function">malloc_usable_size()</code> function
</p><p>The <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) function
returns the usable size of the allocation pointed to by returns the usable size of the allocation pointed to by
<em class="parameter"><code>ptr</code></em>. The return value may be larger than the size <em class="parameter"><code>ptr</code></em>. The return value may be larger than the size
that was requested during allocation. The that was requested during allocation. The
<code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) function is not a <code class="function">malloc_usable_size()</code> function is not a
mechanism for in-place <code class="function">realloc</code>(<em class="parameter"><code></code></em>); rather mechanism for in-place <code class="function">realloc()</code>; rather
it is provided solely as a tool for introspection purposes. Any it is provided solely as a tool for introspection purposes. Any
discrepancy between the requested allocation size and the size reported discrepancy between the requested allocation size and the size reported
by <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) should not be by <code class="function">malloc_usable_size()</code> should not be
depended on, since such behavior is entirely implementation-dependent. depended on, since such behavior is entirely implementation-dependent.
</p></div></div><div class="refsect1"><a name="tuning"></a><h2>TUNING</h2><p>Once, when the first call is made to one of the memory allocation </p></div></div><div class="refsect1"><a name="tuning"/><h2>TUNING</h2><p>Once, when the first call is made to one of the memory allocation
routines, the allocator initializes its internals based in part on various routines, the allocator initializes its internals based in part on various
options that can be specified at compile- or run-time.</p><p>The string pointed to by the global variable options that can be specified at compile- or run-time.</p><p>The string specified via <code class="option">--with-malloc-conf</code>, the
<code class="varname">malloc_conf</code>, the &#8220;name&#8221; of the file string pointed to by the global variable <code class="varname">malloc_conf</code>, the
referenced by the symbolic link named <code class="filename">/etc/malloc.conf</code>, and the value of the <span class="quote"><span class="quote">name</span></span> of the file referenced by the symbolic link named
<code class="filename">/etc/malloc.conf</code>, and the value of the
environment variable <code class="envar">MALLOC_CONF</code>, will be interpreted, in environment variable <code class="envar">MALLOC_CONF</code>, will be interpreted, in
that order, from left to right as options. Note that that order, from left to right as options. Note that
<code class="varname">malloc_conf</code> may be read before <code class="varname">malloc_conf</code> may be read before
<code class="function">main</code>(<em class="parameter"><code></code></em>) is entered, so the declaration of <code class="function">main()</code> is entered, so the declaration of
<code class="varname">malloc_conf</code> should specify an initializer that contains <code class="varname">malloc_conf</code> should specify an initializer that contains
the final value to be read by jemalloc. <code class="varname">malloc_conf</code> is the final value to be read by jemalloc. <code class="option">--with-malloc-conf</code>
a compile-time setting, whereas <code class="filename">/etc/malloc.conf</code> and <code class="envar">MALLOC_CONF</code> and <code class="varname">malloc_conf</code> are compile-time mechanisms, whereas
can be safely set any time prior to program invocation.</p><p>An options string is a comma-separated list of option:value pairs. <code class="filename">/etc/malloc.conf</code> and
There is one key corresponding to each <a class="link" href="#opt.abort"> <code class="envar">MALLOC_CONF</code> can be safely set any time prior to program
"<code class="mallctl">opt.*</code>" invocation.</p><p>An options string is a comma-separated list of option:value pairs.
</a> mallctl (see the <a class="xref" href="#mallctl_namespace" title="MALLCTL NAMESPACE">MALLCTL NAMESPACE</a> section for options There is one key corresponding to each <a class="link" href="#opt.abort"><quote><code class="mallctl">opt.*</code></quote></a> mallctl (see the <a class="xref" href="#mallctl_namespace" title="MALLCTL NAMESPACE">MALLCTL NAMESPACE</a> section for options
documentation). For example, <code class="literal">abort:true,narenas:1</code> sets documentation). For example, <code class="literal">abort:true,narenas:1</code> sets
the <a class="link" href="#opt.abort"> the <a class="link" href="#opt.abort"><quote><code class="mallctl">opt.abort</code></quote></a> and <a class="link" href="#opt.narenas"><quote><code class="mallctl">opt.narenas</code></quote></a> options. Some
"<code class="mallctl">opt.abort</code>"
</a> and <a class="link" href="#opt.narenas">
"<code class="mallctl">opt.narenas</code>"
</a> options. Some
options have boolean values (true/false), others have integer values (base options have boolean values (true/false), others have integer values (base
8, 10, or 16, depending on prefix), and yet others have raw string 8, 10, or 16, depending on prefix), and yet others have raw string
values.</p></div><div class="refsect1"><a name="implementation_notes"></a><h2>IMPLEMENTATION NOTES</h2><p>Traditionally, allocators have used values.</p></div><div class="refsect1"><a name="implementation_notes"/><h2>IMPLEMENTATION NOTES</h2><p>Traditionally, allocators have used
<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> to obtain memory, which is <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> to obtain memory, which is
suboptimal for several reasons, including race conditions, increased suboptimal for several reasons, including race conditions, increased
fragmentation, and artificial limitations on maximum usable memory. If fragmentation, and artificial limitations on maximum usable memory. If
...@@ -246,19 +238,18 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -246,19 +238,18 @@ for (i = 0; i &lt; nbins; i++) {
order to make it possible to completely avoid synchronization for most order to make it possible to completely avoid synchronization for most
allocation requests. Such caching allows very fast allocation in the allocation requests. Such caching allows very fast allocation in the
common case, but it increases memory usage and fragmentation, since a common case, but it increases memory usage and fragmentation, since a
bounded number of objects can remain allocated in each thread cache.</p><p>Memory is conceptually broken into equal-sized chunks, where the bounded number of objects can remain allocated in each thread cache.</p><p>Memory is conceptually broken into equal-sized chunks, where the chunk
chunk size is a power of two that is greater than the page size. Chunks size is a power of two that is greater than the page size. Chunks are
are always aligned to multiples of the chunk size. This alignment makes it always aligned to multiples of the chunk size. This alignment makes it
possible to find metadata for user objects very quickly.</p><p>User objects are broken into three categories according to size: possible to find metadata for user objects very quickly. User objects are
small, large, and huge. Small and large objects are managed entirely by broken into three categories according to size: small, large, and huge.
arenas; huge objects are additionally aggregated in a single data structure Multiple small and large objects can reside within a single chunk, whereas
that is shared by all threads. Huge objects are typically used by huge objects each have one or more chunks backing them. Each chunk that
applications infrequently enough that this single data structure is not a contains small and/or large objects tracks its contents as runs of
scalability issue.</p><p>Each chunk that is managed by an arena tracks its contents as runs of
contiguous pages (unused, backing a set of small objects, or backing one contiguous pages (unused, backing a set of small objects, or backing one
large object). The combination of chunk alignment and chunk page maps large object). The combination of chunk alignment and chunk page maps makes
makes it possible to determine all metadata regarding small and large it possible to determine all metadata regarding small and large allocations
allocations in constant time.</p><p>Small objects are managed in groups by page runs. Each run maintains in constant time.</p><p>Small objects are managed in groups by page runs. Each run maintains
a bitmap to track which regions are in use. Allocation requests that are no a bitmap to track which regions are in use. Allocation requests that are no
more than half the quantum (8 or 16, depending on architecture) are rounded more than half the quantum (8 or 16, depending on architecture) are rounded
up to the nearest power of two that is at least <code class="code">sizeof(<span class="type">double</span>)</code>. All other object size up to the nearest power of two that is at least <code class="code">sizeof(<span class="type">double</span>)</code>. All other object size
...@@ -266,22 +257,20 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -266,22 +257,20 @@ for (i = 0; i &lt; nbins; i++) {
classes for each doubling in size, which limits internal fragmentation to classes for each doubling in size, which limits internal fragmentation to
approximately 20% for all but the smallest size classes. Small size classes approximately 20% for all but the smallest size classes. Small size classes
are smaller than four times the page size, large size classes are smaller are smaller than four times the page size, large size classes are smaller
than the chunk size (see the <a class="link" href="#opt.lg_chunk"> than the chunk size (see the <a class="link" href="#opt.lg_chunk"><quote><code class="mallctl">opt.lg_chunk</code></quote></a> option), and
"<code class="mallctl">opt.lg_chunk</code>" huge size classes extend from the chunk size up to the largest size class
</a> option), and that does not exceed <code class="constant">PTRDIFF_MAX</code>.</p><p>Allocations are packed tightly together, which can be an issue for
huge size classes extend from the chunk size up to one size class less than
the full address space size.</p><p>Allocations are packed tightly together, which can be an issue for
multi-threaded applications. If you need to assure that allocations do not multi-threaded applications. If you need to assure that allocations do not
suffer from cacheline sharing, round your allocation requests up to the suffer from cacheline sharing, round your allocation requests up to the
nearest multiple of the cacheline size, or specify cacheline alignment when nearest multiple of the cacheline size, or specify cacheline alignment when
allocating.</p><p>The <code class="function">realloc</code>(<em class="parameter"><code></code></em>), allocating.</p><p>The <code class="function">realloc()</code>,
<code class="function">rallocx</code>(<em class="parameter"><code></code></em>), and <code class="function">rallocx()</code>, and
<code class="function">xallocx</code>(<em class="parameter"><code></code></em>) functions may resize allocations <code class="function">xallocx()</code> functions may resize allocations
without moving them under limited circumstances. Unlike the without moving them under limited circumstances. Unlike the
<code class="function">*allocx</code>(<em class="parameter"><code></code></em>) API, the standard API does not <code class="function">*allocx()</code> API, the standard API does not
officially round up the usable size of an allocation to the nearest size officially round up the usable size of an allocation to the nearest size
class, so technically it is necessary to call class, so technically it is necessary to call
<code class="function">realloc</code>(<em class="parameter"><code></code></em>) to grow e.g. a 9-byte allocation to <code class="function">realloc()</code> to grow e.g. a 9-byte allocation to
16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage 16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage
trivially succeeds in place as long as the pre-size and post-size both round trivially succeeds in place as long as the pre-size and post-size both round
up to the same size class. No other API guarantees are made regarding up to the same size class. No other API guarantees are made regarding
...@@ -289,147 +278,111 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -289,147 +278,111 @@ for (i = 0; i &lt; nbins; i++) {
and huge allocations in place, as long as the pre-size and post-size are and huge allocations in place, as long as the pre-size and post-size are
both large or both huge. In such cases shrinkage always succeeds for large both large or both huge. In such cases shrinkage always succeeds for large
size classes, but for huge size classes the chunk allocator must support size classes, but for huge size classes the chunk allocator must support
splitting (see <a class="link" href="#arena.i.chunk_hooks"> splitting (see <a class="link" href="#arena.i.chunk_hooks"><quote><code class="mallctl">arena.&lt;i&gt;.chunk_hooks</code></quote></a>).
"<code class="mallctl">arena.&lt;i&gt;.chunk_hooks</code>"
</a>).
Growth only succeeds if the trailing memory is currently available, and Growth only succeeds if the trailing memory is currently available, and
additionally for huge size classes the chunk allocator must support additionally for huge size classes the chunk allocator must support
merging.</p><p>Assuming 2 MiB chunks, 4 KiB pages, and a 16-byte quantum on a merging.</p><p>Assuming 2 MiB chunks, 4 KiB pages, and a 16-byte quantum on a
64-bit system, the size classes in each category are as shown in <a class="xref" href="#size_classes" title="Table1.Size classes">Table 1</a>.</p><div class="table"><a name="size_classes"></a><p class="title"><b>Table1.Size classes</b></p><div class="table-contents"><table summary="Size classes" border="1"><colgroup><col align="left" class="c1"><col align="right" class="c2"><col align="left" class="c3"></colgroup><thead><tr><th align="left">Category</th><th align="right">Spacing</th><th align="left">Size</th></tr></thead><tbody><tr><td rowspan="9" align="left">Small</td><td align="right">lg</td><td align="left">[8]</td></tr><tr><td align="right">16</td><td align="left">[16, 32, 48, 64, 80, 96, 112, 128]</td></tr><tr><td align="right">32</td><td align="left">[160, 192, 224, 256]</td></tr><tr><td align="right">64</td><td align="left">[320, 384, 448, 512]</td></tr><tr><td align="right">128</td><td align="left">[640, 768, 896, 1024]</td></tr><tr><td align="right">256</td><td align="left">[1280, 1536, 1792, 2048]</td></tr><tr><td align="right">512</td><td align="left">[2560, 3072, 3584, 4096]</td></tr><tr><td align="right">1 KiB</td><td align="left">[5 KiB, 6 KiB, 7 KiB, 8 KiB]</td></tr><tr><td align="right">2 KiB</td><td align="left">[10 KiB, 12 KiB, 14 KiB]</td></tr><tr><td rowspan="8" align="left">Large</td><td align="right">2 KiB</td><td align="left">[16 KiB]</td></tr><tr><td align="right">4 KiB</td><td align="left">[20 KiB, 24 KiB, 28 KiB, 32 KiB]</td></tr><tr><td align="right">8 KiB</td><td align="left">[40 KiB, 48 KiB, 54 KiB, 64 KiB]</td></tr><tr><td align="right">16 KiB</td><td align="left">[80 KiB, 96 KiB, 112 KiB, 128 KiB]</td></tr><tr><td align="right">32 KiB</td><td align="left">[160 KiB, 192 KiB, 224 KiB, 256 KiB]</td></tr><tr><td align="right">64 KiB</td><td align="left">[320 KiB, 384 KiB, 448 KiB, 512 KiB]</td></tr><tr><td align="right">128 KiB</td><td align="left">[640 KiB, 768 KiB, 896 KiB, 1 MiB]</td></tr><tr><td align="right">256 KiB</td><td align="left">[1280 KiB, 1536 KiB, 1792 KiB]</td></tr><tr><td rowspan="7" align="left">Huge</td><td align="right">256 KiB</td><td align="left">[2 MiB]</td></tr><tr><td align="right">512 KiB</td><td align="left">[2560 KiB, 3 MiB, 3584 KiB, 4 MiB]</td></tr><tr><td align="right">1 MiB</td><td align="left">[5 MiB, 6 MiB, 7 MiB, 8 MiB]</td></tr><tr><td align="right">2 MiB</td><td align="left">[10 MiB, 12 MiB, 14 MiB, 16 MiB]</td></tr><tr><td align="right">4 MiB</td><td align="left">[20 MiB, 24 MiB, 28 MiB, 32 MiB]</td></tr><tr><td align="right">8 MiB</td><td align="left">[40 MiB, 48 MiB, 56 MiB, 64 MiB]</td></tr><tr><td align="right">...</td><td align="left">...</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="mallctl_namespace"></a><h2>MALLCTL NAMESPACE</h2><p>The following names are defined in the namespace accessible via the 64-bit system, the size classes in each category are as shown in <a class="xref" href="#size_classes" title="Table 1. Size classes">Table 1</a>.</p><div class="table"><a name="size_classes"/><p class="title"><b>Table 1. Size classes</b></p><div class="table-contents"><table class="table" summary="Size classes" border="1"><colgroup><col align="left" class="c1"/><col align="right" class="c2"/><col align="left" class="c3"/></colgroup><thead><tr><th align="left">Category</th><th align="right">Spacing</th><th align="left">Size</th></tr></thead><tbody><tr><td rowspan="9" align="left">Small</td><td align="right">lg</td><td align="left">[8]</td></tr><tr><td align="right">16</td><td align="left">[16, 32, 48, 64, 80, 96, 112, 128]</td></tr><tr><td align="right">32</td><td align="left">[160, 192, 224, 256]</td></tr><tr><td align="right">64</td><td align="left">[320, 384, 448, 512]</td></tr><tr><td align="right">128</td><td align="left">[640, 768, 896, 1024]</td></tr><tr><td align="right">256</td><td align="left">[1280, 1536, 1792, 2048]</td></tr><tr><td align="right">512</td><td align="left">[2560, 3072, 3584, 4096]</td></tr><tr><td align="right">1 KiB</td><td align="left">[5 KiB, 6 KiB, 7 KiB, 8 KiB]</td></tr><tr><td align="right">2 KiB</td><td align="left">[10 KiB, 12 KiB, 14 KiB]</td></tr><tr><td rowspan="8" align="left">Large</td><td align="right">2 KiB</td><td align="left">[16 KiB]</td></tr><tr><td align="right">4 KiB</td><td align="left">[20 KiB, 24 KiB, 28 KiB, 32 KiB]</td></tr><tr><td align="right">8 KiB</td><td align="left">[40 KiB, 48 KiB, 54 KiB, 64 KiB]</td></tr><tr><td align="right">16 KiB</td><td align="left">[80 KiB, 96 KiB, 112 KiB, 128 KiB]</td></tr><tr><td align="right">32 KiB</td><td align="left">[160 KiB, 192 KiB, 224 KiB, 256 KiB]</td></tr><tr><td align="right">64 KiB</td><td align="left">[320 KiB, 384 KiB, 448 KiB, 512 KiB]</td></tr><tr><td align="right">128 KiB</td><td align="left">[640 KiB, 768 KiB, 896 KiB, 1 MiB]</td></tr><tr><td align="right">256 KiB</td><td align="left">[1280 KiB, 1536 KiB, 1792 KiB]</td></tr><tr><td rowspan="9" align="left">Huge</td><td align="right">256 KiB</td><td align="left">[2 MiB]</td></tr><tr><td align="right">512 KiB</td><td align="left">[2560 KiB, 3 MiB, 3584 KiB, 4 MiB]</td></tr><tr><td align="right">1 MiB</td><td align="left">[5 MiB, 6 MiB, 7 MiB, 8 MiB]</td></tr><tr><td align="right">2 MiB</td><td align="left">[10 MiB, 12 MiB, 14 MiB, 16 MiB]</td></tr><tr><td align="right">4 MiB</td><td align="left">[20 MiB, 24 MiB, 28 MiB, 32 MiB]</td></tr><tr><td align="right">8 MiB</td><td align="left">[40 MiB, 48 MiB, 56 MiB, 64 MiB]</td></tr><tr><td align="right">...</td><td align="left">...</td></tr><tr><td align="right">512 PiB</td><td align="left">[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]</td></tr><tr><td align="right">1 EiB</td><td align="left">[5 EiB, 6 EiB, 7 EiB]</td></tr></tbody></table></div></div><br class="table-break"/></div><div class="refsect1"><a name="mallctl_namespace"/><h2>MALLCTL NAMESPACE</h2><p>The following names are defined in the namespace accessible via the
<code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) functions. Value types are <code class="function">mallctl*()</code> functions. Value types are
specified in parentheses, their readable/writable statuses are encoded as specified in parentheses, their readable/writable statuses are encoded as
<code class="literal">rw</code>, <code class="literal">r-</code>, <code class="literal">-w</code>, or <code class="literal">rw</code>, <code class="literal">r-</code>, <code class="literal">-w</code>, or
<code class="literal">--</code>, and required build configuration flags follow, if <code class="literal">--</code>, and required build configuration flags follow, if
any. A name element encoded as <code class="literal">&lt;i&gt;</code> or any. A name element encoded as <code class="literal">&lt;i&gt;</code> or
<code class="literal">&lt;j&gt;</code> indicates an integer component, where the <code class="literal">&lt;j&gt;</code> indicates an integer component, where the
integer varies from 0 to some upper value that must be determined via integer varies from 0 to some upper value that must be determined via
introspection. In the case of introspection. In the case of <quote><code class="mallctl">stats.arenas.&lt;i&gt;.*</code></quote>,
"<code class="mallctl">stats.arenas.&lt;i&gt;.*</code>" <code class="literal">&lt;i&gt;</code> equal to <a class="link" href="#arenas.narenas"><quote><code class="mallctl">arenas.narenas</code></quote></a> can be
,
<code class="literal">&lt;i&gt;</code> equal to <a class="link" href="#arenas.narenas">
"<code class="mallctl">arenas.narenas</code>"
</a> can be
used to access the summation of statistics from all arenas. Take special used to access the summation of statistics from all arenas. Take special
note of the <a class="link" href="#epoch"> note of the <a class="link" href="#epoch"><quote><code class="mallctl">epoch</code></quote></a> mallctl,
"<code class="mallctl">epoch</code>" which controls refreshing of cached dynamic statistics.</p><div class="variablelist"><dl class="variablelist"><dt><a name="version"/><span class="term">
</a> mallctl, <quote><code class="mallctl">version</code></quote>
which controls refreshing of cached dynamic statistics.</p><div class="variablelist"><dl class="variablelist"><dt><a name="version"></a><span class="term">
"<code class="mallctl">version</code>"
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Return the jemalloc version string.</p></dd><dt><a name="epoch"></a><span class="term"> </span></dt><dd><p>Return the jemalloc version string.</p></dd><dt><a name="epoch"/><span class="term">
<quote><code class="mallctl">epoch</code></quote>
"<code class="mallctl">epoch</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
</span></dt><dd><p>If a value is passed in, refresh the data from which </span></dt><dd><p>If a value is passed in, refresh the data from which
the <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) functions report values, the <code class="function">mallctl*()</code> functions report values,
and increment the epoch. Return the current epoch. This is useful for and increment the epoch. Return the current epoch. This is useful for
detecting whether another thread caused a refresh.</p></dd><dt><a name="config.cache_oblivious"></a><span class="term"> detecting whether another thread caused a refresh.</p></dd><dt><a name="config.cache_oblivious"/><span class="term">
<quote><code class="mallctl">config.cache_oblivious</code></quote>
"<code class="mallctl">config.cache_oblivious</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-cache-oblivious</code> was specified </span></dt><dd><p><code class="option">--enable-cache-oblivious</code> was specified
during build configuration.</p></dd><dt><a name="config.debug"></a><span class="term"> during build configuration.</p></dd><dt><a name="config.debug"/><span class="term">
<quote><code class="mallctl">config.debug</code></quote>
"<code class="mallctl">config.debug</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-debug</code> was specified during </span></dt><dd><p><code class="option">--enable-debug</code> was specified during
build configuration.</p></dd><dt><a name="config.fill"></a><span class="term"> build configuration.</p></dd><dt><a name="config.fill"/><span class="term">
<quote><code class="mallctl">config.fill</code></quote>
"<code class="mallctl">config.fill</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-fill</code> was specified during </span></dt><dd><p><code class="option">--enable-fill</code> was specified during
build configuration.</p></dd><dt><a name="config.lazy_lock"></a><span class="term"> build configuration.</p></dd><dt><a name="config.lazy_lock"/><span class="term">
<quote><code class="mallctl">config.lazy_lock</code></quote>
"<code class="mallctl">config.lazy_lock</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-lazy-lock</code> was specified </span></dt><dd><p><code class="option">--enable-lazy-lock</code> was specified
during build configuration.</p></dd><dt><a name="config.munmap"></a><span class="term"> during build configuration.</p></dd><dt><a name="config.malloc_conf"/><span class="term">
<quote><code class="mallctl">config.malloc_conf</code></quote>
"<code class="mallctl">config.munmap</code>" (<span class="type">const char *</span>)
<code class="literal">r-</code>
</span></dt><dd><p>Embedded configure-time-specified run-time options
string, empty unless <code class="option">--with-malloc-conf</code> was specified
during build configuration.</p></dd><dt><a name="config.munmap"/><span class="term">
<quote><code class="mallctl">config.munmap</code></quote>
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-munmap</code> was specified during </span></dt><dd><p><code class="option">--enable-munmap</code> was specified during
build configuration.</p></dd><dt><a name="config.prof"></a><span class="term"> build configuration.</p></dd><dt><a name="config.prof"/><span class="term">
<quote><code class="mallctl">config.prof</code></quote>
"<code class="mallctl">config.prof</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-prof</code> was specified during </span></dt><dd><p><code class="option">--enable-prof</code> was specified during
build configuration.</p></dd><dt><a name="config.prof_libgcc"></a><span class="term"> build configuration.</p></dd><dt><a name="config.prof_libgcc"/><span class="term">
<quote><code class="mallctl">config.prof_libgcc</code></quote>
"<code class="mallctl">config.prof_libgcc</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--disable-prof-libgcc</code> was not </span></dt><dd><p><code class="option">--disable-prof-libgcc</code> was not
specified during build configuration.</p></dd><dt><a name="config.prof_libunwind"></a><span class="term"> specified during build configuration.</p></dd><dt><a name="config.prof_libunwind"/><span class="term">
<quote><code class="mallctl">config.prof_libunwind</code></quote>
"<code class="mallctl">config.prof_libunwind</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-prof-libunwind</code> was specified </span></dt><dd><p><code class="option">--enable-prof-libunwind</code> was specified
during build configuration.</p></dd><dt><a name="config.stats"></a><span class="term"> during build configuration.</p></dd><dt><a name="config.stats"/><span class="term">
<quote><code class="mallctl">config.stats</code></quote>
"<code class="mallctl">config.stats</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-stats</code> was specified during </span></dt><dd><p><code class="option">--enable-stats</code> was specified during
build configuration.</p></dd><dt><a name="config.tcache"></a><span class="term"> build configuration.</p></dd><dt><a name="config.tcache"/><span class="term">
<quote><code class="mallctl">config.tcache</code></quote>
"<code class="mallctl">config.tcache</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--disable-tcache</code> was not specified </span></dt><dd><p><code class="option">--disable-tcache</code> was not specified
during build configuration.</p></dd><dt><a name="config.tls"></a><span class="term"> during build configuration.</p></dd><dt><a name="config.tls"/><span class="term">
<quote><code class="mallctl">config.tls</code></quote>
"<code class="mallctl">config.tls</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--disable-tls</code> was not specified during </span></dt><dd><p><code class="option">--disable-tls</code> was not specified during
build configuration.</p></dd><dt><a name="config.utrace"></a><span class="term"> build configuration.</p></dd><dt><a name="config.utrace"/><span class="term">
<quote><code class="mallctl">config.utrace</code></quote>
"<code class="mallctl">config.utrace</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-utrace</code> was specified during </span></dt><dd><p><code class="option">--enable-utrace</code> was specified during
build configuration.</p></dd><dt><a name="config.valgrind"></a><span class="term"> build configuration.</p></dd><dt><a name="config.valgrind"/><span class="term">
<quote><code class="mallctl">config.valgrind</code></quote>
"<code class="mallctl">config.valgrind</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-valgrind</code> was specified during </span></dt><dd><p><code class="option">--enable-valgrind</code> was specified during
build configuration.</p></dd><dt><a name="config.xmalloc"></a><span class="term"> build configuration.</p></dd><dt><a name="config.xmalloc"/><span class="term">
<quote><code class="mallctl">config.xmalloc</code></quote>
"<code class="mallctl">config.xmalloc</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p><code class="option">--enable-xmalloc</code> was specified during </span></dt><dd><p><code class="option">--enable-xmalloc</code> was specified during
build configuration.</p></dd><dt><a name="opt.abort"></a><span class="term"> build configuration.</p></dd><dt><a name="opt.abort"/><span class="term">
<quote><code class="mallctl">opt.abort</code></quote>
"<code class="mallctl">opt.abort</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Abort-on-warning enabled/disabled. If true, most </span></dt><dd><p>Abort-on-warning enabled/disabled. If true, most
...@@ -437,43 +390,42 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -437,43 +390,42 @@ for (i = 0; i &lt; nbins; i++) {
<span class="citerefentry"><span class="refentrytitle">abort</span>(3)</span> in these cases. This option is <span class="citerefentry"><span class="refentrytitle">abort</span>(3)</span> in these cases. This option is
disabled by default unless <code class="option">--enable-debug</code> is disabled by default unless <code class="option">--enable-debug</code> is
specified during configuration, in which case it is enabled by default. specified during configuration, in which case it is enabled by default.
</p></dd><dt><a name="opt.dss"></a><span class="term"> </p></dd><dt><a name="opt.dss"/><span class="term">
<quote><code class="mallctl">opt.dss</code></quote>
"<code class="mallctl">opt.dss</code>"
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>dss (<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>) allocation precedence as </span></dt><dd><p>dss (<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>) allocation precedence as
related to <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> allocation. The following related to <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> allocation. The following
settings are supported if settings are supported if
<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> is supported by the operating <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> is supported by the operating
system: &#8220;disabled&#8221;, &#8220;primary&#8221;, and system: <span class="quote"><span class="quote">disabled</span></span>, <span class="quote"><span class="quote">primary</span></span>, and
&#8220;secondary&#8221;; otherwise only &#8220;disabled&#8221; is <span class="quote"><span class="quote">secondary</span></span>; otherwise only <span class="quote"><span class="quote">disabled</span></span> is
supported. The default is &#8220;secondary&#8221; if supported. The default is <span class="quote"><span class="quote">secondary</span></span> if
<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> is supported by the operating <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> is supported by the operating
system; &#8220;disabled&#8221; otherwise. system; <span class="quote"><span class="quote">disabled</span></span> otherwise.
</p></dd><dt><a name="opt.lg_chunk"></a><span class="term"> </p></dd><dt><a name="opt.lg_chunk"/><span class="term">
<quote><code class="mallctl">opt.lg_chunk</code></quote>
"<code class="mallctl">opt.lg_chunk</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Virtual memory chunk size (log base 2). If a chunk </span></dt><dd><p>Virtual memory chunk size (log base 2). If a chunk
size outside the supported size range is specified, the size is size outside the supported size range is specified, the size is
silently clipped to the minimum/maximum supported size. The default silently clipped to the minimum/maximum supported size. The default
chunk size is 2 MiB (2^21). chunk size is 2 MiB (2^21).
</p></dd><dt><a name="opt.narenas"></a><span class="term"> </p></dd><dt><a name="opt.narenas"/><span class="term">
<quote><code class="mallctl">opt.narenas</code></quote>
"<code class="mallctl">opt.narenas</code>" (<span class="type">unsigned</span>)
(<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Maximum number of arenas to use for automatic </span></dt><dd><p>Maximum number of arenas to use for automatic
multiplexing of threads and arenas. The default is four times the multiplexing of threads and arenas. The default is four times the
number of CPUs, or one if there is a single CPU.</p></dd><dt><a name="opt.lg_dirty_mult"></a><span class="term"> number of CPUs, or one if there is a single CPU.</p></dd><dt><a name="opt.purge"/><span class="term">
<quote><code class="mallctl">opt.purge</code></quote>
"<code class="mallctl">opt.lg_dirty_mult</code>" (<span class="type">const char *</span>)
<code class="literal">r-</code>
</span></dt><dd><p>Purge mode is “ratio” (default) or
“decay”. See <a class="link" href="#opt.lg_dirty_mult"><quote><code class="mallctl">opt.lg_dirty_mult</code></quote></a>
for details of the ratio mode. See <a class="link" href="#opt.decay_time"><quote><code class="mallctl">opt.decay_time</code></quote></a> for
details of the decay mode.</p></dd><dt><a name="opt.lg_dirty_mult"/><span class="term">
<quote><code class="mallctl">opt.lg_dirty_mult</code></quote>
(<span class="type">ssize_t</span>) (<span class="type">ssize_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Per-arena minimum ratio (log base 2) of active to dirty </span></dt><dd><p>Per-arena minimum ratio (log base 2) of active to dirty
...@@ -484,53 +436,57 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -484,53 +436,57 @@ for (i = 0; i &lt; nbins; i++) {
provides the kernel with sufficient information to recycle dirty pages provides the kernel with sufficient information to recycle dirty pages
if physical memory becomes scarce and the pages remain unused. The if physical memory becomes scarce and the pages remain unused. The
default minimum ratio is 8:1 (2^3:1); an option value of -1 will default minimum ratio is 8:1 (2^3:1); an option value of -1 will
disable dirty page purging. See <a class="link" href="#arenas.lg_dirty_mult"> disable dirty page purging. See <a class="link" href="#arenas.lg_dirty_mult"><quote><code class="mallctl">arenas.lg_dirty_mult</code></quote></a>
"<code class="mallctl">arenas.lg_dirty_mult</code>" and <a class="link" href="#arena.i.lg_dirty_mult"><quote><code class="mallctl">arena.&lt;i&gt;.lg_dirty_mult</code></quote></a>
</a> for related dynamic control options.</p></dd><dt><a name="opt.decay_time"/><span class="term">
and <a class="link" href="#arena.i.lg_dirty_mult"> <quote><code class="mallctl">opt.decay_time</code></quote>
"<code class="mallctl">arena.&lt;i&gt;.lg_dirty_mult</code>" (<span class="type">ssize_t</span>)
</a> <code class="literal">r-</code>
for related dynamic control options.</p></dd><dt><a name="opt.stats_print"></a><span class="term"> </span></dt><dd><p>Approximate time in seconds from the creation of a set
of unused dirty pages until an equivalent set of unused dirty pages is
"<code class="mallctl">opt.stats_print</code>" purged and/or reused. The pages are incrementally purged according to a
sigmoidal decay curve that starts and ends with zero purge rate. A
decay time of 0 causes all unused dirty pages to be purged immediately
upon creation. A decay time of -1 disables purging. The default decay
time is 10 seconds. See <a class="link" href="#arenas.decay_time"><quote><code class="mallctl">arenas.decay_time</code></quote></a>
and <a class="link" href="#arena.i.decay_time"><quote><code class="mallctl">arena.&lt;i&gt;.decay_time</code></quote></a>
for related dynamic control options.
</p></dd><dt><a name="opt.stats_print"/><span class="term">
<quote><code class="mallctl">opt.stats_print</code></quote>
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Enable/disable statistics printing at exit. If </span></dt><dd><p>Enable/disable statistics printing at exit. If
enabled, the <code class="function">malloc_stats_print</code>(<em class="parameter"><code></code></em>) enabled, the <code class="function">malloc_stats_print()</code>
function is called at program exit via an function is called at program exit via an
<span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function. If <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function. If
<code class="option">--enable-stats</code> is specified during configuration, this <code class="option">--enable-stats</code> is specified during configuration, this
has the potential to cause deadlock for a multi-threaded process that has the potential to cause deadlock for a multi-threaded process that
exits while one or more threads are executing in the memory allocation exits while one or more threads are executing in the memory allocation
functions. Furthermore, <code class="function">atexit</code>(<em class="parameter"><code></code></em>) may functions. Furthermore, <code class="function">atexit()</code> may
allocate memory during application initialization and then deadlock allocate memory during application initialization and then deadlock
internally when jemalloc in turn calls internally when jemalloc in turn calls
<code class="function">atexit</code>(<em class="parameter"><code></code></em>), so this option is not <code class="function">atexit()</code>, so this option is not
univerally usable (though the application can register its own universally usable (though the application can register its own
<code class="function">atexit</code>(<em class="parameter"><code></code></em>) function with equivalent <code class="function">atexit()</code> function with equivalent
functionality). Therefore, this option should only be used with care; functionality). Therefore, this option should only be used with care;
it is primarily intended as a performance tuning aid during application it is primarily intended as a performance tuning aid during application
development. This option is disabled by default.</p></dd><dt><a name="opt.junk"></a><span class="term"> development. This option is disabled by default.</p></dd><dt><a name="opt.junk"/><span class="term">
<quote><code class="mallctl">opt.junk</code></quote>
"<code class="mallctl">opt.junk</code>"
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-fill</code>] [<code class="option">--enable-fill</code>]
</span></dt><dd><p>Junk filling. If set to "alloc", each byte of </span></dt><dd><p>Junk filling. If set to <span class="quote"><span class="quote">alloc</span></span>, each byte
uninitialized allocated memory will be initialized to of uninitialized allocated memory will be initialized to
<code class="literal">0xa5</code>. If set to "free", all deallocated memory will <code class="literal">0xa5</code>. If set to <span class="quote"><span class="quote">free</span></span>, all deallocated
be initialized to <code class="literal">0x5a</code>. If set to "true", both memory will be initialized to <code class="literal">0x5a</code>. If set to
allocated and deallocated memory will be initialized, and if set to <span class="quote"><span class="quote">true</span></span>, both allocated and deallocated memory will be
"false", junk filling be disabled entirely. This is intended for initialized, and if set to <span class="quote"><span class="quote">false</span></span>, junk filling be
debugging and will impact performance negatively. This option is disabled entirely. This is intended for debugging and will impact
"false" by default unless <code class="option">--enable-debug</code> is specified performance negatively. This option is <span class="quote"><span class="quote">false</span></span> by default
during configuration, in which case it is "true" by default unless unless <code class="option">--enable-debug</code> is specified during
running inside <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>.</p></dd><dt><a name="opt.quarantine"></a><span class="term"> configuration, in which case it is <span class="quote"><span class="quote">true</span></span> by default unless
running inside <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>.</p></dd><dt><a name="opt.quarantine"/><span class="term">
"<code class="mallctl">opt.quarantine</code>" <quote><code class="mallctl">opt.quarantine</code></quote>
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-fill</code>] [<code class="option">--enable-fill</code>]
...@@ -538,58 +494,46 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -538,58 +494,46 @@ for (i = 0; i &lt; nbins; i++) {
thread maintains a FIFO object quarantine that stores up to the thread maintains a FIFO object quarantine that stores up to the
specified number of bytes of memory. The quarantined memory is not specified number of bytes of memory. The quarantined memory is not
freed until it is released from quarantine, though it is immediately freed until it is released from quarantine, though it is immediately
junk-filled if the <a class="link" href="#opt.junk"> junk-filled if the <a class="link" href="#opt.junk"><quote><code class="mallctl">opt.junk</code></quote></a> option is
"<code class="mallctl">opt.junk</code>"
</a> option is
enabled. This feature is of particular use in combination with <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>, which can detect attempts enabled. This feature is of particular use in combination with <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>, which can detect attempts
to access quarantined objects. This is intended for debugging and will to access quarantined objects. This is intended for debugging and will
impact performance negatively. The default quarantine size is 0 unless impact performance negatively. The default quarantine size is 0 unless
running inside Valgrind, in which case the default is 16 running inside Valgrind, in which case the default is 16
MiB.</p></dd><dt><a name="opt.redzone"></a><span class="term"> MiB.</p></dd><dt><a name="opt.redzone"/><span class="term">
<quote><code class="mallctl">opt.redzone</code></quote>
"<code class="mallctl">opt.redzone</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-fill</code>] [<code class="option">--enable-fill</code>]
</span></dt><dd><p>Redzones enabled/disabled. If enabled, small </span></dt><dd><p>Redzones enabled/disabled. If enabled, small
allocations have redzones before and after them. Furthermore, if the allocations have redzones before and after them. Furthermore, if the
<a class="link" href="#opt.junk"> <a class="link" href="#opt.junk"><quote><code class="mallctl">opt.junk</code></quote></a> option is
"<code class="mallctl">opt.junk</code>"
</a> option is
enabled, the redzones are checked for corruption during deallocation. enabled, the redzones are checked for corruption during deallocation.
However, the primary intended purpose of this feature is to be used in However, the primary intended purpose of this feature is to be used in
combination with <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>, combination with <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>,
which needs redzones in order to do effective buffer overflow/underflow which needs redzones in order to do effective buffer overflow/underflow
detection. This option is intended for debugging and will impact detection. This option is intended for debugging and will impact
performance negatively. This option is disabled by performance negatively. This option is disabled by
default unless running inside Valgrind.</p></dd><dt><a name="opt.zero"></a><span class="term"> default unless running inside Valgrind.</p></dd><dt><a name="opt.zero"/><span class="term">
<quote><code class="mallctl">opt.zero</code></quote>
"<code class="mallctl">opt.zero</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-fill</code>] [<code class="option">--enable-fill</code>]
</span></dt><dd><p>Zero filling enabled/disabled. If enabled, each byte </span></dt><dd><p>Zero filling enabled/disabled. If enabled, each byte
of uninitialized allocated memory will be initialized to 0. Note that of uninitialized allocated memory will be initialized to 0. Note that
this initialization only happens once for each byte, so this initialization only happens once for each byte, so
<code class="function">realloc</code>(<em class="parameter"><code></code></em>) and <code class="function">realloc()</code> and
<code class="function">rallocx</code>(<em class="parameter"><code></code></em>) calls do not zero memory that <code class="function">rallocx()</code> calls do not zero memory that
was previously allocated. This is intended for debugging and will was previously allocated. This is intended for debugging and will
impact performance negatively. This option is disabled by default. impact performance negatively. This option is disabled by default.
</p></dd><dt><a name="opt.utrace"></a><span class="term"> </p></dd><dt><a name="opt.utrace"/><span class="term">
<quote><code class="mallctl">opt.utrace</code></quote>
"<code class="mallctl">opt.utrace</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-utrace</code>] [<code class="option">--enable-utrace</code>]
</span></dt><dd><p>Allocation tracing based on </span></dt><dd><p>Allocation tracing based on
<span class="citerefentry"><span class="refentrytitle">utrace</span>(2)</span> enabled/disabled. This option <span class="citerefentry"><span class="refentrytitle">utrace</span>(2)</span> enabled/disabled. This option
is disabled by default.</p></dd><dt><a name="opt.xmalloc"></a><span class="term"> is disabled by default.</p></dd><dt><a name="opt.xmalloc"/><span class="term">
<quote><code class="mallctl">opt.xmalloc</code></quote>
"<code class="mallctl">opt.xmalloc</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-xmalloc</code>] [<code class="option">--enable-xmalloc</code>]
...@@ -602,10 +546,8 @@ for (i = 0; i &lt; nbins; i++) { ...@@ -602,10 +546,8 @@ for (i = 0; i &lt; nbins; i++) {
including the following in the source code: including the following in the source code:
</p><pre class="programlisting"> </p><pre class="programlisting">
malloc_conf = "xmalloc:true";</pre><p> malloc_conf = "xmalloc:true";</pre><p>
This option is disabled by default.</p></dd><dt><a name="opt.tcache"></a><span class="term"> This option is disabled by default.</p></dd><dt><a name="opt.tcache"/><span class="term">
<quote><code class="mallctl">opt.tcache</code></quote>
"<code class="mallctl">opt.tcache</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
...@@ -613,55 +555,36 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -613,55 +555,36 @@ malloc_conf = "xmalloc:true";</pre><p>
there are multiple threads, each thread uses a tcache for objects up to there are multiple threads, each thread uses a tcache for objects up to
a certain size. Thread-specific caching allows many allocations to be a certain size. Thread-specific caching allows many allocations to be
satisfied without performing any thread synchronization, at the cost of satisfied without performing any thread synchronization, at the cost of
increased memory use. See the <a class="link" href="#opt.lg_tcache_max"> increased memory use. See the <a class="link" href="#opt.lg_tcache_max"><quote><code class="mallctl">opt.lg_tcache_max</code></quote></a>
"<code class="mallctl">opt.lg_tcache_max</code>"
</a>
option for related tuning information. This option is enabled by option for related tuning information. This option is enabled by
default unless running inside <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>, in which case it is default unless running inside <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a>, in which case it is
forcefully disabled.</p></dd><dt><a name="opt.lg_tcache_max"></a><span class="term"> forcefully disabled.</p></dd><dt><a name="opt.lg_tcache_max"/><span class="term">
<quote><code class="mallctl">opt.lg_tcache_max</code></quote>
"<code class="mallctl">opt.lg_tcache_max</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
</span></dt><dd><p>Maximum size class (log base 2) to cache in the </span></dt><dd><p>Maximum size class (log base 2) to cache in the
thread-specific cache (tcache). At a minimum, all small size classes thread-specific cache (tcache). At a minimum, all small size classes
are cached, and at a maximum all large size classes are cached. The are cached, and at a maximum all large size classes are cached. The
default maximum is 32 KiB (2^15).</p></dd><dt><a name="opt.prof"></a><span class="term"> default maximum is 32 KiB (2^15).</p></dd><dt><a name="opt.prof"/><span class="term">
<quote><code class="mallctl">opt.prof</code></quote>
"<code class="mallctl">opt.prof</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Memory profiling enabled/disabled. If enabled, profile </span></dt><dd><p>Memory profiling enabled/disabled. If enabled, profile
memory allocation activity. See the <a class="link" href="#opt.prof_active"> memory allocation activity. See the <a class="link" href="#opt.prof_active"><quote><code class="mallctl">opt.prof_active</code></quote></a>
"<code class="mallctl">opt.prof_active</code>" option for on-the-fly activation/deactivation. See the <a class="link" href="#opt.lg_prof_sample"><quote><code class="mallctl">opt.lg_prof_sample</code></quote></a>
</a> option for probabilistic sampling control. See the <a class="link" href="#opt.prof_accum"><quote><code class="mallctl">opt.prof_accum</code></quote></a>
option for on-the-fly activation/deactivation. See the <a class="link" href="#opt.lg_prof_sample"> option for control of cumulative sample reporting. See the <a class="link" href="#opt.lg_prof_interval"><quote><code class="mallctl">opt.lg_prof_interval</code></quote></a>
"<code class="mallctl">opt.lg_prof_sample</code>" option for information on interval-triggered profile dumping, the <a class="link" href="#opt.prof_gdump"><quote><code class="mallctl">opt.prof_gdump</code></quote></a>
</a>
option for probabilistic sampling control. See the <a class="link" href="#opt.prof_accum">
"<code class="mallctl">opt.prof_accum</code>"
</a>
option for control of cumulative sample reporting. See the <a class="link" href="#opt.lg_prof_interval">
"<code class="mallctl">opt.lg_prof_interval</code>"
</a>
option for information on interval-triggered profile dumping, the <a class="link" href="#opt.prof_gdump">
"<code class="mallctl">opt.prof_gdump</code>"
</a>
option for information on high-water-triggered profile dumping, and the option for information on high-water-triggered profile dumping, and the
<a class="link" href="#opt.prof_final"> <a class="link" href="#opt.prof_final"><quote><code class="mallctl">opt.prof_final</code></quote></a>
"<code class="mallctl">opt.prof_final</code>"
</a>
option for final profile dumping. Profile output is compatible with option for final profile dumping. Profile output is compatible with
the <span class="command"><strong>jeprof</strong></span> command, which is based on the the <span class="command"><strong>jeprof</strong></span> command, which is based on the
<span class="command"><strong>pprof</strong></span> that is developed as part of the <a class="ulink" href="http://code.google.com/p/gperftools/" target="_top">gperftools <span class="command"><strong>pprof</strong></span> that is developed as part of the <a class="ulink" href="http://code.google.com/p/gperftools/" target="_top">gperftools
package</a>.</p></dd><dt><a name="opt.prof_prefix"></a><span class="term"> package</a>. See <a class="link" href="#heap_profile_format" title="HEAP PROFILE FORMAT">HEAP PROFILE
FORMAT</a> for heap profile format documentation.</p></dd><dt><a name="opt.prof_prefix"/><span class="term">
"<code class="mallctl">opt.prof_prefix</code>" <quote><code class="mallctl">opt.prof_prefix</code></quote>
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -669,40 +592,26 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -669,40 +592,26 @@ malloc_conf = "xmalloc:true";</pre><p>
set to the empty string, no automatic dumps will occur; this is set to the empty string, no automatic dumps will occur; this is
primarily useful for disabling the automatic final heap dump (which primarily useful for disabling the automatic final heap dump (which
also disables leak reporting, if enabled). The default prefix is also disables leak reporting, if enabled). The default prefix is
<code class="filename">jeprof</code>.</p></dd><dt><a name="opt.prof_active"></a><span class="term"> <code class="filename">jeprof</code>.</p></dd><dt><a name="opt.prof_active"/><span class="term">
<quote><code class="mallctl">opt.prof_active</code></quote>
"<code class="mallctl">opt.prof_active</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Profiling activated/deactivated. This is a secondary </span></dt><dd><p>Profiling activated/deactivated. This is a secondary
control mechanism that makes it possible to start the application with control mechanism that makes it possible to start the application with
profiling enabled (see the <a class="link" href="#opt.prof"> profiling enabled (see the <a class="link" href="#opt.prof"><quote><code class="mallctl">opt.prof</code></quote></a> option) but
"<code class="mallctl">opt.prof</code>"
</a> option) but
inactive, then toggle profiling at any time during program execution inactive, then toggle profiling at any time during program execution
with the <a class="link" href="#prof.active"> with the <a class="link" href="#prof.active"><quote><code class="mallctl">prof.active</code></quote></a> mallctl.
"<code class="mallctl">prof.active</code>" This option is enabled by default.</p></dd><dt><a name="opt.prof_thread_active_init"/><span class="term">
</a> mallctl. <quote><code class="mallctl">opt.prof_thread_active_init</code></quote>
This option is enabled by default.</p></dd><dt><a name="opt.prof_thread_active_init"></a><span class="term">
"<code class="mallctl">opt.prof_thread_active_init</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Initial setting for <a class="link" href="#thread.prof.active"> </span></dt><dd><p>Initial setting for <a class="link" href="#thread.prof.active"><quote><code class="mallctl">thread.prof.active</code></quote></a>
"<code class="mallctl">thread.prof.active</code>"
</a>
in newly created threads. The initial setting for newly created threads in newly created threads. The initial setting for newly created threads
can also be changed during execution via the <a class="link" href="#prof.thread_active_init"> can also be changed during execution via the <a class="link" href="#prof.thread_active_init"><quote><code class="mallctl">prof.thread_active_init</code></quote></a>
"<code class="mallctl">prof.thread_active_init</code>" mallctl. This option is enabled by default.</p></dd><dt><a name="opt.lg_prof_sample"/><span class="term">
</a> <quote><code class="mallctl">opt.lg_prof_sample</code></quote>
mallctl. This option is enabled by default.</p></dd><dt><a name="opt.lg_prof_sample"></a><span class="term">
"<code class="mallctl">opt.lg_prof_sample</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -710,10 +619,8 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -710,10 +619,8 @@ malloc_conf = "xmalloc:true";</pre><p>
samples, as measured in bytes of allocation activity. Increasing the samples, as measured in bytes of allocation activity. Increasing the
sampling interval decreases profile fidelity, but also decreases the sampling interval decreases profile fidelity, but also decreases the
computational overhead. The default sample interval is 512 KiB (2^19 computational overhead. The default sample interval is 512 KiB (2^19
B).</p></dd><dt><a name="opt.prof_accum"></a><span class="term"> B).</p></dd><dt><a name="opt.prof_accum"/><span class="term">
<quote><code class="mallctl">opt.prof_accum</code></quote>
"<code class="mallctl">opt.prof_accum</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -722,10 +629,8 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -722,10 +629,8 @@ malloc_conf = "xmalloc:true";</pre><p>
backtrace must be stored for the duration of execution. Depending on backtrace must be stored for the duration of execution. Depending on
the application, this can impose a large memory overhead, and the the application, this can impose a large memory overhead, and the
cumulative counts are not always of interest. This option is disabled cumulative counts are not always of interest. This option is disabled
by default.</p></dd><dt><a name="opt.lg_prof_interval"></a><span class="term"> by default.</p></dd><dt><a name="opt.lg_prof_interval"/><span class="term">
<quote><code class="mallctl">opt.lg_prof_interval</code></quote>
"<code class="mallctl">opt.lg_prof_interval</code>"
(<span class="type">ssize_t</span>) (<span class="type">ssize_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -736,27 +641,19 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -736,27 +641,19 @@ malloc_conf = "xmalloc:true";</pre><p>
dumped to files named according to the pattern dumped to files named according to the pattern
<code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.i&lt;iseq&gt;.heap</code>, <code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.i&lt;iseq&gt;.heap</code>,
where <code class="literal">&lt;prefix&gt;</code> is controlled by the where <code class="literal">&lt;prefix&gt;</code> is controlled by the
<a class="link" href="#opt.prof_prefix"> <a class="link" href="#opt.prof_prefix"><quote><code class="mallctl">opt.prof_prefix</code></quote></a>
"<code class="mallctl">opt.prof_prefix</code>"
</a>
option. By default, interval-triggered profile dumping is disabled option. By default, interval-triggered profile dumping is disabled
(encoded as -1). (encoded as -1).
</p></dd><dt><a name="opt.prof_gdump"></a><span class="term"> </p></dd><dt><a name="opt.prof_gdump"/><span class="term">
<quote><code class="mallctl">opt.prof_gdump</code></quote>
"<code class="mallctl">opt.prof_gdump</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Set the initial state of <a class="link" href="#prof.gdump"> </span></dt><dd><p>Set the initial state of <a class="link" href="#prof.gdump"><quote><code class="mallctl">prof.gdump</code></quote></a>, which when
"<code class="mallctl">prof.gdump</code>"
</a>, which when
enabled triggers a memory profile dump every time the total virtual enabled triggers a memory profile dump every time the total virtual
memory exceeds the previous maximum. This option is disabled by memory exceeds the previous maximum. This option is disabled by
default.</p></dd><dt><a name="opt.prof_final"></a><span class="term"> default.</p></dd><dt><a name="opt.prof_final"/><span class="term">
<quote><code class="mallctl">opt.prof_final</code></quote>
"<code class="mallctl">opt.prof_final</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -764,101 +661,73 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -764,101 +661,73 @@ malloc_conf = "xmalloc:true";</pre><p>
<span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function to dump final memory <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function to dump final memory
usage to a file named according to the pattern usage to a file named according to the pattern
<code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</code>, <code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</code>,
where <code class="literal">&lt;prefix&gt;</code> is controlled by the <a class="link" href="#opt.prof_prefix"> where <code class="literal">&lt;prefix&gt;</code> is controlled by the <a class="link" href="#opt.prof_prefix"><quote><code class="mallctl">opt.prof_prefix</code></quote></a>
"<code class="mallctl">opt.prof_prefix</code>" option. Note that <code class="function">atexit()</code> may allocate
</a>
option. Note that <code class="function">atexit</code>(<em class="parameter"><code></code></em>) may allocate
memory during application initialization and then deadlock internally memory during application initialization and then deadlock internally
when jemalloc in turn calls <code class="function">atexit</code>(<em class="parameter"><code></code></em>), so when jemalloc in turn calls <code class="function">atexit()</code>, so
this option is not univerally usable (though the application can this option is not universally usable (though the application can
register its own <code class="function">atexit</code>(<em class="parameter"><code></code></em>) function with register its own <code class="function">atexit()</code> function with
equivalent functionality). This option is disabled by equivalent functionality). This option is disabled by
default.</p></dd><dt><a name="opt.prof_leak"></a><span class="term"> default.</p></dd><dt><a name="opt.prof_leak"/><span class="term">
<quote><code class="mallctl">opt.prof_leak</code></quote>
"<code class="mallctl">opt.prof_leak</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Leak reporting enabled/disabled. If enabled, use an </span></dt><dd><p>Leak reporting enabled/disabled. If enabled, use an
<span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function to report memory leaks <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function to report memory leaks
detected by allocation sampling. See the detected by allocation sampling. See the
<a class="link" href="#opt.prof"> <a class="link" href="#opt.prof"><quote><code class="mallctl">opt.prof</code></quote></a> option for
"<code class="mallctl">opt.prof</code>"
</a> option for
information on analyzing heap profile output. This option is disabled information on analyzing heap profile output. This option is disabled
by default.</p></dd><dt><a name="thread.arena"></a><span class="term"> by default.</p></dd><dt><a name="thread.arena"/><span class="term">
<quote><code class="mallctl">thread.arena</code></quote>
"<code class="mallctl">thread.arena</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
</span></dt><dd><p>Get or set the arena associated with the calling </span></dt><dd><p>Get or set the arena associated with the calling
thread. If the specified arena was not initialized beforehand (see the thread. If the specified arena was not initialized beforehand (see the
<a class="link" href="#arenas.initialized"> <a class="link" href="#arenas.initialized"><quote><code class="mallctl">arenas.initialized</code></quote></a>
"<code class="mallctl">arenas.initialized</code>"
</a>
mallctl), it will be automatically initialized as a side effect of mallctl), it will be automatically initialized as a side effect of
calling this interface.</p></dd><dt><a name="thread.allocated"></a><span class="term"> calling this interface.</p></dd><dt><a name="thread.allocated"/><span class="term">
<quote><code class="mallctl">thread.allocated</code></quote>
"<code class="mallctl">thread.allocated</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Get the total number of bytes ever allocated by the </span></dt><dd><p>Get the total number of bytes ever allocated by the
calling thread. This counter has the potential to wrap around; it is calling thread. This counter has the potential to wrap around; it is
up to the application to appropriately interpret the counter in such up to the application to appropriately interpret the counter in such
cases.</p></dd><dt><a name="thread.allocatedp"></a><span class="term"> cases.</p></dd><dt><a name="thread.allocatedp"/><span class="term">
<quote><code class="mallctl">thread.allocatedp</code></quote>
"<code class="mallctl">thread.allocatedp</code>"
(<span class="type">uint64_t *</span>) (<span class="type">uint64_t *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Get a pointer to the the value that is returned by the </span></dt><dd><p>Get a pointer to the the value that is returned by the
<a class="link" href="#thread.allocated"> <a class="link" href="#thread.allocated"><quote><code class="mallctl">thread.allocated</code></quote></a>
"<code class="mallctl">thread.allocated</code>"
</a>
mallctl. This is useful for avoiding the overhead of repeated mallctl. This is useful for avoiding the overhead of repeated
<code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) calls.</p></dd><dt><a name="thread.deallocated"></a><span class="term"> <code class="function">mallctl*()</code> calls.</p></dd><dt><a name="thread.deallocated"/><span class="term">
<quote><code class="mallctl">thread.deallocated</code></quote>
"<code class="mallctl">thread.deallocated</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Get the total number of bytes ever deallocated by the </span></dt><dd><p>Get the total number of bytes ever deallocated by the
calling thread. This counter has the potential to wrap around; it is calling thread. This counter has the potential to wrap around; it is
up to the application to appropriately interpret the counter in such up to the application to appropriately interpret the counter in such
cases.</p></dd><dt><a name="thread.deallocatedp"></a><span class="term"> cases.</p></dd><dt><a name="thread.deallocatedp"/><span class="term">
<quote><code class="mallctl">thread.deallocatedp</code></quote>
"<code class="mallctl">thread.deallocatedp</code>"
(<span class="type">uint64_t *</span>) (<span class="type">uint64_t *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Get a pointer to the the value that is returned by the </span></dt><dd><p>Get a pointer to the the value that is returned by the
<a class="link" href="#thread.deallocated"> <a class="link" href="#thread.deallocated"><quote><code class="mallctl">thread.deallocated</code></quote></a>
"<code class="mallctl">thread.deallocated</code>"
</a>
mallctl. This is useful for avoiding the overhead of repeated mallctl. This is useful for avoiding the overhead of repeated
<code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) calls.</p></dd><dt><a name="thread.tcache.enabled"></a><span class="term"> <code class="function">mallctl*()</code> calls.</p></dd><dt><a name="thread.tcache.enabled"/><span class="term">
<quote><code class="mallctl">thread.tcache.enabled</code></quote>
"<code class="mallctl">thread.tcache.enabled</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
</span></dt><dd><p>Enable/disable calling thread's tcache. The tcache is </span></dt><dd><p>Enable/disable calling thread's tcache. The tcache is
implicitly flushed as a side effect of becoming implicitly flushed as a side effect of becoming
disabled (see <a class="link" href="#thread.tcache.flush"> disabled (see <a class="link" href="#thread.tcache.flush"><quote><code class="mallctl">thread.tcache.flush</code></quote></a>).
"<code class="mallctl">thread.tcache.flush</code>" </p></dd><dt><a name="thread.tcache.flush"/><span class="term">
</a>). <quote><code class="mallctl">thread.tcache.flush</code></quote>
</p></dd><dt><a name="thread.tcache.flush"></a><span class="term">
"<code class="mallctl">thread.tcache.flush</code>"
(<span class="type">void</span>) (<span class="type">void</span>)
<code class="literal">--</code> <code class="literal">--</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
...@@ -870,10 +739,8 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -870,10 +739,8 @@ malloc_conf = "xmalloc:true";</pre><p>
a thread exits. However, garbage collection is triggered by allocation a thread exits. However, garbage collection is triggered by allocation
activity, so it is possible for a thread that stops activity, so it is possible for a thread that stops
allocating/deallocating to retain its cache indefinitely, in which case allocating/deallocating to retain its cache indefinitely, in which case
the developer may find manual flushing useful.</p></dd><dt><a name="thread.prof.name"></a><span class="term"> the developer may find manual flushing useful.</p></dd><dt><a name="thread.prof.name"/><span class="term">
<quote><code class="mallctl">thread.prof.name</code></quote>
"<code class="mallctl">thread.prof.name</code>"
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">r-</code> or <code class="literal">r-</code> or
<code class="literal">-w</code> <code class="literal">-w</code>
...@@ -886,25 +753,19 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -886,25 +753,19 @@ malloc_conf = "xmalloc:true";</pre><p>
can cause asynchronous string deallocation. Furthermore, each can cause asynchronous string deallocation. Furthermore, each
invocation of this interface can only read or write; simultaneous invocation of this interface can only read or write; simultaneous
read/write is not supported due to string lifetime limitations. The read/write is not supported due to string lifetime limitations. The
name string must nil-terminated and comprised only of characters in the name string must be nil-terminated and comprised only of characters in
sets recognized the sets recognized
by <span class="citerefentry"><span class="refentrytitle">isgraph</span>(3)</span> and by <span class="citerefentry"><span class="refentrytitle">isgraph</span>(3)</span> and
<span class="citerefentry"><span class="refentrytitle">isblank</span>(3)</span>.</p></dd><dt><a name="thread.prof.active"></a><span class="term"> <span class="citerefentry"><span class="refentrytitle">isblank</span>(3)</span>.</p></dd><dt><a name="thread.prof.active"/><span class="term">
<quote><code class="mallctl">thread.prof.active</code></quote>
"<code class="mallctl">thread.prof.active</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Control whether sampling is currently active for the </span></dt><dd><p>Control whether sampling is currently active for the
calling thread. This is an activation mechanism in addition to <a class="link" href="#prof.active"> calling thread. This is an activation mechanism in addition to <a class="link" href="#prof.active"><quote><code class="mallctl">prof.active</code></quote></a>; both must
"<code class="mallctl">prof.active</code>"
</a>; both must
be active for the calling thread to sample. This flag is enabled by be active for the calling thread to sample. This flag is enabled by
default.</p></dd><dt><a name="tcache.create"></a><span class="term"> default.</p></dd><dt><a name="tcache.create"/><span class="term">
<quote><code class="mallctl">tcache.create</code></quote>
"<code class="mallctl">tcache.create</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
...@@ -914,76 +775,81 @@ malloc_conf = "xmalloc:true";</pre><p> ...@@ -914,76 +775,81 @@ malloc_conf = "xmalloc:true";</pre><p>
automatically managed one that is used by default. Each explicit cache automatically managed one that is used by default. Each explicit cache
can be used by only one thread at a time; the application must assure can be used by only one thread at a time; the application must assure
that this constraint holds. that this constraint holds.
</p></dd><dt><a name="tcache.flush"></a><span class="term"> </p></dd><dt><a name="tcache.flush"/><span class="term">
<quote><code class="mallctl">tcache.flush</code></quote>
"<code class="mallctl">tcache.flush</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">-w</code> <code class="literal">-w</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
</span></dt><dd><p>Flush the specified thread-specific cache (tcache). The </span></dt><dd><p>Flush the specified thread-specific cache (tcache). The
same considerations apply to this interface as to <a class="link" href="#thread.tcache.flush"> same considerations apply to this interface as to <a class="link" href="#thread.tcache.flush"><quote><code class="mallctl">thread.tcache.flush</code></quote></a>,
"<code class="mallctl">thread.tcache.flush</code>" except that the tcache will never be automatically discarded.
</a>, </p></dd><dt><a name="tcache.destroy"/><span class="term">
except that the tcache will never be automatically be discarded. <quote><code class="mallctl">tcache.destroy</code></quote>
</p></dd><dt><a name="tcache.destroy"></a><span class="term">
"<code class="mallctl">tcache.destroy</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">-w</code> <code class="literal">-w</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
</span></dt><dd><p>Flush the specified thread-specific cache (tcache) and </span></dt><dd><p>Flush the specified thread-specific cache (tcache) and
make the identifier available for use during a future tcache creation. make the identifier available for use during a future tcache creation.
</p></dd><dt><a name="arena.i.purge"></a><span class="term"> </p></dd><dt><a name="arena.i.purge"/><span class="term">
<quote><code class="mallctl">arena.&lt;i&gt;.purge</code></quote>
"<code class="mallctl">arena.&lt;i&gt;.purge</code>"
(<span class="type">void</span>) (<span class="type">void</span>)
<code class="literal">--</code> <code class="literal">--</code>
</span></dt><dd><p>Purge unused dirty pages for arena &lt;i&gt;, or for </span></dt><dd><p>Purge all unused dirty pages for arena &lt;i&gt;, or for
all arenas if &lt;i&gt; equals <a class="link" href="#arenas.narenas"> all arenas if &lt;i&gt; equals <a class="link" href="#arenas.narenas"><quote><code class="mallctl">arenas.narenas</code></quote></a>.
"<code class="mallctl">arenas.narenas</code>" </p></dd><dt><a name="arena.i.decay"/><span class="term">
</a>. <quote><code class="mallctl">arena.&lt;i&gt;.decay</code></quote>
</p></dd><dt><a name="arena.i.dss"></a><span class="term"> (<span class="type">void</span>)
<code class="literal">--</code>
"<code class="mallctl">arena.&lt;i&gt;.dss</code>" </span></dt><dd><p>Trigger decay-based purging of unused dirty pages for
arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals <a class="link" href="#arenas.narenas"><quote><code class="mallctl">arenas.narenas</code></quote></a>.
The proportion of unused dirty pages to be purged depends on the current
time; see <a class="link" href="#opt.decay_time"><quote><code class="mallctl">opt.decay_time</code></quote></a> for
details.</p></dd><dt><a name="arena.i.reset"/><span class="term">
<quote><code class="mallctl">arena.&lt;i&gt;.reset</code></quote>
(<span class="type">void</span>)
<code class="literal">--</code>
</span></dt><dd><p>Discard all of the arena's extant allocations. This
interface can only be used with arenas created via <a class="link" href="#arenas.extend"><quote><code class="mallctl">arenas.extend</code></quote></a>. None
of the arena's discarded/cached allocations may accessed afterward. As
part of this requirement, all thread caches which were used to
allocate/deallocate in conjunction with the arena must be flushed
beforehand. This interface cannot be used if running inside Valgrind,
nor if the <a class="link" href="#opt.quarantine">quarantine</a> size is
non-zero.</p></dd><dt><a name="arena.i.dss"/><span class="term">
<quote><code class="mallctl">arena.&lt;i&gt;.dss</code></quote>
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
</span></dt><dd><p>Set the precedence of dss allocation as related to mmap </span></dt><dd><p>Set the precedence of dss allocation as related to mmap
allocation for arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals allocation for arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals
<a class="link" href="#arenas.narenas"> <a class="link" href="#arenas.narenas"><quote><code class="mallctl">arenas.narenas</code></quote></a>. See
"<code class="mallctl">arenas.narenas</code>" <a class="link" href="#opt.dss"><quote><code class="mallctl">opt.dss</code></quote></a> for supported
</a>. See settings.</p></dd><dt><a name="arena.i.lg_dirty_mult"/><span class="term">
<a class="link" href="#opt.dss"> <quote><code class="mallctl">arena.&lt;i&gt;.lg_dirty_mult</code></quote>
"<code class="mallctl">opt.dss</code>"
</a> for supported
settings.</p></dd><dt><a name="arena.i.lg_dirty_mult"></a><span class="term">
"<code class="mallctl">arena.&lt;i&gt;.lg_dirty_mult</code>"
(<span class="type">ssize_t</span>) (<span class="type">ssize_t</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
</span></dt><dd><p>Current per-arena minimum ratio (log base 2) of active </span></dt><dd><p>Current per-arena minimum ratio (log base 2) of active
to dirty pages for arena &lt;i&gt;. Each time this interface is set and to dirty pages for arena &lt;i&gt;. Each time this interface is set and
the ratio is increased, pages are synchronously purged as necessary to the ratio is increased, pages are synchronously purged as necessary to
impose the new ratio. See <a class="link" href="#opt.lg_dirty_mult"> impose the new ratio. See <a class="link" href="#opt.lg_dirty_mult"><quote><code class="mallctl">opt.lg_dirty_mult</code></quote></a>
"<code class="mallctl">opt.lg_dirty_mult</code>" for additional information.</p></dd><dt><a name="arena.i.decay_time"/><span class="term">
</a> <quote><code class="mallctl">arena.&lt;i&gt;.decay_time</code></quote>
for additional information.</p></dd><dt><a name="arena.i.chunk_hooks"></a><span class="term"> (<span class="type">ssize_t</span>)
<code class="literal">rw</code>
"<code class="mallctl">arena.&lt;i&gt;.chunk_hooks</code>" </span></dt><dd><p>Current per-arena approximate time in seconds from the
creation of a set of unused dirty pages until an equivalent set of
unused dirty pages is purged and/or reused. Each time this interface is
set, all currently unused dirty pages are considered to have fully
decayed, which causes immediate purging of all unused dirty pages unless
the decay time is set to -1 (i.e. purging disabled). See <a class="link" href="#opt.decay_time"><quote><code class="mallctl">opt.decay_time</code></quote></a> for
additional information.</p></dd><dt><a name="arena.i.chunk_hooks"/><span class="term">
<quote><code class="mallctl">arena.&lt;i&gt;.chunk_hooks</code></quote>
(<span class="type">chunk_hooks_t</span>) (<span class="type">chunk_hooks_t</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
</span></dt><dd><p>Get or set the chunk management hook functions for arena </span></dt><dd><p>Get or set the chunk management hook functions for arena
&lt;i&gt;. The functions must be capable of operating on all extant &lt;i&gt;. The functions must be capable of operating on all extant
chunks associated with arena &lt;i&gt;, usually by passing unknown chunks associated with arena &lt;i&gt;, usually by passing unknown
chunks to the replaced functions. In practice, it is feasible to chunks to the replaced functions. In practice, it is feasible to
control allocation for arenas created via <a class="link" href="#arenas.extend"> control allocation for arenas created via <a class="link" href="#arenas.extend"><quote><code class="mallctl">arenas.extend</code></quote></a> such
"<code class="mallctl">arenas.extend</code>"
</a> such
that all chunks originate from an application-supplied chunk allocator that all chunks originate from an application-supplied chunk allocator
(by setting custom chunk hook functions just after arena creation), but (by setting custom chunk hook functions just after arena creation), but
the automatically created arenas may have already created chunks prior the automatically created arenas may have already created chunks prior
...@@ -1009,7 +875,7 @@ typedef struct { ...@@ -1009,7 +875,7 @@ typedef struct {
operations can also be opted out of, but this is mainly intended to operations can also be opted out of, but this is mainly intended to
support platforms on which virtual memory mappings provided by the support platforms on which virtual memory mappings provided by the
operating system kernel do not automatically coalesce and split, e.g. operating system kernel do not automatically coalesce and split, e.g.
Windows.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef void *<b class="fsfunc">(chunk_alloc_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td></td><td>bool *<var class="pdparam">zero</var>, </td></tr><tr><td></td><td>bool *<var class="pdparam">commit</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>A chunk allocation function conforms to the Windows.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef void *<b class="fsfunc">(chunk_alloc_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td> </td><td>bool *<var class="pdparam">zero</var>, </td></tr><tr><td> </td><td>bool *<var class="pdparam">commit</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>A chunk allocation function conforms to the
<span class="type">chunk_alloc_t</span> type and upon success returns a pointer to <span class="type">chunk_alloc_t</span> type and upon success returns a pointer to
<em class="parameter"><code>size</code></em> bytes of mapped memory on behalf of arena <em class="parameter"><code>size</code></em> bytes of mapped memory on behalf of arena
<em class="parameter"><code>arena_ind</code></em> such that the chunk's base address is a <em class="parameter"><code>arena_ind</code></em> such that the chunk's base address is a
...@@ -1030,10 +896,8 @@ typedef struct { ...@@ -1030,10 +896,8 @@ typedef struct {
in absolute terms as on a system that does not overcommit, or in in absolute terms as on a system that does not overcommit, or in
implicit terms as on a system that overcommits and satisfies physical implicit terms as on a system that overcommits and satisfies physical
memory needs on demand via soft page faults. Note that replacing the memory needs on demand via soft page faults. Note that replacing the
default chunk allocation function makes the arena's <a class="link" href="#arena.i.dss"> default chunk allocation function makes the arena's <a class="link" href="#arena.i.dss"><quote><code class="mallctl">arena.&lt;i&gt;.dss</code></quote></a>
"<code class="mallctl">arena.&lt;i&gt;.dss</code>" setting irrelevant.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_dalloc_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>bool <var class="pdparam">committed</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>
</a>
setting irrelevant.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_dalloc_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>bool <var class="pdparam">committed</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>
A chunk deallocation function conforms to the A chunk deallocation function conforms to the
<span class="type">chunk_dalloc_t</span> type and deallocates a <span class="type">chunk_dalloc_t</span> type and deallocates a
<em class="parameter"><code>chunk</code></em> of given <em class="parameter"><code>size</code></em> with <em class="parameter"><code>chunk</code></em> of given <em class="parameter"><code>size</code></em> with
...@@ -1042,7 +906,7 @@ typedef struct { ...@@ -1042,7 +906,7 @@ typedef struct {
success. If the function returns true, this indicates opt-out from success. If the function returns true, this indicates opt-out from
deallocation; the virtual memory mapping associated with the chunk deallocation; the virtual memory mapping associated with the chunk
remains mapped, in the same commit state, and available for future use, remains mapped, in the same commit state, and available for future use,
in which case it will be automatically retained for later reuse.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_commit_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">offset</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">length</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>A chunk commit function conforms to the in which case it will be automatically retained for later reuse.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_commit_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">offset</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">length</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>A chunk commit function conforms to the
<span class="type">chunk_commit_t</span> type and commits zeroed physical memory to <span class="type">chunk_commit_t</span> type and commits zeroed physical memory to
back pages within a <em class="parameter"><code>chunk</code></em> of given back pages within a <em class="parameter"><code>chunk</code></em> of given
<em class="parameter"><code>size</code></em> at <em class="parameter"><code>offset</code></em> bytes, <em class="parameter"><code>size</code></em> at <em class="parameter"><code>offset</code></em> bytes,
...@@ -1052,7 +916,7 @@ typedef struct { ...@@ -1052,7 +916,7 @@ typedef struct {
does not overcommit, or in implicit terms as on a system that does not overcommit, or in implicit terms as on a system that
overcommits and satisfies physical memory needs on demand via soft page overcommits and satisfies physical memory needs on demand via soft page
faults. If the function returns true, this indicates insufficient faults. If the function returns true, this indicates insufficient
physical memory to satisfy the request.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_decommit_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">offset</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">length</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>A chunk decommit function conforms to the physical memory to satisfy the request.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_decommit_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">offset</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">length</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>A chunk decommit function conforms to the
<span class="type">chunk_decommit_t</span> type and decommits any physical memory <span class="type">chunk_decommit_t</span> type and decommits any physical memory
that is backing pages within a <em class="parameter"><code>chunk</code></em> of given that is backing pages within a <em class="parameter"><code>chunk</code></em> of given
<em class="parameter"><code>size</code></em> at <em class="parameter"><code>offset</code></em> bytes, <em class="parameter"><code>size</code></em> at <em class="parameter"><code>offset</code></em> bytes,
...@@ -1061,14 +925,14 @@ typedef struct { ...@@ -1061,14 +925,14 @@ typedef struct {
case the pages will be committed via the chunk commit function before case the pages will be committed via the chunk commit function before
being reused. If the function returns true, this indicates opt-out from being reused. If the function returns true, this indicates opt-out from
decommit; the memory remains committed and available for future use, in decommit; the memory remains committed and available for future use, in
which case it will be automatically retained for later reuse.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_purge_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td></td><td>size_t<var class="pdparam">size</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">offset</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">length</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>A chunk purge function conforms to the <span class="type">chunk_purge_t</span> which case it will be automatically retained for later reuse.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_purge_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td> </td><td>size_t<var class="pdparam">size</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">offset</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">length</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>A chunk purge function conforms to the <span class="type">chunk_purge_t</span>
type and optionally discards physical pages within the virtual memory type and optionally discards physical pages within the virtual memory
mapping associated with <em class="parameter"><code>chunk</code></em> of given mapping associated with <em class="parameter"><code>chunk</code></em> of given
<em class="parameter"><code>size</code></em> at <em class="parameter"><code>offset</code></em> bytes, <em class="parameter"><code>size</code></em> at <em class="parameter"><code>offset</code></em> bytes,
extending for <em class="parameter"><code>length</code></em> on behalf of arena extending for <em class="parameter"><code>length</code></em> on behalf of arena
<em class="parameter"><code>arena_ind</code></em>, returning false if pages within the <em class="parameter"><code>arena_ind</code></em>, returning false if pages within the
purged virtual memory range will be zero-filled the next time they are purged virtual memory range will be zero-filled the next time they are
accessed.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_split_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size_a</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size_b</var>, </td></tr><tr><td></td><td>bool <var class="pdparam">committed</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>A chunk split function conforms to the <span class="type">chunk_split_t</span> accessed.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_split_t)</b>(</code></td><td>void *<var class="pdparam">chunk</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size_a</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size_b</var>, </td></tr><tr><td> </td><td>bool <var class="pdparam">committed</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>A chunk split function conforms to the <span class="type">chunk_split_t</span>
type and optionally splits <em class="parameter"><code>chunk</code></em> of given type and optionally splits <em class="parameter"><code>chunk</code></em> of given
<em class="parameter"><code>size</code></em> into two adjacent chunks, the first of <em class="parameter"><code>size</code></em> into two adjacent chunks, the first of
<em class="parameter"><code>size_a</code></em> bytes, and the second of <em class="parameter"><code>size_a</code></em> bytes, and the second of
...@@ -1077,7 +941,7 @@ typedef struct { ...@@ -1077,7 +941,7 @@ typedef struct {
behalf of arena <em class="parameter"><code>arena_ind</code></em>, returning false upon behalf of arena <em class="parameter"><code>arena_ind</code></em>, returning false upon
success. If the function returns true, this indicates that the chunk success. If the function returns true, this indicates that the chunk
remains unsplit and therefore should continue to be operated on as a remains unsplit and therefore should continue to be operated on as a
whole.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_merge_t)</b>(</code></td><td>void *<var class="pdparam">chunk_a</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size_a</var>, </td></tr><tr><td></td><td>void *<var class="pdparam">chunk_b</var>, </td></tr><tr><td></td><td>size_t <var class="pdparam">size_b</var>, </td></tr><tr><td></td><td>bool <var class="pdparam">committed</var>, </td></tr><tr><td></td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"></div></div><div class="literallayout"><p></p></div><p>A chunk merge function conforms to the <span class="type">chunk_merge_t</span> whole.</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">typedef bool <b class="fsfunc">(chunk_merge_t)</b>(</code></td><td>void *<var class="pdparam">chunk_a</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size_a</var>, </td></tr><tr><td> </td><td>void *<var class="pdparam">chunk_b</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size_b</var>, </td></tr><tr><td> </td><td>bool <var class="pdparam">committed</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">arena_ind</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><div class="literallayout"><p/></div><p>A chunk merge function conforms to the <span class="type">chunk_merge_t</span>
type and optionally merges adjacent chunks, type and optionally merges adjacent chunks,
<em class="parameter"><code>chunk_a</code></em> of given <em class="parameter"><code>size_a</code></em> <em class="parameter"><code>chunk_a</code></em> of given <em class="parameter"><code>size_a</code></em>
and <em class="parameter"><code>chunk_b</code></em> of given and <em class="parameter"><code>chunk_b</code></em> of given
...@@ -1086,150 +950,106 @@ typedef struct { ...@@ -1086,150 +950,106 @@ typedef struct {
behalf of arena <em class="parameter"><code>arena_ind</code></em>, returning false upon behalf of arena <em class="parameter"><code>arena_ind</code></em>, returning false upon
success. If the function returns true, this indicates that the chunks success. If the function returns true, this indicates that the chunks
remain distinct mappings and therefore should continue to be operated on remain distinct mappings and therefore should continue to be operated on
independently.</p></dd><dt><a name="arenas.narenas"></a><span class="term"> independently.</p></dd><dt><a name="arenas.narenas"/><span class="term">
<quote><code class="mallctl">arenas.narenas</code></quote>
"<code class="mallctl">arenas.narenas</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Current limit on number of arenas.</p></dd><dt><a name="arenas.initialized"></a><span class="term"> </span></dt><dd><p>Current limit on number of arenas.</p></dd><dt><a name="arenas.initialized"/><span class="term">
<quote><code class="mallctl">arenas.initialized</code></quote>
"<code class="mallctl">arenas.initialized</code>"
(<span class="type">bool *</span>) (<span class="type">bool *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>An array of <a class="link" href="#arenas.narenas"> </span></dt><dd><p>An array of <a class="link" href="#arenas.narenas"><quote><code class="mallctl">arenas.narenas</code></quote></a>
"<code class="mallctl">arenas.narenas</code>"
</a>
booleans. Each boolean indicates whether the corresponding arena is booleans. Each boolean indicates whether the corresponding arena is
initialized.</p></dd><dt><a name="arenas.lg_dirty_mult"></a><span class="term"> initialized.</p></dd><dt><a name="arenas.lg_dirty_mult"/><span class="term">
<quote><code class="mallctl">arenas.lg_dirty_mult</code></quote>
"<code class="mallctl">arenas.lg_dirty_mult</code>"
(<span class="type">ssize_t</span>) (<span class="type">ssize_t</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
</span></dt><dd><p>Current default per-arena minimum ratio (log base 2) of </span></dt><dd><p>Current default per-arena minimum ratio (log base 2) of
active to dirty pages, used to initialize <a class="link" href="#arena.i.lg_dirty_mult"> active to dirty pages, used to initialize <a class="link" href="#arena.i.lg_dirty_mult"><quote><code class="mallctl">arena.&lt;i&gt;.lg_dirty_mult</code></quote></a>
"<code class="mallctl">arena.&lt;i&gt;.lg_dirty_mult</code>" during arena creation. See <a class="link" href="#opt.lg_dirty_mult"><quote><code class="mallctl">opt.lg_dirty_mult</code></quote></a>
</a> for additional information.</p></dd><dt><a name="arenas.decay_time"/><span class="term">
during arena creation. See <a class="link" href="#opt.lg_dirty_mult"> <quote><code class="mallctl">arenas.decay_time</code></quote>
"<code class="mallctl">opt.lg_dirty_mult</code>" (<span class="type">ssize_t</span>)
</a> <code class="literal">rw</code>
for additional information.</p></dd><dt><a name="arenas.quantum"></a><span class="term"> </span></dt><dd><p>Current default per-arena approximate time in seconds
from the creation of a set of unused dirty pages until an equivalent set
"<code class="mallctl">arenas.quantum</code>" of unused dirty pages is purged and/or reused, used to initialize <a class="link" href="#arena.i.decay_time"><quote><code class="mallctl">arena.&lt;i&gt;.decay_time</code></quote></a>
during arena creation. See <a class="link" href="#opt.decay_time"><quote><code class="mallctl">opt.decay_time</code></quote></a> for
additional information.</p></dd><dt><a name="arenas.quantum"/><span class="term">
<quote><code class="mallctl">arenas.quantum</code></quote>
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Quantum size.</p></dd><dt><a name="arenas.page"></a><span class="term"> </span></dt><dd><p>Quantum size.</p></dd><dt><a name="arenas.page"/><span class="term">
<quote><code class="mallctl">arenas.page</code></quote>
"<code class="mallctl">arenas.page</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Page size.</p></dd><dt><a name="arenas.tcache_max"></a><span class="term"> </span></dt><dd><p>Page size.</p></dd><dt><a name="arenas.tcache_max"/><span class="term">
<quote><code class="mallctl">arenas.tcache_max</code></quote>
"<code class="mallctl">arenas.tcache_max</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
</span></dt><dd><p>Maximum thread-cached size class.</p></dd><dt><a name="arenas.nbins"></a><span class="term"> </span></dt><dd><p>Maximum thread-cached size class.</p></dd><dt><a name="arenas.nbins"/><span class="term">
<quote><code class="mallctl">arenas.nbins</code></quote>
"<code class="mallctl">arenas.nbins</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Number of bin size classes.</p></dd><dt><a name="arenas.nhbins"></a><span class="term"> </span></dt><dd><p>Number of bin size classes.</p></dd><dt><a name="arenas.nhbins"/><span class="term">
<quote><code class="mallctl">arenas.nhbins</code></quote>
"<code class="mallctl">arenas.nhbins</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-tcache</code>] [<code class="option">--enable-tcache</code>]
</span></dt><dd><p>Total number of thread cache bin size </span></dt><dd><p>Total number of thread cache bin size
classes.</p></dd><dt><a name="arenas.bin.i.size"></a><span class="term"> classes.</p></dd><dt><a name="arenas.bin.i.size"/><span class="term">
<quote><code class="mallctl">arenas.bin.&lt;i&gt;.size</code></quote>
"<code class="mallctl">arenas.bin.&lt;i&gt;.size</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Maximum size supported by size class.</p></dd><dt><a name="arenas.bin.i.nregs"></a><span class="term"> </span></dt><dd><p>Maximum size supported by size class.</p></dd><dt><a name="arenas.bin.i.nregs"/><span class="term">
<quote><code class="mallctl">arenas.bin.&lt;i&gt;.nregs</code></quote>
"<code class="mallctl">arenas.bin.&lt;i&gt;.nregs</code>"
(<span class="type">uint32_t</span>) (<span class="type">uint32_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Number of regions per page run.</p></dd><dt><a name="arenas.bin.i.run_size"></a><span class="term"> </span></dt><dd><p>Number of regions per page run.</p></dd><dt><a name="arenas.bin.i.run_size"/><span class="term">
<quote><code class="mallctl">arenas.bin.&lt;i&gt;.run_size</code></quote>
"<code class="mallctl">arenas.bin.&lt;i&gt;.run_size</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Number of bytes per page run.</p></dd><dt><a name="arenas.nlruns"></a><span class="term"> </span></dt><dd><p>Number of bytes per page run.</p></dd><dt><a name="arenas.nlruns"/><span class="term">
<quote><code class="mallctl">arenas.nlruns</code></quote>
"<code class="mallctl">arenas.nlruns</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Total number of large size classes.</p></dd><dt><a name="arenas.lrun.i.size"></a><span class="term"> </span></dt><dd><p>Total number of large size classes.</p></dd><dt><a name="arenas.lrun.i.size"/><span class="term">
<quote><code class="mallctl">arenas.lrun.&lt;i&gt;.size</code></quote>
"<code class="mallctl">arenas.lrun.&lt;i&gt;.size</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Maximum size supported by this large size </span></dt><dd><p>Maximum size supported by this large size
class.</p></dd><dt><a name="arenas.nhchunks"></a><span class="term"> class.</p></dd><dt><a name="arenas.nhchunks"/><span class="term">
<quote><code class="mallctl">arenas.nhchunks</code></quote>
"<code class="mallctl">arenas.nhchunks</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Total number of huge size classes.</p></dd><dt><a name="arenas.hchunk.i.size"></a><span class="term"> </span></dt><dd><p>Total number of huge size classes.</p></dd><dt><a name="arenas.hchunk.i.size"/><span class="term">
<quote><code class="mallctl">arenas.hchunk.&lt;i&gt;.size</code></quote>
"<code class="mallctl">arenas.hchunk.&lt;i&gt;.size</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Maximum size supported by this huge size </span></dt><dd><p>Maximum size supported by this huge size
class.</p></dd><dt><a name="arenas.extend"></a><span class="term"> class.</p></dd><dt><a name="arenas.extend"/><span class="term">
<quote><code class="mallctl">arenas.extend</code></quote>
"<code class="mallctl">arenas.extend</code>"
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Extend the array of arenas by appending a new arena, </span></dt><dd><p>Extend the array of arenas by appending a new arena,
and returning the new arena index.</p></dd><dt><a name="prof.thread_active_init"></a><span class="term"> and returning the new arena index.</p></dd><dt><a name="prof.thread_active_init"/><span class="term">
<quote><code class="mallctl">prof.thread_active_init</code></quote>
"<code class="mallctl">prof.thread_active_init</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Control the initial setting for <a class="link" href="#thread.prof.active"> </span></dt><dd><p>Control the initial setting for <a class="link" href="#thread.prof.active"><quote><code class="mallctl">thread.prof.active</code></quote></a>
"<code class="mallctl">thread.prof.active</code>" in newly created threads. See the <a class="link" href="#opt.prof_thread_active_init"><quote><code class="mallctl">opt.prof_thread_active_init</code></quote></a>
</a> option for additional information.</p></dd><dt><a name="prof.active"/><span class="term">
in newly created threads. See the <a class="link" href="#opt.prof_thread_active_init"> <quote><code class="mallctl">prof.active</code></quote>
"<code class="mallctl">opt.prof_thread_active_init</code>"
</a>
option for additional information.</p></dd><dt><a name="prof.active"></a><span class="term">
"<code class="mallctl">prof.active</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Control whether sampling is currently active. See the </span></dt><dd><p>Control whether sampling is currently active. See the
<a class="link" href="#opt.prof_active"> <a class="link" href="#opt.prof_active"><quote><code class="mallctl">opt.prof_active</code></quote></a>
"<code class="mallctl">opt.prof_active</code>" option for additional information, as well as the interrelated <a class="link" href="#thread.prof.active"><quote><code class="mallctl">thread.prof.active</code></quote></a>
</a> mallctl.</p></dd><dt><a name="prof.dump"/><span class="term">
option for additional information, as well as the interrelated <a class="link" href="#thread.prof.active"> <quote><code class="mallctl">prof.dump</code></quote>
"<code class="mallctl">thread.prof.active</code>"
</a>
mallctl.</p></dd><dt><a name="prof.dump"></a><span class="term">
"<code class="mallctl">prof.dump</code>"
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">-w</code> <code class="literal">-w</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -1237,13 +1057,9 @@ typedef struct { ...@@ -1237,13 +1057,9 @@ typedef struct {
is specified, to a file according to the pattern is specified, to a file according to the pattern
<code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.m&lt;mseq&gt;.heap</code>, <code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.m&lt;mseq&gt;.heap</code>,
where <code class="literal">&lt;prefix&gt;</code> is controlled by the where <code class="literal">&lt;prefix&gt;</code> is controlled by the
<a class="link" href="#opt.prof_prefix"> <a class="link" href="#opt.prof_prefix"><quote><code class="mallctl">opt.prof_prefix</code></quote></a>
"<code class="mallctl">opt.prof_prefix</code>" option.</p></dd><dt><a name="prof.gdump"/><span class="term">
</a> <quote><code class="mallctl">prof.gdump</code></quote>
option.</p></dd><dt><a name="prof.gdump"></a><span class="term">
"<code class="mallctl">prof.gdump</code>"
(<span class="type">bool</span>) (<span class="type">bool</span>)
<code class="literal">rw</code> <code class="literal">rw</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
...@@ -1251,103 +1067,67 @@ typedef struct { ...@@ -1251,103 +1067,67 @@ typedef struct {
the total virtual memory exceeds the previous maximum. Profiles are the total virtual memory exceeds the previous maximum. Profiles are
dumped to files named according to the pattern dumped to files named according to the pattern
<code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.u&lt;useq&gt;.heap</code>, <code class="filename">&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.u&lt;useq&gt;.heap</code>,
where <code class="literal">&lt;prefix&gt;</code> is controlled by the <a class="link" href="#opt.prof_prefix"> where <code class="literal">&lt;prefix&gt;</code> is controlled by the <a class="link" href="#opt.prof_prefix"><quote><code class="mallctl">opt.prof_prefix</code></quote></a>
"<code class="mallctl">opt.prof_prefix</code>" option.</p></dd><dt><a name="prof.reset"/><span class="term">
</a> <quote><code class="mallctl">prof.reset</code></quote>
option.</p></dd><dt><a name="prof.reset"></a><span class="term">
"<code class="mallctl">prof.reset</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">-w</code> <code class="literal">-w</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Reset all memory profile statistics, and optionally </span></dt><dd><p>Reset all memory profile statistics, and optionally
update the sample rate (see <a class="link" href="#opt.lg_prof_sample"> update the sample rate (see <a class="link" href="#opt.lg_prof_sample"><quote><code class="mallctl">opt.lg_prof_sample</code></quote></a>
"<code class="mallctl">opt.lg_prof_sample</code>" and <a class="link" href="#prof.lg_sample"><quote><code class="mallctl">prof.lg_sample</code></quote></a>).
</a> </p></dd><dt><a name="prof.lg_sample"/><span class="term">
and <a class="link" href="#prof.lg_sample"> <quote><code class="mallctl">prof.lg_sample</code></quote>
"<code class="mallctl">prof.lg_sample</code>"
</a>).
</p></dd><dt><a name="prof.lg_sample"></a><span class="term">
"<code class="mallctl">prof.lg_sample</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Get the current sample rate (see <a class="link" href="#opt.lg_prof_sample"> </span></dt><dd><p>Get the current sample rate (see <a class="link" href="#opt.lg_prof_sample"><quote><code class="mallctl">opt.lg_prof_sample</code></quote></a>).
"<code class="mallctl">opt.lg_prof_sample</code>" </p></dd><dt><a name="prof.interval"/><span class="term">
</a>). <quote><code class="mallctl">prof.interval</code></quote>
</p></dd><dt><a name="prof.interval"></a><span class="term">
"<code class="mallctl">prof.interval</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-prof</code>] [<code class="option">--enable-prof</code>]
</span></dt><dd><p>Average number of bytes allocated between </span></dt><dd><p>Average number of bytes allocated between
inverval-based profile dumps. See the interval-based profile dumps. See the
<a class="link" href="#opt.lg_prof_interval"> <a class="link" href="#opt.lg_prof_interval"><quote><code class="mallctl">opt.lg_prof_interval</code></quote></a>
"<code class="mallctl">opt.lg_prof_interval</code>" option for additional information.</p></dd><dt><a name="stats.cactive"/><span class="term">
</a> <quote><code class="mallctl">stats.cactive</code></quote>
option for additional information.</p></dd><dt><a name="stats.cactive"></a><span class="term">
"<code class="mallctl">stats.cactive</code>"
(<span class="type">size_t *</span>) (<span class="type">size_t *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Pointer to a counter that contains an approximate count </span></dt><dd><p>Pointer to a counter that contains an approximate count
of the current number of bytes in active pages. The estimate may be of the current number of bytes in active pages. The estimate may be
high, but never low, because each arena rounds up when computing its high, but never low, because each arena rounds up when computing its
contribution to the counter. Note that the <a class="link" href="#epoch"> contribution to the counter. Note that the <a class="link" href="#epoch"><quote><code class="mallctl">epoch</code></quote></a> mallctl has no bearing
"<code class="mallctl">epoch</code>"
</a> mallctl has no bearing
on this counter. Furthermore, counter consistency is maintained via on this counter. Furthermore, counter consistency is maintained via
atomic operations, so it is necessary to use an atomic operation in atomic operations, so it is necessary to use an atomic operation in
order to guarantee a consistent read when dereferencing the pointer. order to guarantee a consistent read when dereferencing the pointer.
</p></dd><dt><a name="stats.allocated"></a><span class="term"> </p></dd><dt><a name="stats.allocated"/><span class="term">
<quote><code class="mallctl">stats.allocated</code></quote>
"<code class="mallctl">stats.allocated</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Total number of bytes allocated by the </span></dt><dd><p>Total number of bytes allocated by the
application.</p></dd><dt><a name="stats.active"></a><span class="term"> application.</p></dd><dt><a name="stats.active"/><span class="term">
<quote><code class="mallctl">stats.active</code></quote>
"<code class="mallctl">stats.active</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Total number of bytes in active pages allocated by the </span></dt><dd><p>Total number of bytes in active pages allocated by the
application. This is a multiple of the page size, and greater than or application. This is a multiple of the page size, and greater than or
equal to <a class="link" href="#stats.allocated"> equal to <a class="link" href="#stats.allocated"><quote><code class="mallctl">stats.allocated</code></quote></a>.
"<code class="mallctl">stats.allocated</code>"
</a>.
This does not include <a class="link" href="#stats.arenas.i.pdirty"> This does not include <a class="link" href="#stats.arenas.i.pdirty">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.pdirty</code></quote></a>, nor pages
"<code class="mallctl">stats.arenas.&lt;i&gt;.pdirty</code>" entirely devoted to allocator metadata.</p></dd><dt><a name="stats.metadata"/><span class="term">
</a>, nor pages <quote><code class="mallctl">stats.metadata</code></quote>
entirely devoted to allocator metadata.</p></dd><dt><a name="stats.metadata"></a><span class="term">
"<code class="mallctl">stats.metadata</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Total number of bytes dedicated to metadata, which </span></dt><dd><p>Total number of bytes dedicated to metadata, which
comprise base allocations used for bootstrap-sensitive internal comprise base allocations used for bootstrap-sensitive internal
allocator data structures, arena chunk headers (see <a class="link" href="#stats.arenas.i.metadata.mapped"> allocator data structures, arena chunk headers (see <a class="link" href="#stats.arenas.i.metadata.mapped"><quote><code class="mallctl">stats.arenas.&lt;i&gt;.metadata.mapped</code></quote></a>),
"<code class="mallctl">stats.arenas.&lt;i&gt;.metadata.mapped</code>" and internal allocations (see <a class="link" href="#stats.arenas.i.metadata.allocated"><quote><code class="mallctl">stats.arenas.&lt;i&gt;.metadata.allocated</code></quote></a>).</p></dd><dt><a name="stats.resident"/><span class="term">
</a>), <quote><code class="mallctl">stats.resident</code></quote>
and internal allocations (see <a class="link" href="#stats.arenas.i.metadata.allocated">
"<code class="mallctl">stats.arenas.&lt;i&gt;.metadata.allocated</code>"
</a>).</p></dd><dt><a name="stats.resident"></a><span class="term">
"<code class="mallctl">stats.resident</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
...@@ -1357,436 +1137,393 @@ typedef struct { ...@@ -1357,436 +1137,393 @@ typedef struct {
pages. This is a maximum rather than precise because pages may not pages. This is a maximum rather than precise because pages may not
actually be physically resident if they correspond to demand-zeroed actually be physically resident if they correspond to demand-zeroed
virtual memory that has not yet been touched. This is a multiple of the virtual memory that has not yet been touched. This is a multiple of the
page size, and is larger than <a class="link" href="#stats.active"> page size, and is larger than <a class="link" href="#stats.active"><quote><code class="mallctl">stats.active</code></quote></a>.</p></dd><dt><a name="stats.mapped"/><span class="term">
"<code class="mallctl">stats.active</code>" <quote><code class="mallctl">stats.mapped</code></quote>
</a>.</p></dd><dt><a name="stats.mapped"></a><span class="term">
"<code class="mallctl">stats.mapped</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Total number of bytes in active chunks mapped by the </span></dt><dd><p>Total number of bytes in active chunks mapped by the
allocator. This is a multiple of the chunk size, and is larger than allocator. This is a multiple of the chunk size, and is larger than
<a class="link" href="#stats.active"> <a class="link" href="#stats.active"><quote><code class="mallctl">stats.active</code></quote></a>.
"<code class="mallctl">stats.active</code>"
</a>.
This does not include inactive chunks, even those that contain unused This does not include inactive chunks, even those that contain unused
dirty pages, which means that there is no strict ordering between this dirty pages, which means that there is no strict ordering between this
and <a class="link" href="#stats.resident"> and <a class="link" href="#stats.resident"><quote><code class="mallctl">stats.resident</code></quote></a>.</p></dd><dt><a name="stats.retained"/><span class="term">
"<code class="mallctl">stats.resident</code>" <quote><code class="mallctl">stats.retained</code></quote>
</a>.</p></dd><dt><a name="stats.arenas.i.dss"></a><span class="term"> (<span class="type">size_t</span>)
<code class="literal">r-</code>
"<code class="mallctl">stats.arenas.&lt;i&gt;.dss</code>" [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Total number of bytes in virtual memory mappings that
were retained rather than being returned to the operating system via
e.g. <span class="citerefentry"><span class="refentrytitle">munmap</span>(2)</span>. Retained virtual memory is
typically untouched, decommitted, or purged, so it has no strongly
associated physical memory (see <a class="link" href="#arena.i.chunk_hooks">chunk hooks</a> for details). Retained
memory is excluded from mapped memory statistics, e.g. <a class="link" href="#stats.mapped"><quote><code class="mallctl">stats.mapped</code></quote></a>.
</p></dd><dt><a name="stats.arenas.i.dss"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.dss</code></quote>
(<span class="type">const char *</span>) (<span class="type">const char *</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>dss (<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>) allocation precedence as </span></dt><dd><p>dss (<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>) allocation precedence as
related to <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> allocation. See <a class="link" href="#opt.dss"> related to <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> allocation. See <a class="link" href="#opt.dss"><quote><code class="mallctl">opt.dss</code></quote></a> for details.
"<code class="mallctl">opt.dss</code>" </p></dd><dt><a name="stats.arenas.i.lg_dirty_mult"/><span class="term">
</a> for details. <quote><code class="mallctl">stats.arenas.&lt;i&gt;.lg_dirty_mult</code></quote>
</p></dd><dt><a name="stats.arenas.i.lg_dirty_mult"></a><span class="term">
"<code class="mallctl">stats.arenas.&lt;i&gt;.lg_dirty_mult</code>"
(<span class="type">ssize_t</span>) (<span class="type">ssize_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Minimum ratio (log base 2) of active to dirty pages. </span></dt><dd><p>Minimum ratio (log base 2) of active to dirty pages.
See <a class="link" href="#opt.lg_dirty_mult"> See <a class="link" href="#opt.lg_dirty_mult"><quote><code class="mallctl">opt.lg_dirty_mult</code></quote></a>
"<code class="mallctl">opt.lg_dirty_mult</code>" for details.</p></dd><dt><a name="stats.arenas.i.decay_time"/><span class="term">
</a> <quote><code class="mallctl">stats.arenas.&lt;i&gt;.decay_time</code></quote>
for details.</p></dd><dt><a name="stats.arenas.i.nthreads"></a><span class="term"> (<span class="type">ssize_t</span>)
<code class="literal">r-</code>
"<code class="mallctl">stats.arenas.&lt;i&gt;.nthreads</code>" </span></dt><dd><p>Approximate time in seconds from the creation of a set
of unused dirty pages until an equivalent set of unused dirty pages is
purged and/or reused. See <a class="link" href="#opt.decay_time"><quote><code class="mallctl">opt.decay_time</code></quote></a>
for details.</p></dd><dt><a name="stats.arenas.i.nthreads"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.nthreads</code></quote>
(<span class="type">unsigned</span>) (<span class="type">unsigned</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Number of threads currently assigned to </span></dt><dd><p>Number of threads currently assigned to
arena.</p></dd><dt><a name="stats.arenas.i.pactive"></a><span class="term"> arena.</p></dd><dt><a name="stats.arenas.i.pactive"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.pactive</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.pactive</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Number of pages in active runs.</p></dd><dt><a name="stats.arenas.i.pdirty"></a><span class="term"> </span></dt><dd><p>Number of pages in active runs.</p></dd><dt><a name="stats.arenas.i.pdirty"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.pdirty</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.pdirty</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
</span></dt><dd><p>Number of pages within unused runs that are potentially </span></dt><dd><p>Number of pages within unused runs that are potentially
dirty, and for which <code class="function">madvise</code>(<em class="parameter"><code>...</code></em>, dirty, and for which <code class="function">madvise<em class="parameter"><code>...</code></em>
<em class="parameter"><code><code class="constant">MADV_DONTNEED</code></code></em>) or <em class="parameter"><code><code class="constant">MADV_DONTNEED</code></code></em></code> or
similar has not been called.</p></dd><dt><a name="stats.arenas.i.mapped"></a><span class="term"> similar has not been called.</p></dd><dt><a name="stats.arenas.i.mapped"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.mapped</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.mapped</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of mapped bytes.</p></dd><dt><a name="stats.arenas.i.metadata.mapped"></a><span class="term"> </span></dt><dd><p>Number of mapped bytes.</p></dd><dt><a name="stats.arenas.i.retained"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.retained</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.metadata.mapped</code>" (<span class="type">size_t</span>)
<code class="literal">r-</code>
[<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of retained bytes. See <a class="link" href="#stats.retained"><quote><code class="mallctl">stats.retained</code></quote></a> for
details.</p></dd><dt><a name="stats.arenas.i.metadata.mapped"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.metadata.mapped</code></quote>
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of mapped bytes in arena chunk headers, which </span></dt><dd><p>Number of mapped bytes in arena chunk headers, which
track the states of the non-metadata pages.</p></dd><dt><a name="stats.arenas.i.metadata.allocated"></a><span class="term"> track the states of the non-metadata pages.</p></dd><dt><a name="stats.arenas.i.metadata.allocated"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.metadata.allocated</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.metadata.allocated</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of bytes dedicated to internal allocations. </span></dt><dd><p>Number of bytes dedicated to internal allocations.
Internal allocations differ from application-originated allocations in Internal allocations differ from application-originated allocations in
that they are for internal use, and that they are omitted from heap that they are for internal use, and that they are omitted from heap
profiles. This statistic is reported separately from <a class="link" href="#stats.metadata"> profiles. This statistic is reported separately from <a class="link" href="#stats.metadata"><quote><code class="mallctl">stats.metadata</code></quote></a> and
"<code class="mallctl">stats.metadata</code>" <a class="link" href="#stats.arenas.i.metadata.mapped"><quote><code class="mallctl">stats.arenas.&lt;i&gt;.metadata.mapped</code></quote></a>
</a> and because it overlaps with e.g. the <a class="link" href="#stats.allocated"><quote><code class="mallctl">stats.allocated</code></quote></a> and
<a class="link" href="#stats.arenas.i.metadata.mapped"> <a class="link" href="#stats.active"><quote><code class="mallctl">stats.active</code></quote></a>
"<code class="mallctl">stats.arenas.&lt;i&gt;.metadata.mapped</code>"
</a>
because it overlaps with e.g. the <a class="link" href="#stats.allocated">
"<code class="mallctl">stats.allocated</code>"
</a> and
<a class="link" href="#stats.active">
"<code class="mallctl">stats.active</code>"
</a>
statistics, whereas the other metadata statistics do statistics, whereas the other metadata statistics do
not.</p></dd><dt><a name="stats.arenas.i.npurge"></a><span class="term"> not.</p></dd><dt><a name="stats.arenas.i.npurge"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.npurge</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.npurge</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of dirty page purge sweeps performed. </span></dt><dd><p>Number of dirty page purge sweeps performed.
</p></dd><dt><a name="stats.arenas.i.nmadvise"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.nmadvise"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.nmadvise</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.nmadvise</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of <code class="function">madvise</code>(<em class="parameter"><code>...</code></em>, </span></dt><dd><p>Number of <code class="function">madvise<em class="parameter"><code>...</code></em>
<em class="parameter"><code><code class="constant">MADV_DONTNEED</code></code></em>) or <em class="parameter"><code><code class="constant">MADV_DONTNEED</code></code></em></code> or
similar calls made to purge dirty pages.</p></dd><dt><a name="stats.arenas.i.purged"></a><span class="term"> similar calls made to purge dirty pages.</p></dd><dt><a name="stats.arenas.i.purged"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.purged</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.purged</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of pages purged.</p></dd><dt><a name="stats.arenas.i.small.allocated"></a><span class="term"> </span></dt><dd><p>Number of pages purged.</p></dd><dt><a name="stats.arenas.i.small.allocated"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.small.allocated</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.small.allocated</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of bytes currently allocated by small objects. </span></dt><dd><p>Number of bytes currently allocated by small objects.
</p></dd><dt><a name="stats.arenas.i.small.nmalloc"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.small.nmalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.small.nmalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.small.nmalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocation requests served by </span></dt><dd><p>Cumulative number of allocation requests served by
small bins.</p></dd><dt><a name="stats.arenas.i.small.ndalloc"></a><span class="term"> small bins.</p></dd><dt><a name="stats.arenas.i.small.ndalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.small.ndalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.small.ndalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of small objects returned to bins. </span></dt><dd><p>Cumulative number of small objects returned to bins.
</p></dd><dt><a name="stats.arenas.i.small.nrequests"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.small.nrequests"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.small.nrequests</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.small.nrequests</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of small allocation requests. </span></dt><dd><p>Cumulative number of small allocation requests.
</p></dd><dt><a name="stats.arenas.i.large.allocated"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.large.allocated"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.large.allocated</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.large.allocated</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of bytes currently allocated by large objects. </span></dt><dd><p>Number of bytes currently allocated by large objects.
</p></dd><dt><a name="stats.arenas.i.large.nmalloc"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.large.nmalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.large.nmalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.large.nmalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of large allocation requests served </span></dt><dd><p>Cumulative number of large allocation requests served
directly by the arena.</p></dd><dt><a name="stats.arenas.i.large.ndalloc"></a><span class="term"> directly by the arena.</p></dd><dt><a name="stats.arenas.i.large.ndalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.large.ndalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.large.ndalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of large deallocation requests served </span></dt><dd><p>Cumulative number of large deallocation requests served
directly by the arena.</p></dd><dt><a name="stats.arenas.i.large.nrequests"></a><span class="term"> directly by the arena.</p></dd><dt><a name="stats.arenas.i.large.nrequests"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.large.nrequests</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.large.nrequests</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of large allocation requests. </span></dt><dd><p>Cumulative number of large allocation requests.
</p></dd><dt><a name="stats.arenas.i.huge.allocated"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.huge.allocated"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.huge.allocated</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.huge.allocated</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Number of bytes currently allocated by huge objects. </span></dt><dd><p>Number of bytes currently allocated by huge objects.
</p></dd><dt><a name="stats.arenas.i.huge.nmalloc"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.huge.nmalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.huge.nmalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.huge.nmalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of huge allocation requests served </span></dt><dd><p>Cumulative number of huge allocation requests served
directly by the arena.</p></dd><dt><a name="stats.arenas.i.huge.ndalloc"></a><span class="term"> directly by the arena.</p></dd><dt><a name="stats.arenas.i.huge.ndalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.huge.ndalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.huge.ndalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of huge deallocation requests served </span></dt><dd><p>Cumulative number of huge deallocation requests served
directly by the arena.</p></dd><dt><a name="stats.arenas.i.huge.nrequests"></a><span class="term"> directly by the arena.</p></dd><dt><a name="stats.arenas.i.huge.nrequests"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.huge.nrequests</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.huge.nrequests</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of huge allocation requests. </span></dt><dd><p>Cumulative number of huge allocation requests.
</p></dd><dt><a name="stats.arenas.i.bins.j.nmalloc"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.bins.j.nmalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nmalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nmalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocations served by bin. </span></dt><dd><p>Cumulative number of allocations served by bin.
</p></dd><dt><a name="stats.arenas.i.bins.j.ndalloc"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.bins.j.ndalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.ndalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.ndalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocations returned to bin. </span></dt><dd><p>Cumulative number of allocations returned to bin.
</p></dd><dt><a name="stats.arenas.i.bins.j.nrequests"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.bins.j.nrequests"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nrequests</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nrequests</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocation </span></dt><dd><p>Cumulative number of allocation
requests.</p></dd><dt><a name="stats.arenas.i.bins.j.curregs"></a><span class="term"> requests.</p></dd><dt><a name="stats.arenas.i.bins.j.curregs"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curregs</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curregs</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Current number of regions for this size </span></dt><dd><p>Current number of regions for this size
class.</p></dd><dt><a name="stats.arenas.i.bins.j.nfills"></a><span class="term"> class.</p></dd><dt><a name="stats.arenas.i.bins.j.nfills"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nfills</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nfills</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code> <code class="option">--enable-tcache</code>] [<code class="option">--enable-stats</code> <code class="option">--enable-tcache</code>]
</span></dt><dd><p>Cumulative number of tcache fills.</p></dd><dt><a name="stats.arenas.i.bins.j.nflushes"></a><span class="term"> </span></dt><dd><p>Cumulative number of tcache fills.</p></dd><dt><a name="stats.arenas.i.bins.j.nflushes"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nflushes</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nflushes</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code> <code class="option">--enable-tcache</code>] [<code class="option">--enable-stats</code> <code class="option">--enable-tcache</code>]
</span></dt><dd><p>Cumulative number of tcache flushes.</p></dd><dt><a name="stats.arenas.i.bins.j.nruns"></a><span class="term"> </span></dt><dd><p>Cumulative number of tcache flushes.</p></dd><dt><a name="stats.arenas.i.bins.j.nruns"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nruns</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nruns</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of runs created.</p></dd><dt><a name="stats.arenas.i.bins.j.nreruns"></a><span class="term"> </span></dt><dd><p>Cumulative number of runs created.</p></dd><dt><a name="stats.arenas.i.bins.j.nreruns"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nreruns</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nreruns</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of times the current run from which </span></dt><dd><p>Cumulative number of times the current run from which
to allocate changed.</p></dd><dt><a name="stats.arenas.i.bins.j.curruns"></a><span class="term"> to allocate changed.</p></dd><dt><a name="stats.arenas.i.bins.j.curruns"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curruns</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curruns</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Current number of runs.</p></dd><dt><a name="stats.arenas.i.lruns.j.nmalloc"></a><span class="term"> </span></dt><dd><p>Current number of runs.</p></dd><dt><a name="stats.arenas.i.lruns.j.nmalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.nmalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.nmalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocation requests for this size </span></dt><dd><p>Cumulative number of allocation requests for this size
class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.lruns.j.ndalloc"></a><span class="term"> class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.lruns.j.ndalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.ndalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.ndalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of deallocation requests for this </span></dt><dd><p>Cumulative number of deallocation requests for this
size class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.lruns.j.nrequests"></a><span class="term"> size class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.lruns.j.nrequests"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.nrequests</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.nrequests</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocation requests for this size </span></dt><dd><p>Cumulative number of allocation requests for this size
class.</p></dd><dt><a name="stats.arenas.i.lruns.j.curruns"></a><span class="term"> class.</p></dd><dt><a name="stats.arenas.i.lruns.j.curruns"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.curruns</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.curruns</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Current number of runs for this size class. </span></dt><dd><p>Current number of runs for this size class.
</p></dd><dt><a name="stats.arenas.i.hchunks.j.nmalloc"></a><span class="term"> </p></dd><dt><a name="stats.arenas.i.hchunks.j.nmalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.nmalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.nmalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocation requests for this size </span></dt><dd><p>Cumulative number of allocation requests for this size
class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.hchunks.j.ndalloc"></a><span class="term"> class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.hchunks.j.ndalloc"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.ndalloc</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.ndalloc</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of deallocation requests for this </span></dt><dd><p>Cumulative number of deallocation requests for this
size class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.hchunks.j.nrequests"></a><span class="term"> size class served directly by the arena.</p></dd><dt><a name="stats.arenas.i.hchunks.j.nrequests"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.nrequests</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.nrequests</code>"
(<span class="type">uint64_t</span>) (<span class="type">uint64_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Cumulative number of allocation requests for this size </span></dt><dd><p>Cumulative number of allocation requests for this size
class.</p></dd><dt><a name="stats.arenas.i.hchunks.j.curhchunks"></a><span class="term"> class.</p></dd><dt><a name="stats.arenas.i.hchunks.j.curhchunks"/><span class="term">
<quote><code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.curhchunks</code></quote>
"<code class="mallctl">stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.curhchunks</code>"
(<span class="type">size_t</span>) (<span class="type">size_t</span>)
<code class="literal">r-</code> <code class="literal">r-</code>
[<code class="option">--enable-stats</code>] [<code class="option">--enable-stats</code>]
</span></dt><dd><p>Current number of huge allocations for this size class. </span></dt><dd><p>Current number of huge allocations for this size class.
</p></dd></dl></div></div><div class="refsect1"><a name="debugging_malloc_problems"></a><h2>DEBUGGING MALLOC PROBLEMS</h2><p>When debugging, it is a good idea to configure/build jemalloc with </p></dd></dl></div></div><div class="refsect1"><a name="heap_profile_format"/><h2>HEAP PROFILE FORMAT</h2><p>Although the heap profiling functionality was originally designed to
be compatible with the
<span class="command"><strong>pprof</strong></span> command that is developed as part of the <a class="ulink" href="http://code.google.com/p/gperftools/" target="_top">gperftools
package</a>, the addition of per thread heap profiling functionality
required a different heap profile format. The <span class="command"><strong>jeprof</strong></span>
command is derived from <span class="command"><strong>pprof</strong></span>, with enhancements to
support the heap profile format described here.</p><p>In the following hypothetical heap profile, <code class="constant">[...]</code>
indicates elision for the sake of compactness. </p><pre class="programlisting">
heap_v2/524288
t*: 28106: 56637512 [0: 0]
[...]
t3: 352: 16777344 [0: 0]
[...]
t99: 17754: 29341640 [0: 0]
[...]
@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...]
t*: 13: 6688 [0: 0]
t3: 12: 6496 [0: ]
t99: 1: 192 [0: 0]
[...]
MAPPED_LIBRARIES:
[...]</pre><p> The following matches the above heap profile, but most
tokens are replaced with <code class="constant">&lt;description&gt;</code> to indicate
descriptions of the corresponding fields. </p><pre class="programlisting">
&lt;heap_profile_format_version&gt;/&lt;mean_sample_interval&gt;
&lt;aggregate&gt;: &lt;curobjs&gt;: &lt;curbytes&gt; [&lt;cumobjs&gt;: &lt;cumbytes&gt;]
[...]
&lt;thread_3_aggregate&gt;: &lt;curobjs&gt;: &lt;curbytes&gt;[&lt;cumobjs&gt;: &lt;cumbytes&gt;]
[...]
&lt;thread_99_aggregate&gt;: &lt;curobjs&gt;: &lt;curbytes&gt;[&lt;cumobjs&gt;: &lt;cumbytes&gt;]
[...]
@ &lt;top_frame&gt; &lt;frame&gt; [...] &lt;frame&gt; &lt;frame&gt; &lt;frame&gt; [...]
&lt;backtrace_aggregate&gt;: &lt;curobjs&gt;: &lt;curbytes&gt; [&lt;cumobjs&gt;: &lt;cumbytes&gt;]
&lt;backtrace_thread_3&gt;: &lt;curobjs&gt;: &lt;curbytes&gt; [&lt;cumobjs&gt;: &lt;cumbytes&gt;]
&lt;backtrace_thread_99&gt;: &lt;curobjs&gt;: &lt;curbytes&gt; [&lt;cumobjs&gt;: &lt;cumbytes&gt;]
[...]
MAPPED_LIBRARIES:
&lt;/proc/&lt;pid&gt;/maps&gt;</pre></div><div class="refsect1"><a name="debugging_malloc_problems"/><h2>DEBUGGING MALLOC PROBLEMS</h2><p>When debugging, it is a good idea to configure/build jemalloc with
the <code class="option">--enable-debug</code> and <code class="option">--enable-fill</code> the <code class="option">--enable-debug</code> and <code class="option">--enable-fill</code>
options, and recompile the program with suitable options and symbols for options, and recompile the program with suitable options and symbols for
debugger support. When so configured, jemalloc incorporates a wide variety debugger support. When so configured, jemalloc incorporates a wide variety
of run-time assertions that catch application errors such as double-free, of run-time assertions that catch application errors such as double-free,
write-after-free, etc.</p><p>Programs often accidentally depend on &#8220;uninitialized&#8221; write-after-free, etc.</p><p>Programs often accidentally depend on <span class="quote"><span class="quote">uninitialized</span></span>
memory actually being filled with zero bytes. Junk filling memory actually being filled with zero bytes. Junk filling
(see the <a class="link" href="#opt.junk"> (see the <a class="link" href="#opt.junk"><quote><code class="mallctl">opt.junk</code></quote></a>
"<code class="mallctl">opt.junk</code>"
</a>
option) tends to expose such bugs in the form of obviously incorrect option) tends to expose such bugs in the form of obviously incorrect
results and/or coredumps. Conversely, zero results and/or coredumps. Conversely, zero
filling (see the <a class="link" href="#opt.zero"> filling (see the <a class="link" href="#opt.zero"><quote><code class="mallctl">opt.zero</code></quote></a> option) eliminates
"<code class="mallctl">opt.zero</code>"
</a> option) eliminates
the symptoms of such bugs. Between these two options, it is usually the symptoms of such bugs. Between these two options, it is usually
possible to quickly detect, diagnose, and eliminate such bugs.</p><p>This implementation does not provide much detail about the problems possible to quickly detect, diagnose, and eliminate such bugs.</p><p>This implementation does not provide much detail about the problems
it detects, because the performance impact for storing such information it detects, because the performance impact for storing such information
would be prohibitive. However, jemalloc does integrate with the most would be prohibitive. However, jemalloc does integrate with the most
excellent <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a> tool if the excellent <a class="ulink" href="http://valgrind.org/" target="_top">Valgrind</a> tool if the
<code class="option">--enable-valgrind</code> configuration option is enabled.</p></div><div class="refsect1"><a name="diagnostic_messages"></a><h2>DIAGNOSTIC MESSAGES</h2><p>If any of the memory allocation/deallocation functions detect an <code class="option">--enable-valgrind</code> configuration option is enabled.</p></div><div class="refsect1"><a name="diagnostic_messages"/><h2>DIAGNOSTIC MESSAGES</h2><p>If any of the memory allocation/deallocation functions detect an
error or warning condition, a message will be printed to file descriptor error or warning condition, a message will be printed to file descriptor
<code class="constant">STDERR_FILENO</code>. Errors will result in the process <code class="constant">STDERR_FILENO</code>. Errors will result in the process
dumping core. If the <a class="link" href="#opt.abort"> dumping core. If the <a class="link" href="#opt.abort"><quote><code class="mallctl">opt.abort</code></quote></a> option is set, most
"<code class="mallctl">opt.abort</code>"
</a> option is set, most
warnings are treated as errors.</p><p>The <code class="varname">malloc_message</code> variable allows the programmer warnings are treated as errors.</p><p>The <code class="varname">malloc_message</code> variable allows the programmer
to override the function which emits the text strings forming the errors to override the function which emits the text strings forming the errors
and warnings if for some reason the <code class="constant">STDERR_FILENO</code> file and warnings if for some reason the <code class="constant">STDERR_FILENO</code> file
descriptor is not suitable for this. descriptor is not suitable for this.
<code class="function">malloc_message</code>(<em class="parameter"><code></code></em>) takes the <code class="function">malloc_message()</code> takes the
<em class="parameter"><code>cbopaque</code></em> pointer argument that is <em class="parameter"><code>cbopaque</code></em> pointer argument that is
<code class="constant">NULL</code> unless overridden by the arguments in a call to <code class="constant">NULL</code> unless overridden by the arguments in a call to
<code class="function">malloc_stats_print</code>(<em class="parameter"><code></code></em>), followed by a string <code class="function">malloc_stats_print()</code>, followed by a string
pointer. Please note that doing anything which tries to allocate memory in pointer. Please note that doing anything which tries to allocate memory in
this function is likely to result in a crash or deadlock.</p><p>All messages are prefixed by this function is likely to result in a crash or deadlock.</p><p>All messages are prefixed by
&#8220;<code class="computeroutput">&lt;jemalloc&gt;: </code>&#8221;.</p></div><div class="refsect1"><a name="return_values"></a><h2>RETURN VALUES</h2><div class="refsect2"><a name="idp46949776"></a><h3>Standard API</h3><p>The <code class="function">malloc</code>(<em class="parameter"><code></code></em>) and <span class="quote"><span class="quote"><code class="computeroutput">&lt;jemalloc&gt;: </code></span></span>.</p></div><div class="refsect1"><a name="return_values"/><h2>RETURN VALUES</h2><div class="refsect2"><a name="idm45291897515152"/><h3>Standard API</h3><p>The <code class="function">malloc()</code> and
<code class="function">calloc</code>(<em class="parameter"><code></code></em>) functions return a pointer to the <code class="function">calloc()</code> functions return a pointer to the
allocated memory if successful; otherwise a <code class="constant">NULL</code> allocated memory if successful; otherwise a <code class="constant">NULL</code>
pointer is returned and <code class="varname">errno</code> is set to pointer is returned and <code class="varname">errno</code> is set to
<span class="errorname">ENOMEM</span>.</p><p>The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function <span class="errorname">ENOMEM</span>.</p><p>The <code class="function">posix_memalign()</code> function
returns the value 0 if successful; otherwise it returns an error value. returns the value 0 if successful; otherwise it returns an error value.
The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function will fail The <code class="function">posix_memalign()</code> function will fail
if: if:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p>The <em class="parameter"><code>alignment</code></em> parameter is </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p>The <em class="parameter"><code>alignment</code></em> parameter is
not a power of 2 at least as large as not a power of 2 at least as large as
<code class="code">sizeof(<span class="type">void *</span>)</code>. <code class="code">sizeof(<span class="type">void *</span>)</code>.
</p></dd><dt><span class="term"><span class="errorname">ENOMEM</span></span></dt><dd><p>Memory allocation error.</p></dd></dl></div><p> </p></dd><dt><span class="term"><span class="errorname">ENOMEM</span></span></dt><dd><p>Memory allocation error.</p></dd></dl></div><p>
</p><p>The <code class="function">aligned_alloc</code>(<em class="parameter"><code></code></em>) function returns </p><p>The <code class="function">aligned_alloc()</code> function returns
a pointer to the allocated memory if successful; otherwise a a pointer to the allocated memory if successful; otherwise a
<code class="constant">NULL</code> pointer is returned and <code class="constant">NULL</code> pointer is returned and
<code class="varname">errno</code> is set. The <code class="varname">errno</code> is set. The
<code class="function">aligned_alloc</code>(<em class="parameter"><code></code></em>) function will fail if: <code class="function">aligned_alloc()</code> function will fail if:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p>The <em class="parameter"><code>alignment</code></em> parameter is </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p>The <em class="parameter"><code>alignment</code></em> parameter is
not a power of 2. not a power of 2.
</p></dd><dt><span class="term"><span class="errorname">ENOMEM</span></span></dt><dd><p>Memory allocation error.</p></dd></dl></div><p> </p></dd><dt><span class="term"><span class="errorname">ENOMEM</span></span></dt><dd><p>Memory allocation error.</p></dd></dl></div><p>
</p><p>The <code class="function">realloc</code>(<em class="parameter"><code></code></em>) function returns a </p><p>The <code class="function">realloc()</code> function returns a
pointer, possibly identical to <em class="parameter"><code>ptr</code></em>, to the pointer, possibly identical to <em class="parameter"><code>ptr</code></em>, to the
allocated memory if successful; otherwise a <code class="constant">NULL</code> allocated memory if successful; otherwise a <code class="constant">NULL</code>
pointer is returned, and <code class="varname">errno</code> is set to pointer is returned, and <code class="varname">errno</code> is set to
<span class="errorname">ENOMEM</span> if the error was the result of an <span class="errorname">ENOMEM</span> if the error was the result of an
allocation failure. The <code class="function">realloc</code>(<em class="parameter"><code></code></em>) allocation failure. The <code class="function">realloc()</code>
function always leaves the original buffer intact when an error occurs. function always leaves the original buffer intact when an error occurs.
</p><p>The <code class="function">free</code>(<em class="parameter"><code></code></em>) function returns no </p><p>The <code class="function">free()</code> function returns no
value.</p></div><div class="refsect2"><a name="idp46974576"></a><h3>Non-standard API</h3><p>The <code class="function">mallocx</code>(<em class="parameter"><code></code></em>) and value.</p></div><div class="refsect2"><a name="idm45291897493664"/><h3>Non-standard API</h3><p>The <code class="function">mallocx()</code> and
<code class="function">rallocx</code>(<em class="parameter"><code></code></em>) functions return a pointer to <code class="function">rallocx()</code> functions return a pointer to
the allocated memory if successful; otherwise a <code class="constant">NULL</code> the allocated memory if successful; otherwise a <code class="constant">NULL</code>
pointer is returned to indicate insufficient contiguous memory was pointer is returned to indicate insufficient contiguous memory was
available to service the allocation request. </p><p>The <code class="function">xallocx</code>(<em class="parameter"><code></code></em>) function returns the available to service the allocation request. </p><p>The <code class="function">xallocx()</code> function returns the
real size of the resulting resized allocation pointed to by real size of the resulting resized allocation pointed to by
<em class="parameter"><code>ptr</code></em>, which is a value less than <em class="parameter"><code>ptr</code></em>, which is a value less than
<em class="parameter"><code>size</code></em> if the allocation could not be adequately <em class="parameter"><code>size</code></em> if the allocation could not be adequately
grown in place. </p><p>The <code class="function">sallocx</code>(<em class="parameter"><code></code></em>) function returns the grown in place. </p><p>The <code class="function">sallocx()</code> function returns the
real size of the allocation pointed to by <em class="parameter"><code>ptr</code></em>. real size of the allocation pointed to by <em class="parameter"><code>ptr</code></em>.
</p><p>The <code class="function">nallocx</code>(<em class="parameter"><code></code></em>) returns the real size </p><p>The <code class="function">nallocx()</code> returns the real size
that would result from a successful equivalent that would result from a successful equivalent
<code class="function">mallocx</code>(<em class="parameter"><code></code></em>) function call, or zero if <code class="function">mallocx()</code> function call, or zero if
insufficient memory is available to perform the size computation. </p><p>The <code class="function">mallctl</code>(<em class="parameter"><code></code></em>), insufficient memory is available to perform the size computation. </p><p>The <code class="function">mallctl()</code>,
<code class="function">mallctlnametomib</code>(<em class="parameter"><code></code></em>), and <code class="function">mallctlnametomib()</code>, and
<code class="function">mallctlbymib</code>(<em class="parameter"><code></code></em>) functions return 0 on <code class="function">mallctlbymib()</code> functions return 0 on
success; otherwise they return an error value. The functions will fail success; otherwise they return an error value. The functions will fail
if: if:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p><em class="parameter"><code>newp</code></em> is not </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p><em class="parameter"><code>newp</code></em> is not
...@@ -1798,28 +1535,28 @@ typedef struct { ...@@ -1798,28 +1535,28 @@ typedef struct {
value.</p></dd><dt><span class="term"><span class="errorname">EPERM</span></span></dt><dd><p>Attempt to read or write void value, or attempt to value.</p></dd><dt><span class="term"><span class="errorname">EPERM</span></span></dt><dd><p>Attempt to read or write void value, or attempt to
write read-only value.</p></dd><dt><span class="term"><span class="errorname">EAGAIN</span></span></dt><dd><p>A memory allocation failure write read-only value.</p></dd><dt><span class="term"><span class="errorname">EAGAIN</span></span></dt><dd><p>A memory allocation failure
occurred.</p></dd><dt><span class="term"><span class="errorname">EFAULT</span></span></dt><dd><p>An interface with side effects failed in some way occurred.</p></dd><dt><span class="term"><span class="errorname">EFAULT</span></span></dt><dd><p>An interface with side effects failed in some way
not directly related to <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) not directly related to <code class="function">mallctl*()</code>
read/write processing.</p></dd></dl></div><p> read/write processing.</p></dd></dl></div><p>
</p><p>The <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) function </p><p>The <code class="function">malloc_usable_size()</code> function
returns the usable size of the allocation pointed to by returns the usable size of the allocation pointed to by
<em class="parameter"><code>ptr</code></em>. </p></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><p>The following environment variable affects the execution of the <em class="parameter"><code>ptr</code></em>. </p></div></div><div class="refsect1"><a name="environment"/><h2>ENVIRONMENT</h2><p>The following environment variable affects the execution of the
allocation functions: allocation functions:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">MALLOC_CONF</code></span></dt><dd><p>If the environment variable </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">MALLOC_CONF</code></span></dt><dd><p>If the environment variable
<code class="envar">MALLOC_CONF</code> is set, the characters it contains <code class="envar">MALLOC_CONF</code> is set, the characters it contains
will be interpreted as options.</p></dd></dl></div><p> will be interpreted as options.</p></dd></dl></div><p>
</p></div><div class="refsect1"><a name="examples"></a><h2>EXAMPLES</h2><p>To dump core whenever a problem occurs: </p></div><div class="refsect1"><a name="examples"/><h2>EXAMPLES</h2><p>To dump core whenever a problem occurs:
</p><pre class="screen">ln -s 'abort:true' /etc/malloc.conf</pre><p> </p><pre class="screen">ln -s 'abort:true' /etc/malloc.conf</pre><p>
</p><p>To specify in the source a chunk size that is 16 MiB: </p><p>To specify in the source a chunk size that is 16 MiB:
</p><pre class="programlisting"> </p><pre class="programlisting">
malloc_conf = "lg_chunk:24";</pre></div><div class="refsect1"><a name="see_also"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">madvise</span>(2)</span>, malloc_conf = "lg_chunk:24";</pre></div><div class="refsect1"><a name="see_also"/><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">madvise</span>(2)</span>,
<span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span>, <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span>,
<span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>, <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>,
<span class="citerefentry"><span class="refentrytitle">utrace</span>(2)</span>, <span class="citerefentry"><span class="refentrytitle">utrace</span>(2)</span>,
<span class="citerefentry"><span class="refentrytitle">alloca</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">alloca</span>(3)</span>,
<span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span>,
<span class="citerefentry"><span class="refentrytitle">getpagesize</span>(3)</span></p></div><div class="refsect1"><a name="standards"></a><h2>STANDARDS</h2><p>The <code class="function">malloc</code>(<em class="parameter"><code></code></em>), <span class="citerefentry"><span class="refentrytitle">getpagesize</span>(3)</span></p></div><div class="refsect1"><a name="standards"/><h2>STANDARDS</h2><p>The <code class="function">malloc()</code>,
<code class="function">calloc</code>(<em class="parameter"><code></code></em>), <code class="function">calloc()</code>,
<code class="function">realloc</code>(<em class="parameter"><code></code></em>), and <code class="function">realloc()</code>, and
<code class="function">free</code>(<em class="parameter"><code></code></em>) functions conform to ISO/IEC <code class="function">free()</code> functions conform to ISO/IEC
9899:1990 (&#8220;ISO C90&#8221;).</p><p>The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function conforms 9899:1990 (<span class="quote"><span class="quote">ISO C90</span></span>).</p><p>The <code class="function">posix_memalign()</code> function conforms
to IEEE Std 1003.1-2001 (&#8220;POSIX.1&#8221;).</p></div></div></body></html> to IEEE Std 1003.1-2001 (<span class="quote"><span class="quote">POSIX.1</span></span>).</p></div></div></body></html>
\ No newline at end of file
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<title>LIBRARY</title> <title>LIBRARY</title>
<para>This manual describes jemalloc @jemalloc_version@. More information <para>This manual describes jemalloc @jemalloc_version@. More information
can be found at the <ulink can be found at the <ulink
url="http://www.canonware.com/jemalloc/">jemalloc website</ulink>.</para> url="http://jemalloc.net/">jemalloc website</ulink>.</para>
</refsect1> </refsect1>
<refsynopsisdiv> <refsynopsisdiv>
<title>SYNOPSIS</title> <title>SYNOPSIS</title>
...@@ -180,20 +180,20 @@ ...@@ -180,20 +180,20 @@
<refsect2> <refsect2>
<title>Standard API</title> <title>Standard API</title>
<para>The <function>malloc<parameter/></function> function allocates <para>The <function>malloc()</function> function allocates
<parameter>size</parameter> bytes of uninitialized memory. The allocated <parameter>size</parameter> bytes of uninitialized memory. The allocated
space is suitably aligned (after possible pointer coercion) for storage space is suitably aligned (after possible pointer coercion) for storage
of any type of object.</para> of any type of object.</para>
<para>The <function>calloc<parameter/></function> function allocates <para>The <function>calloc()</function> function allocates
space for <parameter>number</parameter> objects, each space for <parameter>number</parameter> objects, each
<parameter>size</parameter> bytes in length. The result is identical to <parameter>size</parameter> bytes in length. The result is identical to
calling <function>malloc<parameter/></function> with an argument of calling <function>malloc()</function> with an argument of
<parameter>number</parameter> * <parameter>size</parameter>, with the <parameter>number</parameter> * <parameter>size</parameter>, with the
exception that the allocated memory is explicitly initialized to zero exception that the allocated memory is explicitly initialized to zero
bytes.</para> bytes.</para>
<para>The <function>posix_memalign<parameter/></function> function <para>The <function>posix_memalign()</function> function
allocates <parameter>size</parameter> bytes of memory such that the allocates <parameter>size</parameter> bytes of memory such that the
allocation's base address is a multiple of allocation's base address is a multiple of
<parameter>alignment</parameter>, and returns the allocation in the value <parameter>alignment</parameter>, and returns the allocation in the value
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
<parameter>alignment</parameter> must be a power of 2 at least as large as <parameter>alignment</parameter> must be a power of 2 at least as large as
<code language="C">sizeof(<type>void *</type>)</code>.</para> <code language="C">sizeof(<type>void *</type>)</code>.</para>
<para>The <function>aligned_alloc<parameter/></function> function <para>The <function>aligned_alloc()</function> function
allocates <parameter>size</parameter> bytes of memory such that the allocates <parameter>size</parameter> bytes of memory such that the
allocation's base address is a multiple of allocation's base address is a multiple of
<parameter>alignment</parameter>. The requested <parameter>alignment</parameter>. The requested
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
undefined if <parameter>size</parameter> is not an integral multiple of undefined if <parameter>size</parameter> is not an integral multiple of
<parameter>alignment</parameter>.</para> <parameter>alignment</parameter>.</para>
<para>The <function>realloc<parameter/></function> function changes the <para>The <function>realloc()</function> function changes the
size of the previously allocated memory referenced by size of the previously allocated memory referenced by
<parameter>ptr</parameter> to <parameter>size</parameter> bytes. The <parameter>ptr</parameter> to <parameter>size</parameter> bytes. The
contents of the memory are unchanged up to the lesser of the new and old contents of the memory are unchanged up to the lesser of the new and old
...@@ -217,26 +217,26 @@ ...@@ -217,26 +217,26 @@
portion of the memory are undefined. Upon success, the memory referenced portion of the memory are undefined. Upon success, the memory referenced
by <parameter>ptr</parameter> is freed and a pointer to the newly by <parameter>ptr</parameter> is freed and a pointer to the newly
allocated memory is returned. Note that allocated memory is returned. Note that
<function>realloc<parameter/></function> may move the memory allocation, <function>realloc()</function> may move the memory allocation,
resulting in a different return value than <parameter>ptr</parameter>. resulting in a different return value than <parameter>ptr</parameter>.
If <parameter>ptr</parameter> is <constant>NULL</constant>, the If <parameter>ptr</parameter> is <constant>NULL</constant>, the
<function>realloc<parameter/></function> function behaves identically to <function>realloc()</function> function behaves identically to
<function>malloc<parameter/></function> for the specified size.</para> <function>malloc()</function> for the specified size.</para>
<para>The <function>free<parameter/></function> function causes the <para>The <function>free()</function> function causes the
allocated memory referenced by <parameter>ptr</parameter> to be made allocated memory referenced by <parameter>ptr</parameter> to be made
available for future allocations. If <parameter>ptr</parameter> is available for future allocations. If <parameter>ptr</parameter> is
<constant>NULL</constant>, no action occurs.</para> <constant>NULL</constant>, no action occurs.</para>
</refsect2> </refsect2>
<refsect2> <refsect2>
<title>Non-standard API</title> <title>Non-standard API</title>
<para>The <function>mallocx<parameter/></function>, <para>The <function>mallocx()</function>,
<function>rallocx<parameter/></function>, <function>rallocx()</function>,
<function>xallocx<parameter/></function>, <function>xallocx()</function>,
<function>sallocx<parameter/></function>, <function>sallocx()</function>,
<function>dallocx<parameter/></function>, <function>dallocx()</function>,
<function>sdallocx<parameter/></function>, and <function>sdallocx()</function>, and
<function>nallocx<parameter/></function> functions all have a <function>nallocx()</function> functions all have a
<parameter>flags</parameter> argument that can be used to specify <parameter>flags</parameter> argument that can be used to specify
options. The functions only check the options that are contextually options. The functions only check the options that are contextually
relevant. Use bitwise or (<code language="C">|</code>) operations to relevant. Use bitwise or (<code language="C">|</code>) operations to
...@@ -307,21 +307,19 @@ ...@@ -307,21 +307,19 @@
</variablelist> </variablelist>
</para> </para>
<para>The <function>mallocx<parameter/></function> function allocates at <para>The <function>mallocx()</function> function allocates at
least <parameter>size</parameter> bytes of memory, and returns a pointer least <parameter>size</parameter> bytes of memory, and returns a pointer
to the base address of the allocation. Behavior is undefined if to the base address of the allocation. Behavior is undefined if
<parameter>size</parameter> is <constant>0</constant>, or if request size <parameter>size</parameter> is <constant>0</constant>.</para>
overflows due to size class and/or alignment constraints.</para>
<para>The <function>rallocx<parameter/></function> function resizes the <para>The <function>rallocx()</function> function resizes the
allocation at <parameter>ptr</parameter> to be at least allocation at <parameter>ptr</parameter> to be at least
<parameter>size</parameter> bytes, and returns a pointer to the base <parameter>size</parameter> bytes, and returns a pointer to the base
address of the resulting allocation, which may or may not have moved from address of the resulting allocation, which may or may not have moved from
its original location. Behavior is undefined if its original location. Behavior is undefined if
<parameter>size</parameter> is <constant>0</constant>, or if request size <parameter>size</parameter> is <constant>0</constant>.</para>
overflows due to size class and/or alignment constraints.</para>
<para>The <function>xallocx<parameter/></function> function resizes the <para>The <function>xallocx()</function> function resizes the
allocation at <parameter>ptr</parameter> in place to be at least allocation at <parameter>ptr</parameter> in place to be at least
<parameter>size</parameter> bytes, and returns the real size of the <parameter>size</parameter> bytes, and returns the real size of the
allocation. If <parameter>extra</parameter> is non-zero, an attempt is allocation. If <parameter>extra</parameter> is non-zero, an attempt is
...@@ -334,32 +332,32 @@ ...@@ -334,32 +332,32 @@
language="C">(<parameter>size</parameter> + <parameter>extra</parameter> language="C">(<parameter>size</parameter> + <parameter>extra</parameter>
&gt; <constant>SIZE_T_MAX</constant>)</code>.</para> &gt; <constant>SIZE_T_MAX</constant>)</code>.</para>
<para>The <function>sallocx<parameter/></function> function returns the <para>The <function>sallocx()</function> function returns the
real size of the allocation at <parameter>ptr</parameter>.</para> real size of the allocation at <parameter>ptr</parameter>.</para>
<para>The <function>dallocx<parameter/></function> function causes the <para>The <function>dallocx()</function> function causes the
memory referenced by <parameter>ptr</parameter> to be made available for memory referenced by <parameter>ptr</parameter> to be made available for
future allocations.</para> future allocations.</para>
<para>The <function>sdallocx<parameter/></function> function is an <para>The <function>sdallocx()</function> function is an
extension of <function>dallocx<parameter/></function> with a extension of <function>dallocx()</function> with a
<parameter>size</parameter> parameter to allow the caller to pass in the <parameter>size</parameter> parameter to allow the caller to pass in the
allocation size as an optimization. The minimum valid input size is the allocation size as an optimization. The minimum valid input size is the
original requested size of the allocation, and the maximum valid input original requested size of the allocation, and the maximum valid input
size is the corresponding value returned by size is the corresponding value returned by
<function>nallocx<parameter/></function> or <function>nallocx()</function> or
<function>sallocx<parameter/></function>.</para> <function>sallocx()</function>.</para>
<para>The <function>nallocx<parameter/></function> function allocates no <para>The <function>nallocx()</function> function allocates no
memory, but it performs the same size computation as the memory, but it performs the same size computation as the
<function>mallocx<parameter/></function> function, and returns the real <function>mallocx()</function> function, and returns the real
size of the allocation that would result from the equivalent size of the allocation that would result from the equivalent
<function>mallocx<parameter/></function> function call. Behavior is <function>mallocx()</function> function call, or
undefined if <parameter>size</parameter> is <constant>0</constant>, or if <constant>0</constant> if the inputs exceed the maximum supported size
request size overflows due to size class and/or alignment class and/or alignment. Behavior is undefined if
constraints.</para> <parameter>size</parameter> is <constant>0</constant>.</para>
<para>The <function>mallctl<parameter/></function> function provides a <para>The <function>mallctl()</function> function provides a
general interface for introspecting the memory allocator, as well as general interface for introspecting the memory allocator, as well as
setting modifiable parameters and triggering actions. The setting modifiable parameters and triggering actions. The
period-separated <parameter>name</parameter> argument specifies a period-separated <parameter>name</parameter> argument specifies a
...@@ -374,12 +372,12 @@ ...@@ -374,12 +372,12 @@
<parameter>newlen</parameter>; otherwise pass <constant>NULL</constant> <parameter>newlen</parameter>; otherwise pass <constant>NULL</constant>
and <constant>0</constant>.</para> and <constant>0</constant>.</para>
<para>The <function>mallctlnametomib<parameter/></function> function <para>The <function>mallctlnametomib()</function> function
provides a way to avoid repeated name lookups for applications that provides a way to avoid repeated name lookups for applications that
repeatedly query the same portion of the namespace, by translating a name repeatedly query the same portion of the namespace, by translating a name
to a &ldquo;Management Information Base&rdquo; (MIB) that can be passed to a <quote>Management Information Base</quote> (MIB) that can be passed
repeatedly to <function>mallctlbymib<parameter/></function>. Upon repeatedly to <function>mallctlbymib()</function>. Upon
successful return from <function>mallctlnametomib<parameter/></function>, successful return from <function>mallctlnametomib()</function>,
<parameter>mibp</parameter> contains an array of <parameter>mibp</parameter> contains an array of
<parameter>*miblenp</parameter> integers, where <parameter>*miblenp</parameter> integers, where
<parameter>*miblenp</parameter> is the lesser of the number of components <parameter>*miblenp</parameter> is the lesser of the number of components
...@@ -408,43 +406,44 @@ for (i = 0; i < nbins; i++) { ...@@ -408,43 +406,44 @@ for (i = 0; i < nbins; i++) {
mib[2] = i; mib[2] = i;
len = sizeof(bin_size); len = sizeof(bin_size);
mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0); mallctlbymib(mib, miblen, (void *)&bin_size, &len, NULL, 0);
/* Do something with bin_size... */ /* Do something with bin_size... */
}]]></programlisting></para> }]]></programlisting></para>
<para>The <function>malloc_stats_print<parameter/></function> function <para>The <function>malloc_stats_print()</function> function writes
writes human-readable summary statistics via the summary statistics via the <parameter>write_cb</parameter> callback
<parameter>write_cb</parameter> callback function pointer and function pointer and <parameter>cbopaque</parameter> data passed to
<parameter>cbopaque</parameter> data passed to <parameter>write_cb</parameter>, or <function>malloc_message()</function>
<parameter>write_cb</parameter>, or if <parameter>write_cb</parameter> is <constant>NULL</constant>. The
<function>malloc_message<parameter/></function> if statistics are presented in human-readable form unless <quote>J</quote> is
<parameter>write_cb</parameter> is <constant>NULL</constant>. This specified as a character within the <parameter>opts</parameter> string, in
function can be called repeatedly. General information that never which case the statistics are presented in <ulink
changes during execution can be omitted by specifying "g" as a character url="http://www.json.org/">JSON format</ulink>. This function can be
called repeatedly. General information that never changes during
execution can be omitted by specifying <quote>g</quote> as a character
within the <parameter>opts</parameter> string. Note that within the <parameter>opts</parameter> string. Note that
<function>malloc_message<parameter/></function> uses the <function>malloc_message()</function> uses the
<function>mallctl*<parameter/></function> functions internally, so <function>mallctl*()</function> functions internally, so inconsistent
inconsistent statistics can be reported if multiple threads use these statistics can be reported if multiple threads use these functions
functions simultaneously. If <option>--enable-stats</option> is simultaneously. If <option>--enable-stats</option> is specified during
specified during configuration, &ldquo;m&rdquo; and &ldquo;a&rdquo; can configuration, <quote>m</quote> and <quote>a</quote> can be specified to
be specified to omit merged arena and per arena statistics, respectively; omit merged arena and per arena statistics, respectively;
&ldquo;b&rdquo;, &ldquo;l&rdquo;, and &ldquo;h&rdquo; can be specified to <quote>b</quote>, <quote>l</quote>, and <quote>h</quote> can be specified
omit per size class statistics for bins, large objects, and huge objects, to omit per size class statistics for bins, large objects, and huge
respectively. Unrecognized characters are silently ignored. Note that objects, respectively. Unrecognized characters are silently ignored.
thread caching may prevent some statistics from being completely up to Note that thread caching may prevent some statistics from being completely
date, since extra locking would be required to merge counters that track up to date, since extra locking would be required to merge counters that
thread cache operations. track thread cache operations.</para>
</para>
<para>The <function>malloc_usable_size()</function> function
<para>The <function>malloc_usable_size<parameter/></function> function
returns the usable size of the allocation pointed to by returns the usable size of the allocation pointed to by
<parameter>ptr</parameter>. The return value may be larger than the size <parameter>ptr</parameter>. The return value may be larger than the size
that was requested during allocation. The that was requested during allocation. The
<function>malloc_usable_size<parameter/></function> function is not a <function>malloc_usable_size()</function> function is not a
mechanism for in-place <function>realloc<parameter/></function>; rather mechanism for in-place <function>realloc()</function>; rather
it is provided solely as a tool for introspection purposes. Any it is provided solely as a tool for introspection purposes. Any
discrepancy between the requested allocation size and the size reported discrepancy between the requested allocation size and the size reported
by <function>malloc_usable_size<parameter/></function> should not be by <function>malloc_usable_size()</function> should not be
depended on, since such behavior is entirely implementation-dependent. depended on, since such behavior is entirely implementation-dependent.
</para> </para>
</refsect2> </refsect2>
...@@ -455,19 +454,20 @@ for (i = 0; i < nbins; i++) { ...@@ -455,19 +454,20 @@ for (i = 0; i < nbins; i++) {
routines, the allocator initializes its internals based in part on various routines, the allocator initializes its internals based in part on various
options that can be specified at compile- or run-time.</para> options that can be specified at compile- or run-time.</para>
<para>The string pointed to by the global variable <para>The string specified via <option>--with-malloc-conf</option>, the
<varname>malloc_conf</varname>, the &ldquo;name&rdquo; of the file string pointed to by the global variable <varname>malloc_conf</varname>, the
referenced by the symbolic link named <filename <quote>name</quote> of the file referenced by the symbolic link named
class="symlink">/etc/malloc.conf</filename>, and the value of the <filename class="symlink">/etc/malloc.conf</filename>, and the value of the
environment variable <envar>MALLOC_CONF</envar>, will be interpreted, in environment variable <envar>MALLOC_CONF</envar>, will be interpreted, in
that order, from left to right as options. Note that that order, from left to right as options. Note that
<varname>malloc_conf</varname> may be read before <varname>malloc_conf</varname> may be read before
<function>main<parameter/></function> is entered, so the declaration of <function>main()</function> is entered, so the declaration of
<varname>malloc_conf</varname> should specify an initializer that contains <varname>malloc_conf</varname> should specify an initializer that contains
the final value to be read by jemalloc. <varname>malloc_conf</varname> is the final value to be read by jemalloc. <option>--with-malloc-conf</option>
a compile-time setting, whereas <filename and <varname>malloc_conf</varname> are compile-time mechanisms, whereas
class="symlink">/etc/malloc.conf</filename> and <envar>MALLOC_CONF</envar> <filename class="symlink">/etc/malloc.conf</filename> and
can be safely set any time prior to program invocation.</para> <envar>MALLOC_CONF</envar> can be safely set any time prior to program
invocation.</para>
<para>An options string is a comma-separated list of option:value pairs. <para>An options string is a comma-separated list of option:value pairs.
There is one key corresponding to each <link There is one key corresponding to each <link
...@@ -517,23 +517,18 @@ for (i = 0; i < nbins; i++) { ...@@ -517,23 +517,18 @@ for (i = 0; i < nbins; i++) {
common case, but it increases memory usage and fragmentation, since a common case, but it increases memory usage and fragmentation, since a
bounded number of objects can remain allocated in each thread cache.</para> bounded number of objects can remain allocated in each thread cache.</para>
<para>Memory is conceptually broken into equal-sized chunks, where the <para>Memory is conceptually broken into equal-sized chunks, where the chunk
chunk size is a power of two that is greater than the page size. Chunks size is a power of two that is greater than the page size. Chunks are
are always aligned to multiples of the chunk size. This alignment makes it always aligned to multiples of the chunk size. This alignment makes it
possible to find metadata for user objects very quickly.</para> possible to find metadata for user objects very quickly. User objects are
broken into three categories according to size: small, large, and huge.
<para>User objects are broken into three categories according to size: Multiple small and large objects can reside within a single chunk, whereas
small, large, and huge. Small and large objects are managed entirely by huge objects each have one or more chunks backing them. Each chunk that
arenas; huge objects are additionally aggregated in a single data structure contains small and/or large objects tracks its contents as runs of
that is shared by all threads. Huge objects are typically used by
applications infrequently enough that this single data structure is not a
scalability issue.</para>
<para>Each chunk that is managed by an arena tracks its contents as runs of
contiguous pages (unused, backing a set of small objects, or backing one contiguous pages (unused, backing a set of small objects, or backing one
large object). The combination of chunk alignment and chunk page maps large object). The combination of chunk alignment and chunk page maps makes
makes it possible to determine all metadata regarding small and large it possible to determine all metadata regarding small and large allocations
allocations in constant time.</para> in constant time.</para>
<para>Small objects are managed in groups by page runs. Each run maintains <para>Small objects are managed in groups by page runs. Each run maintains
a bitmap to track which regions are in use. Allocation requests that are no a bitmap to track which regions are in use. Allocation requests that are no
...@@ -546,8 +541,8 @@ for (i = 0; i < nbins; i++) { ...@@ -546,8 +541,8 @@ for (i = 0; i < nbins; i++) {
are smaller than four times the page size, large size classes are smaller are smaller than four times the page size, large size classes are smaller
than the chunk size (see the <link than the chunk size (see the <link
linkend="opt.lg_chunk"><mallctl>opt.lg_chunk</mallctl></link> option), and linkend="opt.lg_chunk"><mallctl>opt.lg_chunk</mallctl></link> option), and
huge size classes extend from the chunk size up to one size class less than huge size classes extend from the chunk size up to the largest size class
the full address space size.</para> that does not exceed <constant>PTRDIFF_MAX</constant>.</para>
<para>Allocations are packed tightly together, which can be an issue for <para>Allocations are packed tightly together, which can be an issue for
multi-threaded applications. If you need to assure that allocations do not multi-threaded applications. If you need to assure that allocations do not
...@@ -555,14 +550,14 @@ for (i = 0; i < nbins; i++) { ...@@ -555,14 +550,14 @@ for (i = 0; i < nbins; i++) {
nearest multiple of the cacheline size, or specify cacheline alignment when nearest multiple of the cacheline size, or specify cacheline alignment when
allocating.</para> allocating.</para>
<para>The <function>realloc<parameter/></function>, <para>The <function>realloc()</function>,
<function>rallocx<parameter/></function>, and <function>rallocx()</function>, and
<function>xallocx<parameter/></function> functions may resize allocations <function>xallocx()</function> functions may resize allocations
without moving them under limited circumstances. Unlike the without moving them under limited circumstances. Unlike the
<function>*allocx<parameter/></function> API, the standard API does not <function>*allocx()</function> API, the standard API does not
officially round up the usable size of an allocation to the nearest size officially round up the usable size of an allocation to the nearest size
class, so technically it is necessary to call class, so technically it is necessary to call
<function>realloc<parameter/></function> to grow e.g. a 9-byte allocation to <function>realloc()</function> to grow e.g. a 9-byte allocation to
16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage 16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage
trivially succeeds in place as long as the pre-size and post-size both round trivially succeeds in place as long as the pre-size and post-size both round
up to the same size class. No other API guarantees are made regarding up to the same size class. No other API guarantees are made regarding
...@@ -665,7 +660,7 @@ for (i = 0; i < nbins; i++) { ...@@ -665,7 +660,7 @@ for (i = 0; i < nbins; i++) {
<entry>[1280 KiB, 1536 KiB, 1792 KiB]</entry> <entry>[1280 KiB, 1536 KiB, 1792 KiB]</entry>
</row> </row>
<row> <row>
<entry morerows="6">Huge</entry> <entry morerows="8">Huge</entry>
<entry>256 KiB</entry> <entry>256 KiB</entry>
<entry>[2 MiB]</entry> <entry>[2 MiB]</entry>
</row> </row>
...@@ -693,6 +688,14 @@ for (i = 0; i < nbins; i++) { ...@@ -693,6 +688,14 @@ for (i = 0; i < nbins; i++) {
<entry>...</entry> <entry>...</entry>
<entry>...</entry> <entry>...</entry>
</row> </row>
<row>
<entry>512 PiB</entry>
<entry>[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]</entry>
</row>
<row>
<entry>1 EiB</entry>
<entry>[5 EiB, 6 EiB, 7 EiB]</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
...@@ -700,7 +703,7 @@ for (i = 0; i < nbins; i++) { ...@@ -700,7 +703,7 @@ for (i = 0; i < nbins; i++) {
<refsect1 id="mallctl_namespace"> <refsect1 id="mallctl_namespace">
<title>MALLCTL NAMESPACE</title> <title>MALLCTL NAMESPACE</title>
<para>The following names are defined in the namespace accessible via the <para>The following names are defined in the namespace accessible via the
<function>mallctl*<parameter/></function> functions. Value types are <function>mallctl*()</function> functions. Value types are
specified in parentheses, their readable/writable statuses are encoded as specified in parentheses, their readable/writable statuses are encoded as
<literal>rw</literal>, <literal>r-</literal>, <literal>-w</literal>, or <literal>rw</literal>, <literal>r-</literal>, <literal>-w</literal>, or
<literal>--</literal>, and required build configuration flags follow, if <literal>--</literal>, and required build configuration flags follow, if
...@@ -731,7 +734,7 @@ for (i = 0; i < nbins; i++) { ...@@ -731,7 +734,7 @@ for (i = 0; i < nbins; i++) {
<literal>rw</literal> <literal>rw</literal>
</term> </term>
<listitem><para>If a value is passed in, refresh the data from which <listitem><para>If a value is passed in, refresh the data from which
the <function>mallctl*<parameter/></function> functions report values, the <function>mallctl*()</function> functions report values,
and increment the epoch. Return the current epoch. This is useful for and increment the epoch. Return the current epoch. This is useful for
detecting whether another thread caused a refresh.</para></listitem> detecting whether another thread caused a refresh.</para></listitem>
</varlistentry> </varlistentry>
...@@ -776,6 +779,17 @@ for (i = 0; i < nbins; i++) { ...@@ -776,6 +779,17 @@ for (i = 0; i < nbins; i++) {
during build configuration.</para></listitem> during build configuration.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="config.malloc_conf">
<term>
<mallctl>config.malloc_conf</mallctl>
(<type>const char *</type>)
<literal>r-</literal>
</term>
<listitem><para>Embedded configure-time-specified run-time options
string, empty unless <option>--with-malloc-conf</option> was specified
during build configuration.</para></listitem>
</varlistentry>
<varlistentry id="config.munmap"> <varlistentry id="config.munmap">
<term> <term>
<mallctl>config.munmap</mallctl> <mallctl>config.munmap</mallctl>
...@@ -904,12 +918,12 @@ for (i = 0; i < nbins; i++) { ...@@ -904,12 +918,12 @@ for (i = 0; i < nbins; i++) {
settings are supported if settings are supported if
<citerefentry><refentrytitle>sbrk</refentrytitle> <citerefentry><refentrytitle>sbrk</refentrytitle>
<manvolnum>2</manvolnum></citerefentry> is supported by the operating <manvolnum>2</manvolnum></citerefentry> is supported by the operating
system: &ldquo;disabled&rdquo;, &ldquo;primary&rdquo;, and system: <quote>disabled</quote>, <quote>primary</quote>, and
&ldquo;secondary&rdquo;; otherwise only &ldquo;disabled&rdquo; is <quote>secondary</quote>; otherwise only <quote>disabled</quote> is
supported. The default is &ldquo;secondary&rdquo; if supported. The default is <quote>secondary</quote> if
<citerefentry><refentrytitle>sbrk</refentrytitle> <citerefentry><refentrytitle>sbrk</refentrytitle>
<manvolnum>2</manvolnum></citerefentry> is supported by the operating <manvolnum>2</manvolnum></citerefentry> is supported by the operating
system; &ldquo;disabled&rdquo; otherwise. system; <quote>disabled</quote> otherwise.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
...@@ -929,7 +943,7 @@ for (i = 0; i < nbins; i++) { ...@@ -929,7 +943,7 @@ for (i = 0; i < nbins; i++) {
<varlistentry id="opt.narenas"> <varlistentry id="opt.narenas">
<term> <term>
<mallctl>opt.narenas</mallctl> <mallctl>opt.narenas</mallctl>
(<type>size_t</type>) (<type>unsigned</type>)
<literal>r-</literal> <literal>r-</literal>
</term> </term>
<listitem><para>Maximum number of arenas to use for automatic <listitem><para>Maximum number of arenas to use for automatic
...@@ -937,6 +951,20 @@ for (i = 0; i < nbins; i++) { ...@@ -937,6 +951,20 @@ for (i = 0; i < nbins; i++) {
number of CPUs, or one if there is a single CPU.</para></listitem> number of CPUs, or one if there is a single CPU.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.purge">
<term>
<mallctl>opt.purge</mallctl>
(<type>const char *</type>)
<literal>r-</literal>
</term>
<listitem><para>Purge mode is &ldquo;ratio&rdquo; (default) or
&ldquo;decay&rdquo;. See <link
linkend="opt.lg_dirty_mult"><mallctl>opt.lg_dirty_mult</mallctl></link>
for details of the ratio mode. See <link
linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
details of the decay mode.</para></listitem>
</varlistentry>
<varlistentry id="opt.lg_dirty_mult"> <varlistentry id="opt.lg_dirty_mult">
<term> <term>
<mallctl>opt.lg_dirty_mult</mallctl> <mallctl>opt.lg_dirty_mult</mallctl>
...@@ -959,6 +987,26 @@ for (i = 0; i < nbins; i++) { ...@@ -959,6 +987,26 @@ for (i = 0; i < nbins; i++) {
for related dynamic control options.</para></listitem> for related dynamic control options.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.decay_time">
<term>
<mallctl>opt.decay_time</mallctl>
(<type>ssize_t</type>)
<literal>r-</literal>
</term>
<listitem><para>Approximate time in seconds from the creation of a set
of unused dirty pages until an equivalent set of unused dirty pages is
purged and/or reused. The pages are incrementally purged according to a
sigmoidal decay curve that starts and ends with zero purge rate. A
decay time of 0 causes all unused dirty pages to be purged immediately
upon creation. A decay time of -1 disables purging. The default decay
time is 10 seconds. See <link
linkend="arenas.decay_time"><mallctl>arenas.decay_time</mallctl></link>
and <link
linkend="arena.i.decay_time"><mallctl>arena.&lt;i&gt;.decay_time</mallctl></link>
for related dynamic control options.
</para></listitem>
</varlistentry>
<varlistentry id="opt.stats_print"> <varlistentry id="opt.stats_print">
<term> <term>
<mallctl>opt.stats_print</mallctl> <mallctl>opt.stats_print</mallctl>
...@@ -966,19 +1014,19 @@ for (i = 0; i < nbins; i++) { ...@@ -966,19 +1014,19 @@ for (i = 0; i < nbins; i++) {
<literal>r-</literal> <literal>r-</literal>
</term> </term>
<listitem><para>Enable/disable statistics printing at exit. If <listitem><para>Enable/disable statistics printing at exit. If
enabled, the <function>malloc_stats_print<parameter/></function> enabled, the <function>malloc_stats_print()</function>
function is called at program exit via an function is called at program exit via an
<citerefentry><refentrytitle>atexit</refentrytitle> <citerefentry><refentrytitle>atexit</refentrytitle>
<manvolnum>3</manvolnum></citerefentry> function. If <manvolnum>3</manvolnum></citerefentry> function. If
<option>--enable-stats</option> is specified during configuration, this <option>--enable-stats</option> is specified during configuration, this
has the potential to cause deadlock for a multi-threaded process that has the potential to cause deadlock for a multi-threaded process that
exits while one or more threads are executing in the memory allocation exits while one or more threads are executing in the memory allocation
functions. Furthermore, <function>atexit<parameter/></function> may functions. Furthermore, <function>atexit()</function> may
allocate memory during application initialization and then deadlock allocate memory during application initialization and then deadlock
internally when jemalloc in turn calls internally when jemalloc in turn calls
<function>atexit<parameter/></function>, so this option is not <function>atexit()</function>, so this option is not
univerally usable (though the application can register its own universally usable (though the application can register its own
<function>atexit<parameter/></function> function with equivalent <function>atexit()</function> function with equivalent
functionality). Therefore, this option should only be used with care; functionality). Therefore, this option should only be used with care;
it is primarily intended as a performance tuning aid during application it is primarily intended as a performance tuning aid during application
development. This option is disabled by default.</para></listitem> development. This option is disabled by default.</para></listitem>
...@@ -991,15 +1039,16 @@ for (i = 0; i < nbins; i++) { ...@@ -991,15 +1039,16 @@ for (i = 0; i < nbins; i++) {
<literal>r-</literal> <literal>r-</literal>
[<option>--enable-fill</option>] [<option>--enable-fill</option>]
</term> </term>
<listitem><para>Junk filling. If set to "alloc", each byte of <listitem><para>Junk filling. If set to <quote>alloc</quote>, each byte
uninitialized allocated memory will be initialized to of uninitialized allocated memory will be initialized to
<literal>0xa5</literal>. If set to "free", all deallocated memory will <literal>0xa5</literal>. If set to <quote>free</quote>, all deallocated
be initialized to <literal>0x5a</literal>. If set to "true", both memory will be initialized to <literal>0x5a</literal>. If set to
allocated and deallocated memory will be initialized, and if set to <quote>true</quote>, both allocated and deallocated memory will be
"false", junk filling be disabled entirely. This is intended for initialized, and if set to <quote>false</quote>, junk filling be
debugging and will impact performance negatively. This option is disabled entirely. This is intended for debugging and will impact
"false" by default unless <option>--enable-debug</option> is specified performance negatively. This option is <quote>false</quote> by default
during configuration, in which case it is "true" by default unless unless <option>--enable-debug</option> is specified during
configuration, in which case it is <quote>true</quote> by default unless
running inside <ulink running inside <ulink
url="http://valgrind.org/">Valgrind</ulink>.</para></listitem> url="http://valgrind.org/">Valgrind</ulink>.</para></listitem>
</varlistentry> </varlistentry>
...@@ -1054,8 +1103,8 @@ for (i = 0; i < nbins; i++) { ...@@ -1054,8 +1103,8 @@ for (i = 0; i < nbins; i++) {
<listitem><para>Zero filling enabled/disabled. If enabled, each byte <listitem><para>Zero filling enabled/disabled. If enabled, each byte
of uninitialized allocated memory will be initialized to 0. Note that of uninitialized allocated memory will be initialized to 0. Note that
this initialization only happens once for each byte, so this initialization only happens once for each byte, so
<function>realloc<parameter/></function> and <function>realloc()</function> and
<function>rallocx<parameter/></function> calls do not zero memory that <function>rallocx()</function> calls do not zero memory that
was previously allocated. This is intended for debugging and will was previously allocated. This is intended for debugging and will
impact performance negatively. This option is disabled by default. impact performance negatively. This option is disabled by default.
</para></listitem> </para></listitem>
...@@ -1150,7 +1199,8 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1150,7 +1199,8 @@ malloc_conf = "xmalloc:true";]]></programlisting>
the <command>jeprof</command> command, which is based on the the <command>jeprof</command> command, which is based on the
<command>pprof</command> that is developed as part of the <ulink <command>pprof</command> that is developed as part of the <ulink
url="http://code.google.com/p/gperftools/">gperftools url="http://code.google.com/p/gperftools/">gperftools
package</ulink>.</para></listitem> package</ulink>. See <link linkend="heap_profile_format">HEAP PROFILE
FORMAT</link> for heap profile format documentation.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.prof_prefix"> <varlistentry id="opt.prof_prefix">
...@@ -1277,11 +1327,11 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1277,11 +1327,11 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</filename>, <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</filename>,
where <literal>&lt;prefix&gt;</literal> is controlled by the <link where <literal>&lt;prefix&gt;</literal> is controlled by the <link
linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
option. Note that <function>atexit<parameter/></function> may allocate option. Note that <function>atexit()</function> may allocate
memory during application initialization and then deadlock internally memory during application initialization and then deadlock internally
when jemalloc in turn calls <function>atexit<parameter/></function>, so when jemalloc in turn calls <function>atexit()</function>, so
this option is not univerally usable (though the application can this option is not universally usable (though the application can
register its own <function>atexit<parameter/></function> function with register its own <function>atexit()</function> function with
equivalent functionality). This option is disabled by equivalent functionality). This option is disabled by
default.</para></listitem> default.</para></listitem>
</varlistentry> </varlistentry>
...@@ -1340,7 +1390,7 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1340,7 +1390,7 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<link <link
linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link> linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link>
mallctl. This is useful for avoiding the overhead of repeated mallctl. This is useful for avoiding the overhead of repeated
<function>mallctl*<parameter/></function> calls.</para></listitem> <function>mallctl*()</function> calls.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="thread.deallocated"> <varlistentry id="thread.deallocated">
...@@ -1367,7 +1417,7 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1367,7 +1417,7 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<link <link
linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link> linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link>
mallctl. This is useful for avoiding the overhead of repeated mallctl. This is useful for avoiding the overhead of repeated
<function>mallctl*<parameter/></function> calls.</para></listitem> <function>mallctl*()</function> calls.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="thread.tcache.enabled"> <varlistentry id="thread.tcache.enabled">
...@@ -1418,8 +1468,8 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1418,8 +1468,8 @@ malloc_conf = "xmalloc:true";]]></programlisting>
can cause asynchronous string deallocation. Furthermore, each can cause asynchronous string deallocation. Furthermore, each
invocation of this interface can only read or write; simultaneous invocation of this interface can only read or write; simultaneous
read/write is not supported due to string lifetime limitations. The read/write is not supported due to string lifetime limitations. The
name string must nil-terminated and comprised only of characters in the name string must be nil-terminated and comprised only of characters in
sets recognized the sets recognized
by <citerefentry><refentrytitle>isgraph</refentrytitle> by <citerefentry><refentrytitle>isgraph</refentrytitle>
<manvolnum>3</manvolnum></citerefentry> and <manvolnum>3</manvolnum></citerefentry> and
<citerefentry><refentrytitle>isblank</refentrytitle> <citerefentry><refentrytitle>isblank</refentrytitle>
...@@ -1467,7 +1517,7 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1467,7 +1517,7 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<listitem><para>Flush the specified thread-specific cache (tcache). The <listitem><para>Flush the specified thread-specific cache (tcache). The
same considerations apply to this interface as to <link same considerations apply to this interface as to <link
linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>, linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>,
except that the tcache will never be automatically be discarded. except that the tcache will never be automatically discarded.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
...@@ -1489,12 +1539,44 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1489,12 +1539,44 @@ malloc_conf = "xmalloc:true";]]></programlisting>
(<type>void</type>) (<type>void</type>)
<literal>--</literal> <literal>--</literal>
</term> </term>
<listitem><para>Purge unused dirty pages for arena &lt;i&gt;, or for <listitem><para>Purge all unused dirty pages for arena &lt;i&gt;, or for
all arenas if &lt;i&gt; equals <link all arenas if &lt;i&gt; equals <link
linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>. linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="arena.i.decay">
<term>
<mallctl>arena.&lt;i&gt;.decay</mallctl>
(<type>void</type>)
<literal>--</literal>
</term>
<listitem><para>Trigger decay-based purging of unused dirty pages for
arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals <link
linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>.
The proportion of unused dirty pages to be purged depends on the current
time; see <link
linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
details.</para></listitem>
</varlistentry>
<varlistentry id="arena.i.reset">
<term>
<mallctl>arena.&lt;i&gt;.reset</mallctl>
(<type>void</type>)
<literal>--</literal>
</term>
<listitem><para>Discard all of the arena's extant allocations. This
interface can only be used with arenas created via <link
linkend="arenas.extend"><mallctl>arenas.extend</mallctl></link>. None
of the arena's discarded/cached allocations may accessed afterward. As
part of this requirement, all thread caches which were used to
allocate/deallocate in conjunction with the arena must be flushed
beforehand. This interface cannot be used if running inside Valgrind,
nor if the <link linkend="opt.quarantine">quarantine</link> size is
non-zero.</para></listitem>
</varlistentry>
<varlistentry id="arena.i.dss"> <varlistentry id="arena.i.dss">
<term> <term>
<mallctl>arena.&lt;i&gt;.dss</mallctl> <mallctl>arena.&lt;i&gt;.dss</mallctl>
...@@ -1523,6 +1605,22 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1523,6 +1605,22 @@ malloc_conf = "xmalloc:true";]]></programlisting>
for additional information.</para></listitem> for additional information.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="arena.i.decay_time">
<term>
<mallctl>arena.&lt;i&gt;.decay_time</mallctl>
(<type>ssize_t</type>)
<literal>rw</literal>
</term>
<listitem><para>Current per-arena approximate time in seconds from the
creation of a set of unused dirty pages until an equivalent set of
unused dirty pages is purged and/or reused. Each time this interface is
set, all currently unused dirty pages are considered to have fully
decayed, which causes immediate purging of all unused dirty pages unless
the decay time is set to -1 (i.e. purging disabled). See <link
linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
additional information.</para></listitem>
</varlistentry>
<varlistentry id="arena.i.chunk_hooks"> <varlistentry id="arena.i.chunk_hooks">
<term> <term>
<mallctl>arena.&lt;i&gt;.chunk_hooks</mallctl> <mallctl>arena.&lt;i&gt;.chunk_hooks</mallctl>
...@@ -1757,6 +1855,21 @@ typedef struct { ...@@ -1757,6 +1855,21 @@ typedef struct {
for additional information.</para></listitem> for additional information.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="arenas.decay_time">
<term>
<mallctl>arenas.decay_time</mallctl>
(<type>ssize_t</type>)
<literal>rw</literal>
</term>
<listitem><para>Current default per-arena approximate time in seconds
from the creation of a set of unused dirty pages until an equivalent set
of unused dirty pages is purged and/or reused, used to initialize <link
linkend="arena.i.decay_time"><mallctl>arena.&lt;i&gt;.decay_time</mallctl></link>
during arena creation. See <link
linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
additional information.</para></listitem>
</varlistentry>
<varlistentry id="arenas.quantum"> <varlistentry id="arenas.quantum">
<term> <term>
<mallctl>arenas.quantum</mallctl> <mallctl>arenas.quantum</mallctl>
...@@ -1976,7 +2089,7 @@ typedef struct { ...@@ -1976,7 +2089,7 @@ typedef struct {
[<option>--enable-prof</option>] [<option>--enable-prof</option>]
</term> </term>
<listitem><para>Average number of bytes allocated between <listitem><para>Average number of bytes allocated between
inverval-based profile dumps. See the interval-based profile dumps. See the
<link <link
linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link> linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
option for additional information.</para></listitem> option for additional information.</para></listitem>
...@@ -2075,6 +2188,25 @@ typedef struct { ...@@ -2075,6 +2188,25 @@ typedef struct {
linkend="stats.resident"><mallctl>stats.resident</mallctl></link>.</para></listitem> linkend="stats.resident"><mallctl>stats.resident</mallctl></link>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="stats.retained">
<term>
<mallctl>stats.retained</mallctl>
(<type>size_t</type>)
<literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Total number of bytes in virtual memory mappings that
were retained rather than being returned to the operating system via
e.g. <citerefentry><refentrytitle>munmap</refentrytitle>
<manvolnum>2</manvolnum></citerefentry>. Retained virtual memory is
typically untouched, decommitted, or purged, so it has no strongly
associated physical memory (see <link
linkend="arena.i.chunk_hooks">chunk hooks</link> for details). Retained
memory is excluded from mapped memory statistics, e.g. <link
linkend="stats.mapped"><mallctl>stats.mapped</mallctl></link>.
</para></listitem>
</varlistentry>
<varlistentry id="stats.arenas.i.dss"> <varlistentry id="stats.arenas.i.dss">
<term> <term>
<mallctl>stats.arenas.&lt;i&gt;.dss</mallctl> <mallctl>stats.arenas.&lt;i&gt;.dss</mallctl>
...@@ -2101,6 +2233,19 @@ typedef struct { ...@@ -2101,6 +2233,19 @@ typedef struct {
for details.</para></listitem> for details.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="stats.arenas.i.decay_time">
<term>
<mallctl>stats.arenas.&lt;i&gt;.decay_time</mallctl>
(<type>ssize_t</type>)
<literal>r-</literal>
</term>
<listitem><para>Approximate time in seconds from the creation of a set
of unused dirty pages until an equivalent set of unused dirty pages is
purged and/or reused. See <link
linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link>
for details.</para></listitem>
</varlistentry>
<varlistentry id="stats.arenas.i.nthreads"> <varlistentry id="stats.arenas.i.nthreads">
<term> <term>
<mallctl>stats.arenas.&lt;i&gt;.nthreads</mallctl> <mallctl>stats.arenas.&lt;i&gt;.nthreads</mallctl>
...@@ -2142,6 +2287,18 @@ typedef struct { ...@@ -2142,6 +2287,18 @@ typedef struct {
<listitem><para>Number of mapped bytes.</para></listitem> <listitem><para>Number of mapped bytes.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="stats.arenas.i.retained">
<term>
<mallctl>stats.arenas.&lt;i&gt;.retained</mallctl>
(<type>size_t</type>)
<literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Number of retained bytes. See <link
linkend="stats.retained"><mallctl>stats.retained</mallctl></link> for
details.</para></listitem>
</varlistentry>
<varlistentry id="stats.arenas.i.metadata.mapped"> <varlistentry id="stats.arenas.i.metadata.mapped">
<term> <term>
<mallctl>stats.arenas.&lt;i&gt;.metadata.mapped</mallctl> <mallctl>stats.arenas.&lt;i&gt;.metadata.mapped</mallctl>
...@@ -2523,6 +2680,53 @@ typedef struct { ...@@ -2523,6 +2680,53 @@ typedef struct {
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
<refsect1 id="heap_profile_format">
<title>HEAP PROFILE FORMAT</title>
<para>Although the heap profiling functionality was originally designed to
be compatible with the
<command>pprof</command> command that is developed as part of the <ulink
url="http://code.google.com/p/gperftools/">gperftools
package</ulink>, the addition of per thread heap profiling functionality
required a different heap profile format. The <command>jeprof</command>
command is derived from <command>pprof</command>, with enhancements to
support the heap profile format described here.</para>
<para>In the following hypothetical heap profile, <constant>[...]</constant>
indicates elision for the sake of compactness. <programlisting><![CDATA[
heap_v2/524288
t*: 28106: 56637512 [0: 0]
[...]
t3: 352: 16777344 [0: 0]
[...]
t99: 17754: 29341640 [0: 0]
[...]
@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...]
t*: 13: 6688 [0: 0]
t3: 12: 6496 [0: ]
t99: 1: 192 [0: 0]
[...]
MAPPED_LIBRARIES:
[...]]]></programlisting> The following matches the above heap profile, but most
tokens are replaced with <constant>&lt;description&gt;</constant> to indicate
descriptions of the corresponding fields. <programlisting><![CDATA[
<heap_profile_format_version>/<mean_sample_interval>
<aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[...]
<thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
[...]
<thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
[...]
@ <top_frame> <frame> [...] <frame> <frame> <frame> [...]
<backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
<backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
<backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[...]
MAPPED_LIBRARIES:
</proc/<pid>/maps>]]></programlisting></para>
</refsect1>
<refsect1 id="debugging_malloc_problems"> <refsect1 id="debugging_malloc_problems">
<title>DEBUGGING MALLOC PROBLEMS</title> <title>DEBUGGING MALLOC PROBLEMS</title>
<para>When debugging, it is a good idea to configure/build jemalloc with <para>When debugging, it is a good idea to configure/build jemalloc with
...@@ -2532,7 +2736,7 @@ typedef struct { ...@@ -2532,7 +2736,7 @@ typedef struct {
of run-time assertions that catch application errors such as double-free, of run-time assertions that catch application errors such as double-free,
write-after-free, etc.</para> write-after-free, etc.</para>
<para>Programs often accidentally depend on &ldquo;uninitialized&rdquo; <para>Programs often accidentally depend on <quote>uninitialized</quote>
memory actually being filled with zero bytes. Junk filling memory actually being filled with zero bytes. Junk filling
(see the <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link> (see the <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link>
option) tends to expose such bugs in the form of obviously incorrect option) tends to expose such bugs in the form of obviously incorrect
...@@ -2561,29 +2765,29 @@ typedef struct { ...@@ -2561,29 +2765,29 @@ typedef struct {
to override the function which emits the text strings forming the errors to override the function which emits the text strings forming the errors
and warnings if for some reason the <constant>STDERR_FILENO</constant> file and warnings if for some reason the <constant>STDERR_FILENO</constant> file
descriptor is not suitable for this. descriptor is not suitable for this.
<function>malloc_message<parameter/></function> takes the <function>malloc_message()</function> takes the
<parameter>cbopaque</parameter> pointer argument that is <parameter>cbopaque</parameter> pointer argument that is
<constant>NULL</constant> unless overridden by the arguments in a call to <constant>NULL</constant> unless overridden by the arguments in a call to
<function>malloc_stats_print<parameter/></function>, followed by a string <function>malloc_stats_print()</function>, followed by a string
pointer. Please note that doing anything which tries to allocate memory in pointer. Please note that doing anything which tries to allocate memory in
this function is likely to result in a crash or deadlock.</para> this function is likely to result in a crash or deadlock.</para>
<para>All messages are prefixed by <para>All messages are prefixed by
&ldquo;<computeroutput>&lt;jemalloc&gt;: </computeroutput>&rdquo;.</para> <quote><computeroutput>&lt;jemalloc&gt;: </computeroutput></quote>.</para>
</refsect1> </refsect1>
<refsect1 id="return_values"> <refsect1 id="return_values">
<title>RETURN VALUES</title> <title>RETURN VALUES</title>
<refsect2> <refsect2>
<title>Standard API</title> <title>Standard API</title>
<para>The <function>malloc<parameter/></function> and <para>The <function>malloc()</function> and
<function>calloc<parameter/></function> functions return a pointer to the <function>calloc()</function> functions return a pointer to the
allocated memory if successful; otherwise a <constant>NULL</constant> allocated memory if successful; otherwise a <constant>NULL</constant>
pointer is returned and <varname>errno</varname> is set to pointer is returned and <varname>errno</varname> is set to
<errorname>ENOMEM</errorname>.</para> <errorname>ENOMEM</errorname>.</para>
<para>The <function>posix_memalign<parameter/></function> function <para>The <function>posix_memalign()</function> function
returns the value 0 if successful; otherwise it returns an error value. returns the value 0 if successful; otherwise it returns an error value.
The <function>posix_memalign<parameter/></function> function will fail The <function>posix_memalign()</function> function will fail
if: if:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -2602,11 +2806,11 @@ typedef struct { ...@@ -2602,11 +2806,11 @@ typedef struct {
</variablelist> </variablelist>
</para> </para>
<para>The <function>aligned_alloc<parameter/></function> function returns <para>The <function>aligned_alloc()</function> function returns
a pointer to the allocated memory if successful; otherwise a a pointer to the allocated memory if successful; otherwise a
<constant>NULL</constant> pointer is returned and <constant>NULL</constant> pointer is returned and
<varname>errno</varname> is set. The <varname>errno</varname> is set. The
<function>aligned_alloc<parameter/></function> function will fail if: <function>aligned_alloc()</function> function will fail if:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><errorname>EINVAL</errorname></term> <term><errorname>EINVAL</errorname></term>
...@@ -2623,44 +2827,44 @@ typedef struct { ...@@ -2623,44 +2827,44 @@ typedef struct {
</variablelist> </variablelist>
</para> </para>
<para>The <function>realloc<parameter/></function> function returns a <para>The <function>realloc()</function> function returns a
pointer, possibly identical to <parameter>ptr</parameter>, to the pointer, possibly identical to <parameter>ptr</parameter>, to the
allocated memory if successful; otherwise a <constant>NULL</constant> allocated memory if successful; otherwise a <constant>NULL</constant>
pointer is returned, and <varname>errno</varname> is set to pointer is returned, and <varname>errno</varname> is set to
<errorname>ENOMEM</errorname> if the error was the result of an <errorname>ENOMEM</errorname> if the error was the result of an
allocation failure. The <function>realloc<parameter/></function> allocation failure. The <function>realloc()</function>
function always leaves the original buffer intact when an error occurs. function always leaves the original buffer intact when an error occurs.
</para> </para>
<para>The <function>free<parameter/></function> function returns no <para>The <function>free()</function> function returns no
value.</para> value.</para>
</refsect2> </refsect2>
<refsect2> <refsect2>
<title>Non-standard API</title> <title>Non-standard API</title>
<para>The <function>mallocx<parameter/></function> and <para>The <function>mallocx()</function> and
<function>rallocx<parameter/></function> functions return a pointer to <function>rallocx()</function> functions return a pointer to
the allocated memory if successful; otherwise a <constant>NULL</constant> the allocated memory if successful; otherwise a <constant>NULL</constant>
pointer is returned to indicate insufficient contiguous memory was pointer is returned to indicate insufficient contiguous memory was
available to service the allocation request. </para> available to service the allocation request. </para>
<para>The <function>xallocx<parameter/></function> function returns the <para>The <function>xallocx()</function> function returns the
real size of the resulting resized allocation pointed to by real size of the resulting resized allocation pointed to by
<parameter>ptr</parameter>, which is a value less than <parameter>ptr</parameter>, which is a value less than
<parameter>size</parameter> if the allocation could not be adequately <parameter>size</parameter> if the allocation could not be adequately
grown in place. </para> grown in place. </para>
<para>The <function>sallocx<parameter/></function> function returns the <para>The <function>sallocx()</function> function returns the
real size of the allocation pointed to by <parameter>ptr</parameter>. real size of the allocation pointed to by <parameter>ptr</parameter>.
</para> </para>
<para>The <function>nallocx<parameter/></function> returns the real size <para>The <function>nallocx()</function> returns the real size
that would result from a successful equivalent that would result from a successful equivalent
<function>mallocx<parameter/></function> function call, or zero if <function>mallocx()</function> function call, or zero if
insufficient memory is available to perform the size computation. </para> insufficient memory is available to perform the size computation. </para>
<para>The <function>mallctl<parameter/></function>, <para>The <function>mallctl()</function>,
<function>mallctlnametomib<parameter/></function>, and <function>mallctlnametomib()</function>, and
<function>mallctlbymib<parameter/></function> functions return 0 on <function>mallctlbymib()</function> functions return 0 on
success; otherwise they return an error value. The functions will fail success; otherwise they return an error value. The functions will fail
if: if:
<variablelist> <variablelist>
...@@ -2696,13 +2900,13 @@ typedef struct { ...@@ -2696,13 +2900,13 @@ typedef struct {
<term><errorname>EFAULT</errorname></term> <term><errorname>EFAULT</errorname></term>
<listitem><para>An interface with side effects failed in some way <listitem><para>An interface with side effects failed in some way
not directly related to <function>mallctl*<parameter/></function> not directly related to <function>mallctl*()</function>
read/write processing.</para></listitem> read/write processing.</para></listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<para>The <function>malloc_usable_size<parameter/></function> function <para>The <function>malloc_usable_size()</function> function
returns the usable size of the allocation pointed to by returns the usable size of the allocation pointed to by
<parameter>ptr</parameter>. </para> <parameter>ptr</parameter>. </para>
</refsect2> </refsect2>
...@@ -2750,13 +2954,13 @@ malloc_conf = "lg_chunk:24";]]></programlisting></para> ...@@ -2750,13 +2954,13 @@ malloc_conf = "lg_chunk:24";]]></programlisting></para>
</refsect1> </refsect1>
<refsect1 id="standards"> <refsect1 id="standards">
<title>STANDARDS</title> <title>STANDARDS</title>
<para>The <function>malloc<parameter/></function>, <para>The <function>malloc()</function>,
<function>calloc<parameter/></function>, <function>calloc()</function>,
<function>realloc<parameter/></function>, and <function>realloc()</function>, and
<function>free<parameter/></function> functions conform to ISO/IEC <function>free()</function> functions conform to ISO/IEC
9899:1990 (&ldquo;ISO C90&rdquo;).</para> 9899:1990 (<quote>ISO C90</quote>).</para>
<para>The <function>posix_memalign<parameter/></function> function conforms <para>The <function>posix_memalign()</function> function conforms
to IEEE Std 1003.1-2001 (&ldquo;POSIX.1&rdquo;).</para> to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para>
</refsect1> </refsect1>
</refentry> </refentry>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="funcsynopsis.style">ansi</xsl:param> <xsl:param name="funcsynopsis.style">ansi</xsl:param>
<xsl:param name="function.parens" select="1"/> <xsl:param name="function.parens" select="0"/>
<xsl:template match="function">
<xsl:call-template name="inline.monoseq"/>
</xsl:template>
<xsl:template match="mallctl"> <xsl:template match="mallctl">
"<xsl:call-template name="inline.monoseq"/>" <quote><xsl:call-template name="inline.monoseq"/></quote>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment