xref: /aosp_15_r20/external/jemalloc_new/doc/jemalloc.xml.in (revision 1208bc7e437ced7eb82efac44ba17e3beba411da)
1*1208bc7eSAndroid Build Coastguard Worker<?xml version='1.0' encoding='UTF-8'?>
2*1208bc7eSAndroid Build Coastguard Worker<?xml-stylesheet type="text/xsl"
3*1208bc7eSAndroid Build Coastguard Worker        href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?>
4*1208bc7eSAndroid Build Coastguard Worker<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
5*1208bc7eSAndroid Build Coastguard Worker        "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
6*1208bc7eSAndroid Build Coastguard Worker]>
7*1208bc7eSAndroid Build Coastguard Worker
8*1208bc7eSAndroid Build Coastguard Worker<refentry>
9*1208bc7eSAndroid Build Coastguard Worker  <refentryinfo>
10*1208bc7eSAndroid Build Coastguard Worker    <title>User Manual</title>
11*1208bc7eSAndroid Build Coastguard Worker    <productname>jemalloc</productname>
12*1208bc7eSAndroid Build Coastguard Worker    <releaseinfo role="version">@jemalloc_version@</releaseinfo>
13*1208bc7eSAndroid Build Coastguard Worker    <authorgroup>
14*1208bc7eSAndroid Build Coastguard Worker      <author>
15*1208bc7eSAndroid Build Coastguard Worker        <firstname>Jason</firstname>
16*1208bc7eSAndroid Build Coastguard Worker        <surname>Evans</surname>
17*1208bc7eSAndroid Build Coastguard Worker        <personblurb>Author</personblurb>
18*1208bc7eSAndroid Build Coastguard Worker      </author>
19*1208bc7eSAndroid Build Coastguard Worker    </authorgroup>
20*1208bc7eSAndroid Build Coastguard Worker  </refentryinfo>
21*1208bc7eSAndroid Build Coastguard Worker  <refmeta>
22*1208bc7eSAndroid Build Coastguard Worker    <refentrytitle>JEMALLOC</refentrytitle>
23*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>3</manvolnum>
24*1208bc7eSAndroid Build Coastguard Worker  </refmeta>
25*1208bc7eSAndroid Build Coastguard Worker  <refnamediv>
26*1208bc7eSAndroid Build Coastguard Worker    <refdescriptor>jemalloc</refdescriptor>
27*1208bc7eSAndroid Build Coastguard Worker    <refname>jemalloc</refname>
28*1208bc7eSAndroid Build Coastguard Worker    <!-- Each refname causes a man page file to be created.  Only if this were
29*1208bc7eSAndroid Build Coastguard Worker         the system malloc(3) implementation would these files be appropriate.
30*1208bc7eSAndroid Build Coastguard Worker    <refname>malloc</refname>
31*1208bc7eSAndroid Build Coastguard Worker    <refname>calloc</refname>
32*1208bc7eSAndroid Build Coastguard Worker    <refname>posix_memalign</refname>
33*1208bc7eSAndroid Build Coastguard Worker    <refname>aligned_alloc</refname>
34*1208bc7eSAndroid Build Coastguard Worker    <refname>realloc</refname>
35*1208bc7eSAndroid Build Coastguard Worker    <refname>free</refname>
36*1208bc7eSAndroid Build Coastguard Worker    <refname>mallocx</refname>
37*1208bc7eSAndroid Build Coastguard Worker    <refname>rallocx</refname>
38*1208bc7eSAndroid Build Coastguard Worker    <refname>xallocx</refname>
39*1208bc7eSAndroid Build Coastguard Worker    <refname>sallocx</refname>
40*1208bc7eSAndroid Build Coastguard Worker    <refname>dallocx</refname>
41*1208bc7eSAndroid Build Coastguard Worker    <refname>sdallocx</refname>
42*1208bc7eSAndroid Build Coastguard Worker    <refname>nallocx</refname>
43*1208bc7eSAndroid Build Coastguard Worker    <refname>mallctl</refname>
44*1208bc7eSAndroid Build Coastguard Worker    <refname>mallctlnametomib</refname>
45*1208bc7eSAndroid Build Coastguard Worker    <refname>mallctlbymib</refname>
46*1208bc7eSAndroid Build Coastguard Worker    <refname>malloc_stats_print</refname>
47*1208bc7eSAndroid Build Coastguard Worker    <refname>malloc_usable_size</refname>
48*1208bc7eSAndroid Build Coastguard Worker    -->
49*1208bc7eSAndroid Build Coastguard Worker    <refpurpose>general purpose memory allocation functions</refpurpose>
50*1208bc7eSAndroid Build Coastguard Worker  </refnamediv>
51*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="library">
52*1208bc7eSAndroid Build Coastguard Worker    <title>LIBRARY</title>
53*1208bc7eSAndroid Build Coastguard Worker    <para>This manual describes jemalloc @jemalloc_version@.  More information
54*1208bc7eSAndroid Build Coastguard Worker    can be found at the <ulink
55*1208bc7eSAndroid Build Coastguard Worker    url="http://jemalloc.net/">jemalloc website</ulink>.</para>
56*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
57*1208bc7eSAndroid Build Coastguard Worker  <refsynopsisdiv>
58*1208bc7eSAndroid Build Coastguard Worker    <title>SYNOPSIS</title>
59*1208bc7eSAndroid Build Coastguard Worker    <funcsynopsis>
60*1208bc7eSAndroid Build Coastguard Worker      <funcsynopsisinfo>#include &lt;<filename class="headerfile">jemalloc/jemalloc.h</filename>&gt;</funcsynopsisinfo>
61*1208bc7eSAndroid Build Coastguard Worker      <refsect2>
62*1208bc7eSAndroid Build Coastguard Worker        <title>Standard API</title>
63*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
64*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void *<function>malloc</function></funcdef>
65*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
66*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
67*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
68*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void *<function>calloc</function></funcdef>
69*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>number</parameter></paramdef>
70*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
71*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
72*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
73*1208bc7eSAndroid Build Coastguard Worker          <funcdef>int <function>posix_memalign</function></funcdef>
74*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void **<parameter>ptr</parameter></paramdef>
75*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>alignment</parameter></paramdef>
76*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
77*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
78*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
79*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void *<function>aligned_alloc</function></funcdef>
80*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>alignment</parameter></paramdef>
81*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
82*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
83*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
84*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void *<function>realloc</function></funcdef>
85*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
86*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
87*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
88*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
89*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void <function>free</function></funcdef>
90*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
91*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
92*1208bc7eSAndroid Build Coastguard Worker      </refsect2>
93*1208bc7eSAndroid Build Coastguard Worker      <refsect2>
94*1208bc7eSAndroid Build Coastguard Worker        <title>Non-standard API</title>
95*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
96*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void *<function>mallocx</function></funcdef>
97*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
98*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
99*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
100*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
101*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void *<function>rallocx</function></funcdef>
102*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
103*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
104*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
105*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
106*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
107*1208bc7eSAndroid Build Coastguard Worker          <funcdef>size_t <function>xallocx</function></funcdef>
108*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
109*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
110*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>extra</parameter></paramdef>
111*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
112*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
113*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
114*1208bc7eSAndroid Build Coastguard Worker          <funcdef>size_t <function>sallocx</function></funcdef>
115*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
116*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
117*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
118*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
119*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void <function>dallocx</function></funcdef>
120*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
121*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
122*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
123*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
124*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void <function>sdallocx</function></funcdef>
125*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>ptr</parameter></paramdef>
126*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
127*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
128*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
129*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
130*1208bc7eSAndroid Build Coastguard Worker          <funcdef>size_t <function>nallocx</function></funcdef>
131*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
132*1208bc7eSAndroid Build Coastguard Worker          <paramdef>int <parameter>flags</parameter></paramdef>
133*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
134*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
135*1208bc7eSAndroid Build Coastguard Worker          <funcdef>int <function>mallctl</function></funcdef>
136*1208bc7eSAndroid Build Coastguard Worker          <paramdef>const char *<parameter>name</parameter></paramdef>
137*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>oldp</parameter></paramdef>
138*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t *<parameter>oldlenp</parameter></paramdef>
139*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>newp</parameter></paramdef>
140*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>newlen</parameter></paramdef>
141*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
142*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
143*1208bc7eSAndroid Build Coastguard Worker          <funcdef>int <function>mallctlnametomib</function></funcdef>
144*1208bc7eSAndroid Build Coastguard Worker          <paramdef>const char *<parameter>name</parameter></paramdef>
145*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t *<parameter>mibp</parameter></paramdef>
146*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t *<parameter>miblenp</parameter></paramdef>
147*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
148*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
149*1208bc7eSAndroid Build Coastguard Worker          <funcdef>int <function>mallctlbymib</function></funcdef>
150*1208bc7eSAndroid Build Coastguard Worker          <paramdef>const size_t *<parameter>mib</parameter></paramdef>
151*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>miblen</parameter></paramdef>
152*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>oldp</parameter></paramdef>
153*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t *<parameter>oldlenp</parameter></paramdef>
154*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>newp</parameter></paramdef>
155*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>newlen</parameter></paramdef>
156*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
157*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
158*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void <function>malloc_stats_print</function></funcdef>
159*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void <parameter>(*write_cb)</parameter>
160*1208bc7eSAndroid Build Coastguard Worker            <funcparams>void *, const char *</funcparams>
161*1208bc7eSAndroid Build Coastguard Worker          </paramdef>
162*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>cbopaque</parameter></paramdef>
163*1208bc7eSAndroid Build Coastguard Worker          <paramdef>const char *<parameter>opts</parameter></paramdef>
164*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
165*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
166*1208bc7eSAndroid Build Coastguard Worker          <funcdef>size_t <function>malloc_usable_size</function></funcdef>
167*1208bc7eSAndroid Build Coastguard Worker          <paramdef>const void *<parameter>ptr</parameter></paramdef>
168*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
169*1208bc7eSAndroid Build Coastguard Worker        <funcprototype>
170*1208bc7eSAndroid Build Coastguard Worker          <funcdef>void <function>(*malloc_message)</function></funcdef>
171*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>cbopaque</parameter></paramdef>
172*1208bc7eSAndroid Build Coastguard Worker          <paramdef>const char *<parameter>s</parameter></paramdef>
173*1208bc7eSAndroid Build Coastguard Worker        </funcprototype>
174*1208bc7eSAndroid Build Coastguard Worker        <para><type>const char *</type><varname>malloc_conf</varname>;</para>
175*1208bc7eSAndroid Build Coastguard Worker      </refsect2>
176*1208bc7eSAndroid Build Coastguard Worker    </funcsynopsis>
177*1208bc7eSAndroid Build Coastguard Worker  </refsynopsisdiv>
178*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="description">
179*1208bc7eSAndroid Build Coastguard Worker    <title>DESCRIPTION</title>
180*1208bc7eSAndroid Build Coastguard Worker    <refsect2>
181*1208bc7eSAndroid Build Coastguard Worker      <title>Standard API</title>
182*1208bc7eSAndroid Build Coastguard Worker
183*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>malloc()</function> function allocates
184*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> bytes of uninitialized memory.  The allocated
185*1208bc7eSAndroid Build Coastguard Worker      space is suitably aligned (after possible pointer coercion) for storage
186*1208bc7eSAndroid Build Coastguard Worker      of any type of object.</para>
187*1208bc7eSAndroid Build Coastguard Worker
188*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>calloc()</function> function allocates
189*1208bc7eSAndroid Build Coastguard Worker      space for <parameter>number</parameter> objects, each
190*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> bytes in length.  The result is identical to
191*1208bc7eSAndroid Build Coastguard Worker      calling <function>malloc()</function> with an argument of
192*1208bc7eSAndroid Build Coastguard Worker      <parameter>number</parameter> * <parameter>size</parameter>, with the
193*1208bc7eSAndroid Build Coastguard Worker      exception that the allocated memory is explicitly initialized to zero
194*1208bc7eSAndroid Build Coastguard Worker      bytes.</para>
195*1208bc7eSAndroid Build Coastguard Worker
196*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>posix_memalign()</function> function
197*1208bc7eSAndroid Build Coastguard Worker      allocates <parameter>size</parameter> bytes of memory such that the
198*1208bc7eSAndroid Build Coastguard Worker      allocation's base address is a multiple of
199*1208bc7eSAndroid Build Coastguard Worker      <parameter>alignment</parameter>, and returns the allocation in the value
200*1208bc7eSAndroid Build Coastguard Worker      pointed to by <parameter>ptr</parameter>.  The requested
201*1208bc7eSAndroid Build Coastguard Worker      <parameter>alignment</parameter> must be a power of 2 at least as large as
202*1208bc7eSAndroid Build Coastguard Worker      <code language="C">sizeof(<type>void *</type>)</code>.</para>
203*1208bc7eSAndroid Build Coastguard Worker
204*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>aligned_alloc()</function> function
205*1208bc7eSAndroid Build Coastguard Worker      allocates <parameter>size</parameter> bytes of memory such that the
206*1208bc7eSAndroid Build Coastguard Worker      allocation's base address is a multiple of
207*1208bc7eSAndroid Build Coastguard Worker      <parameter>alignment</parameter>.  The requested
208*1208bc7eSAndroid Build Coastguard Worker      <parameter>alignment</parameter> must be a power of 2.  Behavior is
209*1208bc7eSAndroid Build Coastguard Worker      undefined if <parameter>size</parameter> is not an integral multiple of
210*1208bc7eSAndroid Build Coastguard Worker      <parameter>alignment</parameter>.</para>
211*1208bc7eSAndroid Build Coastguard Worker
212*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>realloc()</function> function changes the
213*1208bc7eSAndroid Build Coastguard Worker      size of the previously allocated memory referenced by
214*1208bc7eSAndroid Build Coastguard Worker      <parameter>ptr</parameter> to <parameter>size</parameter> bytes.  The
215*1208bc7eSAndroid Build Coastguard Worker      contents of the memory are unchanged up to the lesser of the new and old
216*1208bc7eSAndroid Build Coastguard Worker      sizes.  If the new size is larger, the contents of the newly allocated
217*1208bc7eSAndroid Build Coastguard Worker      portion of the memory are undefined.  Upon success, the memory referenced
218*1208bc7eSAndroid Build Coastguard Worker      by <parameter>ptr</parameter> is freed and a pointer to the newly
219*1208bc7eSAndroid Build Coastguard Worker      allocated memory is returned.  Note that
220*1208bc7eSAndroid Build Coastguard Worker      <function>realloc()</function> may move the memory allocation,
221*1208bc7eSAndroid Build Coastguard Worker      resulting in a different return value than <parameter>ptr</parameter>.
222*1208bc7eSAndroid Build Coastguard Worker      If <parameter>ptr</parameter> is <constant>NULL</constant>, the
223*1208bc7eSAndroid Build Coastguard Worker      <function>realloc()</function> function behaves identically to
224*1208bc7eSAndroid Build Coastguard Worker      <function>malloc()</function> for the specified size.</para>
225*1208bc7eSAndroid Build Coastguard Worker
226*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>free()</function> function causes the
227*1208bc7eSAndroid Build Coastguard Worker      allocated memory referenced by <parameter>ptr</parameter> to be made
228*1208bc7eSAndroid Build Coastguard Worker      available for future allocations.  If <parameter>ptr</parameter> is
229*1208bc7eSAndroid Build Coastguard Worker      <constant>NULL</constant>, no action occurs.</para>
230*1208bc7eSAndroid Build Coastguard Worker    </refsect2>
231*1208bc7eSAndroid Build Coastguard Worker    <refsect2>
232*1208bc7eSAndroid Build Coastguard Worker      <title>Non-standard API</title>
233*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>mallocx()</function>,
234*1208bc7eSAndroid Build Coastguard Worker      <function>rallocx()</function>,
235*1208bc7eSAndroid Build Coastguard Worker      <function>xallocx()</function>,
236*1208bc7eSAndroid Build Coastguard Worker      <function>sallocx()</function>,
237*1208bc7eSAndroid Build Coastguard Worker      <function>dallocx()</function>,
238*1208bc7eSAndroid Build Coastguard Worker      <function>sdallocx()</function>, and
239*1208bc7eSAndroid Build Coastguard Worker      <function>nallocx()</function> functions all have a
240*1208bc7eSAndroid Build Coastguard Worker      <parameter>flags</parameter> argument that can be used to specify
241*1208bc7eSAndroid Build Coastguard Worker      options.  The functions only check the options that are contextually
242*1208bc7eSAndroid Build Coastguard Worker      relevant.  Use bitwise or (<code language="C">|</code>) operations to
243*1208bc7eSAndroid Build Coastguard Worker      specify one or more of the following:
244*1208bc7eSAndroid Build Coastguard Worker        <variablelist>
245*1208bc7eSAndroid Build Coastguard Worker          <varlistentry id="MALLOCX_LG_ALIGN">
246*1208bc7eSAndroid Build Coastguard Worker            <term><constant>MALLOCX_LG_ALIGN(<parameter>la</parameter>)
247*1208bc7eSAndroid Build Coastguard Worker            </constant></term>
248*1208bc7eSAndroid Build Coastguard Worker
249*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Align the memory allocation to start at an address
250*1208bc7eSAndroid Build Coastguard Worker            that is a multiple of <code language="C">(1 &lt;&lt;
251*1208bc7eSAndroid Build Coastguard Worker            <parameter>la</parameter>)</code>.  This macro does not validate
252*1208bc7eSAndroid Build Coastguard Worker            that <parameter>la</parameter> is within the valid
253*1208bc7eSAndroid Build Coastguard Worker            range.</para></listitem>
254*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
255*1208bc7eSAndroid Build Coastguard Worker          <varlistentry id="MALLOCX_ALIGN">
256*1208bc7eSAndroid Build Coastguard Worker            <term><constant>MALLOCX_ALIGN(<parameter>a</parameter>)
257*1208bc7eSAndroid Build Coastguard Worker            </constant></term>
258*1208bc7eSAndroid Build Coastguard Worker
259*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Align the memory allocation to start at an address
260*1208bc7eSAndroid Build Coastguard Worker            that is a multiple of <parameter>a</parameter>, where
261*1208bc7eSAndroid Build Coastguard Worker            <parameter>a</parameter> is a power of two.  This macro does not
262*1208bc7eSAndroid Build Coastguard Worker            validate that <parameter>a</parameter> is a power of 2.
263*1208bc7eSAndroid Build Coastguard Worker            </para></listitem>
264*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
265*1208bc7eSAndroid Build Coastguard Worker          <varlistentry id="MALLOCX_ZERO">
266*1208bc7eSAndroid Build Coastguard Worker            <term><constant>MALLOCX_ZERO</constant></term>
267*1208bc7eSAndroid Build Coastguard Worker
268*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Initialize newly allocated memory to contain zero
269*1208bc7eSAndroid Build Coastguard Worker            bytes.  In the growing reallocation case, the real size prior to
270*1208bc7eSAndroid Build Coastguard Worker            reallocation defines the boundary between untouched bytes and those
271*1208bc7eSAndroid Build Coastguard Worker            that are initialized to contain zero bytes.  If this macro is
272*1208bc7eSAndroid Build Coastguard Worker            absent, newly allocated memory is uninitialized.</para></listitem>
273*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
274*1208bc7eSAndroid Build Coastguard Worker          <varlistentry id="MALLOCX_TCACHE">
275*1208bc7eSAndroid Build Coastguard Worker            <term><constant>MALLOCX_TCACHE(<parameter>tc</parameter>)
276*1208bc7eSAndroid Build Coastguard Worker            </constant></term>
277*1208bc7eSAndroid Build Coastguard Worker
278*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Use the thread-specific cache (tcache) specified by
279*1208bc7eSAndroid Build Coastguard Worker            the identifier <parameter>tc</parameter>, which must have been
280*1208bc7eSAndroid Build Coastguard Worker            acquired via the <link
281*1208bc7eSAndroid Build Coastguard Worker            linkend="tcache.create"><mallctl>tcache.create</mallctl></link>
282*1208bc7eSAndroid Build Coastguard Worker            mallctl.  This macro does not validate that
283*1208bc7eSAndroid Build Coastguard Worker            <parameter>tc</parameter> specifies a valid
284*1208bc7eSAndroid Build Coastguard Worker            identifier.</para></listitem>
285*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
286*1208bc7eSAndroid Build Coastguard Worker          <varlistentry id="MALLOC_TCACHE_NONE">
287*1208bc7eSAndroid Build Coastguard Worker            <term><constant>MALLOCX_TCACHE_NONE</constant></term>
288*1208bc7eSAndroid Build Coastguard Worker
289*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Do not use a thread-specific cache (tcache).  Unless
290*1208bc7eSAndroid Build Coastguard Worker            <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant> or
291*1208bc7eSAndroid Build Coastguard Worker            <constant>MALLOCX_TCACHE_NONE</constant> is specified, an
292*1208bc7eSAndroid Build Coastguard Worker            automatically managed tcache will be used under many circumstances.
293*1208bc7eSAndroid Build Coastguard Worker            This macro cannot be used in the same <parameter>flags</parameter>
294*1208bc7eSAndroid Build Coastguard Worker            argument as
295*1208bc7eSAndroid Build Coastguard Worker            <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant>.</para></listitem>
296*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
297*1208bc7eSAndroid Build Coastguard Worker          <varlistentry id="MALLOCX_ARENA">
298*1208bc7eSAndroid Build Coastguard Worker            <term><constant>MALLOCX_ARENA(<parameter>a</parameter>)
299*1208bc7eSAndroid Build Coastguard Worker            </constant></term>
300*1208bc7eSAndroid Build Coastguard Worker
301*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Use the arena specified by the index
302*1208bc7eSAndroid Build Coastguard Worker            <parameter>a</parameter>.  This macro has no effect for regions that
303*1208bc7eSAndroid Build Coastguard Worker            were allocated via an arena other than the one specified.  This
304*1208bc7eSAndroid Build Coastguard Worker            macro does not validate that <parameter>a</parameter> specifies an
305*1208bc7eSAndroid Build Coastguard Worker            arena index in the valid range.</para></listitem>
306*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
307*1208bc7eSAndroid Build Coastguard Worker        </variablelist>
308*1208bc7eSAndroid Build Coastguard Worker      </para>
309*1208bc7eSAndroid Build Coastguard Worker
310*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>mallocx()</function> function allocates at
311*1208bc7eSAndroid Build Coastguard Worker      least <parameter>size</parameter> bytes of memory, and returns a pointer
312*1208bc7eSAndroid Build Coastguard Worker      to the base address of the allocation.  Behavior is undefined if
313*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> is <constant>0</constant>.</para>
314*1208bc7eSAndroid Build Coastguard Worker
315*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>rallocx()</function> function resizes the
316*1208bc7eSAndroid Build Coastguard Worker      allocation at <parameter>ptr</parameter> to be at least
317*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> bytes, and returns a pointer to the base
318*1208bc7eSAndroid Build Coastguard Worker      address of the resulting allocation, which may or may not have moved from
319*1208bc7eSAndroid Build Coastguard Worker      its original location.  Behavior is undefined if
320*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> is <constant>0</constant>.</para>
321*1208bc7eSAndroid Build Coastguard Worker
322*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>xallocx()</function> function resizes the
323*1208bc7eSAndroid Build Coastguard Worker      allocation at <parameter>ptr</parameter> in place to be at least
324*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> bytes, and returns the real size of the
325*1208bc7eSAndroid Build Coastguard Worker      allocation.  If <parameter>extra</parameter> is non-zero, an attempt is
326*1208bc7eSAndroid Build Coastguard Worker      made to resize the allocation to be at least <code
327*1208bc7eSAndroid Build Coastguard Worker      language="C">(<parameter>size</parameter> +
328*1208bc7eSAndroid Build Coastguard Worker      <parameter>extra</parameter>)</code> bytes, though inability to allocate
329*1208bc7eSAndroid Build Coastguard Worker      the extra byte(s) will not by itself result in failure to resize.
330*1208bc7eSAndroid Build Coastguard Worker      Behavior is undefined if <parameter>size</parameter> is
331*1208bc7eSAndroid Build Coastguard Worker      <constant>0</constant>, or if <code
332*1208bc7eSAndroid Build Coastguard Worker      language="C">(<parameter>size</parameter> + <parameter>extra</parameter>
333*1208bc7eSAndroid Build Coastguard Worker      &gt; <constant>SIZE_T_MAX</constant>)</code>.</para>
334*1208bc7eSAndroid Build Coastguard Worker
335*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>sallocx()</function> function returns the
336*1208bc7eSAndroid Build Coastguard Worker      real size of the allocation at <parameter>ptr</parameter>.</para>
337*1208bc7eSAndroid Build Coastguard Worker
338*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>dallocx()</function> function causes the
339*1208bc7eSAndroid Build Coastguard Worker      memory referenced by <parameter>ptr</parameter> to be made available for
340*1208bc7eSAndroid Build Coastguard Worker      future allocations.</para>
341*1208bc7eSAndroid Build Coastguard Worker
342*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>sdallocx()</function> function is an
343*1208bc7eSAndroid Build Coastguard Worker      extension of <function>dallocx()</function> with a
344*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> parameter to allow the caller to pass in the
345*1208bc7eSAndroid Build Coastguard Worker      allocation size as an optimization.  The minimum valid input size is the
346*1208bc7eSAndroid Build Coastguard Worker      original requested size of the allocation, and the maximum valid input
347*1208bc7eSAndroid Build Coastguard Worker      size is the corresponding value returned by
348*1208bc7eSAndroid Build Coastguard Worker      <function>nallocx()</function> or
349*1208bc7eSAndroid Build Coastguard Worker      <function>sallocx()</function>.</para>
350*1208bc7eSAndroid Build Coastguard Worker
351*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>nallocx()</function> function allocates no
352*1208bc7eSAndroid Build Coastguard Worker      memory, but it performs the same size computation as the
353*1208bc7eSAndroid Build Coastguard Worker      <function>mallocx()</function> function, and returns the real
354*1208bc7eSAndroid Build Coastguard Worker      size of the allocation that would result from the equivalent
355*1208bc7eSAndroid Build Coastguard Worker      <function>mallocx()</function> function call, or
356*1208bc7eSAndroid Build Coastguard Worker      <constant>0</constant> if the inputs exceed the maximum supported size
357*1208bc7eSAndroid Build Coastguard Worker      class and/or alignment.  Behavior is undefined if
358*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> is <constant>0</constant>.</para>
359*1208bc7eSAndroid Build Coastguard Worker
360*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>mallctl()</function> function provides a
361*1208bc7eSAndroid Build Coastguard Worker      general interface for introspecting the memory allocator, as well as
362*1208bc7eSAndroid Build Coastguard Worker      setting modifiable parameters and triggering actions.  The
363*1208bc7eSAndroid Build Coastguard Worker      period-separated <parameter>name</parameter> argument specifies a
364*1208bc7eSAndroid Build Coastguard Worker      location in a tree-structured namespace; see the <xref
365*1208bc7eSAndroid Build Coastguard Worker      linkend="mallctl_namespace" xrefstyle="template:%t"/> section for
366*1208bc7eSAndroid Build Coastguard Worker      documentation on the tree contents.  To read a value, pass a pointer via
367*1208bc7eSAndroid Build Coastguard Worker      <parameter>oldp</parameter> to adequate space to contain the value, and a
368*1208bc7eSAndroid Build Coastguard Worker      pointer to its length via <parameter>oldlenp</parameter>; otherwise pass
369*1208bc7eSAndroid Build Coastguard Worker      <constant>NULL</constant> and <constant>NULL</constant>.  Similarly, to
370*1208bc7eSAndroid Build Coastguard Worker      write a value, pass a pointer to the value via
371*1208bc7eSAndroid Build Coastguard Worker      <parameter>newp</parameter>, and its length via
372*1208bc7eSAndroid Build Coastguard Worker      <parameter>newlen</parameter>; otherwise pass <constant>NULL</constant>
373*1208bc7eSAndroid Build Coastguard Worker      and <constant>0</constant>.</para>
374*1208bc7eSAndroid Build Coastguard Worker
375*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>mallctlnametomib()</function> function
376*1208bc7eSAndroid Build Coastguard Worker      provides a way to avoid repeated name lookups for applications that
377*1208bc7eSAndroid Build Coastguard Worker      repeatedly query the same portion of the namespace, by translating a name
378*1208bc7eSAndroid Build Coastguard Worker      to a <quote>Management Information Base</quote> (MIB) that can be passed
379*1208bc7eSAndroid Build Coastguard Worker      repeatedly to <function>mallctlbymib()</function>.  Upon
380*1208bc7eSAndroid Build Coastguard Worker      successful return from <function>mallctlnametomib()</function>,
381*1208bc7eSAndroid Build Coastguard Worker      <parameter>mibp</parameter> contains an array of
382*1208bc7eSAndroid Build Coastguard Worker      <parameter>*miblenp</parameter> integers, where
383*1208bc7eSAndroid Build Coastguard Worker      <parameter>*miblenp</parameter> is the lesser of the number of components
384*1208bc7eSAndroid Build Coastguard Worker      in <parameter>name</parameter> and the input value of
385*1208bc7eSAndroid Build Coastguard Worker      <parameter>*miblenp</parameter>.  Thus it is possible to pass a
386*1208bc7eSAndroid Build Coastguard Worker      <parameter>*miblenp</parameter> that is smaller than the number of
387*1208bc7eSAndroid Build Coastguard Worker      period-separated name components, which results in a partial MIB that can
388*1208bc7eSAndroid Build Coastguard Worker      be used as the basis for constructing a complete MIB.  For name
389*1208bc7eSAndroid Build Coastguard Worker      components that are integers (e.g. the 2 in
390*1208bc7eSAndroid Build Coastguard Worker      <link
391*1208bc7eSAndroid Build Coastguard Worker      linkend="arenas.bin.i.size"><mallctl>arenas.bin.2.size</mallctl></link>),
392*1208bc7eSAndroid Build Coastguard Worker      the corresponding MIB component will always be that integer.  Therefore,
393*1208bc7eSAndroid Build Coastguard Worker      it is legitimate to construct code like the following: <programlisting
394*1208bc7eSAndroid Build Coastguard Worker      language="C"><![CDATA[
395*1208bc7eSAndroid Build Coastguard Workerunsigned nbins, i;
396*1208bc7eSAndroid Build Coastguard Workersize_t mib[4];
397*1208bc7eSAndroid Build Coastguard Workersize_t len, miblen;
398*1208bc7eSAndroid Build Coastguard Worker
399*1208bc7eSAndroid Build Coastguard Workerlen = sizeof(nbins);
400*1208bc7eSAndroid Build Coastguard Workermallctl("arenas.nbins", &nbins, &len, NULL, 0);
401*1208bc7eSAndroid Build Coastguard Worker
402*1208bc7eSAndroid Build Coastguard Workermiblen = 4;
403*1208bc7eSAndroid Build Coastguard Workermallctlnametomib("arenas.bin.0.size", mib, &miblen);
404*1208bc7eSAndroid Build Coastguard Workerfor (i = 0; i < nbins; i++) {
405*1208bc7eSAndroid Build Coastguard Worker	size_t bin_size;
406*1208bc7eSAndroid Build Coastguard Worker
407*1208bc7eSAndroid Build Coastguard Worker	mib[2] = i;
408*1208bc7eSAndroid Build Coastguard Worker	len = sizeof(bin_size);
409*1208bc7eSAndroid Build Coastguard Worker	mallctlbymib(mib, miblen, (void *)&bin_size, &len, NULL, 0);
410*1208bc7eSAndroid Build Coastguard Worker	/* Do something with bin_size... */
411*1208bc7eSAndroid Build Coastguard Worker}]]></programlisting></para>
412*1208bc7eSAndroid Build Coastguard Worker
413*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="malloc_stats_print_opts">
414*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
415*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>malloc_stats_print()</function> function writes
416*1208bc7eSAndroid Build Coastguard Worker      summary statistics via the <parameter>write_cb</parameter> callback
417*1208bc7eSAndroid Build Coastguard Worker      function pointer and <parameter>cbopaque</parameter> data passed to
418*1208bc7eSAndroid Build Coastguard Worker      <parameter>write_cb</parameter>, or <function>malloc_message()</function>
419*1208bc7eSAndroid Build Coastguard Worker      if <parameter>write_cb</parameter> is <constant>NULL</constant>.  The
420*1208bc7eSAndroid Build Coastguard Worker      statistics are presented in human-readable form unless <quote>J</quote> is
421*1208bc7eSAndroid Build Coastguard Worker      specified as a character within the <parameter>opts</parameter> string, in
422*1208bc7eSAndroid Build Coastguard Worker      which case the statistics are presented in <ulink
423*1208bc7eSAndroid Build Coastguard Worker      url="http://www.json.org/">JSON format</ulink>.  This function can be
424*1208bc7eSAndroid Build Coastguard Worker      called repeatedly.  General information that never changes during
425*1208bc7eSAndroid Build Coastguard Worker      execution can be omitted by specifying <quote>g</quote> as a character
426*1208bc7eSAndroid Build Coastguard Worker      within the <parameter>opts</parameter> string.  Note that
427*1208bc7eSAndroid Build Coastguard Worker      <function>malloc_message()</function> uses the
428*1208bc7eSAndroid Build Coastguard Worker      <function>mallctl*()</function> functions internally, so inconsistent
429*1208bc7eSAndroid Build Coastguard Worker      statistics can be reported if multiple threads use these functions
430*1208bc7eSAndroid Build Coastguard Worker      simultaneously.  If <option>--enable-stats</option> is specified during
431*1208bc7eSAndroid Build Coastguard Worker      configuration, <quote>m</quote>, <quote>d</quote>, and <quote>a</quote>
432*1208bc7eSAndroid Build Coastguard Worker      can be specified to omit merged arena, destroyed merged arena, and per
433*1208bc7eSAndroid Build Coastguard Worker      arena statistics, respectively; <quote>b</quote> and <quote>l</quote> can
434*1208bc7eSAndroid Build Coastguard Worker      be specified to omit per size class statistics for bins and large objects,
435*1208bc7eSAndroid Build Coastguard Worker      respectively; <quote>x</quote> can be specified to omit all mutex
436*1208bc7eSAndroid Build Coastguard Worker      statistics.  Unrecognized characters are silently ignored.  Note that
437*1208bc7eSAndroid Build Coastguard Worker      thread caching may prevent some statistics from being completely up to
438*1208bc7eSAndroid Build Coastguard Worker      date, since extra locking would be required to merge counters that track
439*1208bc7eSAndroid Build Coastguard Worker      thread cache operations.</para>
440*1208bc7eSAndroid Build Coastguard Worker
441*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>malloc_usable_size()</function> function
442*1208bc7eSAndroid Build Coastguard Worker      returns the usable size of the allocation pointed to by
443*1208bc7eSAndroid Build Coastguard Worker      <parameter>ptr</parameter>.  The return value may be larger than the size
444*1208bc7eSAndroid Build Coastguard Worker      that was requested during allocation.  The
445*1208bc7eSAndroid Build Coastguard Worker      <function>malloc_usable_size()</function> function is not a
446*1208bc7eSAndroid Build Coastguard Worker      mechanism for in-place <function>realloc()</function>; rather
447*1208bc7eSAndroid Build Coastguard Worker      it is provided solely as a tool for introspection purposes.  Any
448*1208bc7eSAndroid Build Coastguard Worker      discrepancy between the requested allocation size and the size reported
449*1208bc7eSAndroid Build Coastguard Worker      by <function>malloc_usable_size()</function> should not be
450*1208bc7eSAndroid Build Coastguard Worker      depended on, since such behavior is entirely implementation-dependent.
451*1208bc7eSAndroid Build Coastguard Worker      </para>
452*1208bc7eSAndroid Build Coastguard Worker    </refsect2>
453*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
454*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="tuning">
455*1208bc7eSAndroid Build Coastguard Worker    <title>TUNING</title>
456*1208bc7eSAndroid Build Coastguard Worker    <para>Once, when the first call is made to one of the memory allocation
457*1208bc7eSAndroid Build Coastguard Worker    routines, the allocator initializes its internals based in part on various
458*1208bc7eSAndroid Build Coastguard Worker    options that can be specified at compile- or run-time.</para>
459*1208bc7eSAndroid Build Coastguard Worker
460*1208bc7eSAndroid Build Coastguard Worker    <para>The string specified via <option>--with-malloc-conf</option>, the
461*1208bc7eSAndroid Build Coastguard Worker    string pointed to by the global variable <varname>malloc_conf</varname>, the
462*1208bc7eSAndroid Build Coastguard Worker    <quote>name</quote> of the file referenced by the symbolic link named
463*1208bc7eSAndroid Build Coastguard Worker    <filename class="symlink">/etc/malloc.conf</filename>, and the value of the
464*1208bc7eSAndroid Build Coastguard Worker    environment variable <envar>MALLOC_CONF</envar>, will be interpreted, in
465*1208bc7eSAndroid Build Coastguard Worker    that order, from left to right as options.  Note that
466*1208bc7eSAndroid Build Coastguard Worker    <varname>malloc_conf</varname> may be read before
467*1208bc7eSAndroid Build Coastguard Worker    <function>main()</function> is entered, so the declaration of
468*1208bc7eSAndroid Build Coastguard Worker    <varname>malloc_conf</varname> should specify an initializer that contains
469*1208bc7eSAndroid Build Coastguard Worker    the final value to be read by jemalloc.  <option>--with-malloc-conf</option>
470*1208bc7eSAndroid Build Coastguard Worker    and <varname>malloc_conf</varname> are compile-time mechanisms, whereas
471*1208bc7eSAndroid Build Coastguard Worker    <filename class="symlink">/etc/malloc.conf</filename> and
472*1208bc7eSAndroid Build Coastguard Worker    <envar>MALLOC_CONF</envar> can be safely set any time prior to program
473*1208bc7eSAndroid Build Coastguard Worker    invocation.</para>
474*1208bc7eSAndroid Build Coastguard Worker
475*1208bc7eSAndroid Build Coastguard Worker    <para>An options string is a comma-separated list of option:value pairs.
476*1208bc7eSAndroid Build Coastguard Worker    There is one key corresponding to each <link
477*1208bc7eSAndroid Build Coastguard Worker    linkend="opt.abort"><mallctl>opt.*</mallctl></link> mallctl (see the <xref
478*1208bc7eSAndroid Build Coastguard Worker    linkend="mallctl_namespace" xrefstyle="template:%t"/> section for options
479*1208bc7eSAndroid Build Coastguard Worker    documentation).  For example, <literal>abort:true,narenas:1</literal> sets
480*1208bc7eSAndroid Build Coastguard Worker    the <link linkend="opt.abort"><mallctl>opt.abort</mallctl></link> and <link
481*1208bc7eSAndroid Build Coastguard Worker    linkend="opt.narenas"><mallctl>opt.narenas</mallctl></link> options.  Some
482*1208bc7eSAndroid Build Coastguard Worker    options have boolean values (true/false), others have integer values (base
483*1208bc7eSAndroid Build Coastguard Worker    8, 10, or 16, depending on prefix), and yet others have raw string
484*1208bc7eSAndroid Build Coastguard Worker    values.</para>
485*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
486*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="implementation_notes">
487*1208bc7eSAndroid Build Coastguard Worker    <title>IMPLEMENTATION NOTES</title>
488*1208bc7eSAndroid Build Coastguard Worker    <para>Traditionally, allocators have used
489*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>sbrk</refentrytitle>
490*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry> to obtain memory, which is
491*1208bc7eSAndroid Build Coastguard Worker    suboptimal for several reasons, including race conditions, increased
492*1208bc7eSAndroid Build Coastguard Worker    fragmentation, and artificial limitations on maximum usable memory.  If
493*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>sbrk</refentrytitle>
494*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry> is supported by the operating
495*1208bc7eSAndroid Build Coastguard Worker    system, this allocator uses both
496*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>mmap</refentrytitle>
497*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry> and
498*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>sbrk</refentrytitle>
499*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry>, in that order of preference;
500*1208bc7eSAndroid Build Coastguard Worker    otherwise only <citerefentry><refentrytitle>mmap</refentrytitle>
501*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry> is used.</para>
502*1208bc7eSAndroid Build Coastguard Worker
503*1208bc7eSAndroid Build Coastguard Worker    <para>This allocator uses multiple arenas in order to reduce lock
504*1208bc7eSAndroid Build Coastguard Worker    contention for threaded programs on multi-processor systems.  This works
505*1208bc7eSAndroid Build Coastguard Worker    well with regard to threading scalability, but incurs some costs.  There is
506*1208bc7eSAndroid Build Coastguard Worker    a small fixed per-arena overhead, and additionally, arenas manage memory
507*1208bc7eSAndroid Build Coastguard Worker    completely independently of each other, which means a small fixed increase
508*1208bc7eSAndroid Build Coastguard Worker    in overall memory fragmentation.  These overheads are not generally an
509*1208bc7eSAndroid Build Coastguard Worker    issue, given the number of arenas normally used.  Note that using
510*1208bc7eSAndroid Build Coastguard Worker    substantially more arenas than the default is not likely to improve
511*1208bc7eSAndroid Build Coastguard Worker    performance, mainly due to reduced cache performance.  However, it may make
512*1208bc7eSAndroid Build Coastguard Worker    sense to reduce the number of arenas if an application does not make much
513*1208bc7eSAndroid Build Coastguard Worker    use of the allocation functions.</para>
514*1208bc7eSAndroid Build Coastguard Worker
515*1208bc7eSAndroid Build Coastguard Worker    <para>In addition to multiple arenas, this allocator supports
516*1208bc7eSAndroid Build Coastguard Worker    thread-specific caching, in order to make it possible to completely avoid
517*1208bc7eSAndroid Build Coastguard Worker    synchronization for most allocation requests.  Such caching allows very fast
518*1208bc7eSAndroid Build Coastguard Worker    allocation in the common case, but it increases memory usage and
519*1208bc7eSAndroid Build Coastguard Worker    fragmentation, since a bounded number of objects can remain allocated in
520*1208bc7eSAndroid Build Coastguard Worker    each thread cache.</para>
521*1208bc7eSAndroid Build Coastguard Worker
522*1208bc7eSAndroid Build Coastguard Worker    <para>Memory is conceptually broken into extents.  Extents are always
523*1208bc7eSAndroid Build Coastguard Worker    aligned to multiples of the page size.  This alignment makes it possible to
524*1208bc7eSAndroid Build Coastguard Worker    find metadata for user objects quickly.  User objects are broken into two
525*1208bc7eSAndroid Build Coastguard Worker    categories according to size: small and large.  Contiguous small objects
526*1208bc7eSAndroid Build Coastguard Worker    comprise a slab, which resides within a single extent, whereas large objects
527*1208bc7eSAndroid Build Coastguard Worker    each have their own extents backing them.</para>
528*1208bc7eSAndroid Build Coastguard Worker
529*1208bc7eSAndroid Build Coastguard Worker    <para>Small objects are managed in groups by slabs.  Each slab maintains
530*1208bc7eSAndroid Build Coastguard Worker    a bitmap to track which regions are in use.  Allocation requests that are no
531*1208bc7eSAndroid Build Coastguard Worker    more than half the quantum (8 or 16, depending on architecture) are rounded
532*1208bc7eSAndroid Build Coastguard Worker    up to the nearest power of two that is at least <code
533*1208bc7eSAndroid Build Coastguard Worker    language="C">sizeof(<type>double</type>)</code>.  All other object size
534*1208bc7eSAndroid Build Coastguard Worker    classes are multiples of the quantum, spaced such that there are four size
535*1208bc7eSAndroid Build Coastguard Worker    classes for each doubling in size, which limits internal fragmentation to
536*1208bc7eSAndroid Build Coastguard Worker    approximately 20% for all but the smallest size classes.  Small size classes
537*1208bc7eSAndroid Build Coastguard Worker    are smaller than four times the page size, and large size classes extend
538*1208bc7eSAndroid Build Coastguard Worker    from four times the page size up to the largest size class that does not
539*1208bc7eSAndroid Build Coastguard Worker    exceed <constant>PTRDIFF_MAX</constant>.</para>
540*1208bc7eSAndroid Build Coastguard Worker
541*1208bc7eSAndroid Build Coastguard Worker    <para>Allocations are packed tightly together, which can be an issue for
542*1208bc7eSAndroid Build Coastguard Worker    multi-threaded applications.  If you need to assure that allocations do not
543*1208bc7eSAndroid Build Coastguard Worker    suffer from cacheline sharing, round your allocation requests up to the
544*1208bc7eSAndroid Build Coastguard Worker    nearest multiple of the cacheline size, or specify cacheline alignment when
545*1208bc7eSAndroid Build Coastguard Worker    allocating.</para>
546*1208bc7eSAndroid Build Coastguard Worker
547*1208bc7eSAndroid Build Coastguard Worker    <para>The <function>realloc()</function>,
548*1208bc7eSAndroid Build Coastguard Worker    <function>rallocx()</function>, and
549*1208bc7eSAndroid Build Coastguard Worker    <function>xallocx()</function> functions may resize allocations
550*1208bc7eSAndroid Build Coastguard Worker    without moving them under limited circumstances.  Unlike the
551*1208bc7eSAndroid Build Coastguard Worker    <function>*allocx()</function> API, the standard API does not
552*1208bc7eSAndroid Build Coastguard Worker    officially round up the usable size of an allocation to the nearest size
553*1208bc7eSAndroid Build Coastguard Worker    class, so technically it is necessary to call
554*1208bc7eSAndroid Build Coastguard Worker    <function>realloc()</function> to grow e.g. a 9-byte allocation to
555*1208bc7eSAndroid Build Coastguard Worker    16 bytes, or shrink a 16-byte allocation to 9 bytes.  Growth and shrinkage
556*1208bc7eSAndroid Build Coastguard Worker    trivially succeeds in place as long as the pre-size and post-size both round
557*1208bc7eSAndroid Build Coastguard Worker    up to the same size class.  No other API guarantees are made regarding
558*1208bc7eSAndroid Build Coastguard Worker    in-place resizing, but the current implementation also tries to resize large
559*1208bc7eSAndroid Build Coastguard Worker    allocations in place, as long as the pre-size and post-size are both large.
560*1208bc7eSAndroid Build Coastguard Worker    For shrinkage to succeed, the extent allocator must support splitting (see
561*1208bc7eSAndroid Build Coastguard Worker    <link
562*1208bc7eSAndroid Build Coastguard Worker    linkend="arena.i.extent_hooks"><mallctl>arena.&lt;i&gt;.extent_hooks</mallctl></link>).
563*1208bc7eSAndroid Build Coastguard Worker    Growth only succeeds if the trailing memory is currently available, and the
564*1208bc7eSAndroid Build Coastguard Worker    extent allocator supports merging.</para>
565*1208bc7eSAndroid Build Coastguard Worker
566*1208bc7eSAndroid Build Coastguard Worker    <para>Assuming 4 KiB pages and a 16-byte quantum on a 64-bit system, the
567*1208bc7eSAndroid Build Coastguard Worker    size classes in each category are as shown in <xref linkend="size_classes"
568*1208bc7eSAndroid Build Coastguard Worker    xrefstyle="template:Table %n"/>.</para>
569*1208bc7eSAndroid Build Coastguard Worker
570*1208bc7eSAndroid Build Coastguard Worker    <table xml:id="size_classes" frame="all">
571*1208bc7eSAndroid Build Coastguard Worker      <title>Size classes</title>
572*1208bc7eSAndroid Build Coastguard Worker      <tgroup cols="3" colsep="1" rowsep="1">
573*1208bc7eSAndroid Build Coastguard Worker      <colspec colname="c1" align="left"/>
574*1208bc7eSAndroid Build Coastguard Worker      <colspec colname="c2" align="right"/>
575*1208bc7eSAndroid Build Coastguard Worker      <colspec colname="c3" align="left"/>
576*1208bc7eSAndroid Build Coastguard Worker      <thead>
577*1208bc7eSAndroid Build Coastguard Worker        <row>
578*1208bc7eSAndroid Build Coastguard Worker          <entry>Category</entry>
579*1208bc7eSAndroid Build Coastguard Worker          <entry>Spacing</entry>
580*1208bc7eSAndroid Build Coastguard Worker          <entry>Size</entry>
581*1208bc7eSAndroid Build Coastguard Worker        </row>
582*1208bc7eSAndroid Build Coastguard Worker      </thead>
583*1208bc7eSAndroid Build Coastguard Worker      <tbody>
584*1208bc7eSAndroid Build Coastguard Worker        <row>
585*1208bc7eSAndroid Build Coastguard Worker          <entry morerows="8">Small</entry>
586*1208bc7eSAndroid Build Coastguard Worker          <entry>lg</entry>
587*1208bc7eSAndroid Build Coastguard Worker          <entry>[8]</entry>
588*1208bc7eSAndroid Build Coastguard Worker        </row>
589*1208bc7eSAndroid Build Coastguard Worker        <row>
590*1208bc7eSAndroid Build Coastguard Worker          <entry>16</entry>
591*1208bc7eSAndroid Build Coastguard Worker          <entry>[16, 32, 48, 64, 80, 96, 112, 128]</entry>
592*1208bc7eSAndroid Build Coastguard Worker        </row>
593*1208bc7eSAndroid Build Coastguard Worker        <row>
594*1208bc7eSAndroid Build Coastguard Worker          <entry>32</entry>
595*1208bc7eSAndroid Build Coastguard Worker          <entry>[160, 192, 224, 256]</entry>
596*1208bc7eSAndroid Build Coastguard Worker        </row>
597*1208bc7eSAndroid Build Coastguard Worker        <row>
598*1208bc7eSAndroid Build Coastguard Worker          <entry>64</entry>
599*1208bc7eSAndroid Build Coastguard Worker          <entry>[320, 384, 448, 512]</entry>
600*1208bc7eSAndroid Build Coastguard Worker        </row>
601*1208bc7eSAndroid Build Coastguard Worker        <row>
602*1208bc7eSAndroid Build Coastguard Worker          <entry>128</entry>
603*1208bc7eSAndroid Build Coastguard Worker          <entry>[640, 768, 896, 1024]</entry>
604*1208bc7eSAndroid Build Coastguard Worker        </row>
605*1208bc7eSAndroid Build Coastguard Worker        <row>
606*1208bc7eSAndroid Build Coastguard Worker          <entry>256</entry>
607*1208bc7eSAndroid Build Coastguard Worker          <entry>[1280, 1536, 1792, 2048]</entry>
608*1208bc7eSAndroid Build Coastguard Worker        </row>
609*1208bc7eSAndroid Build Coastguard Worker        <row>
610*1208bc7eSAndroid Build Coastguard Worker          <entry>512</entry>
611*1208bc7eSAndroid Build Coastguard Worker          <entry>[2560, 3072, 3584, 4096]</entry>
612*1208bc7eSAndroid Build Coastguard Worker        </row>
613*1208bc7eSAndroid Build Coastguard Worker        <row>
614*1208bc7eSAndroid Build Coastguard Worker          <entry>1 KiB</entry>
615*1208bc7eSAndroid Build Coastguard Worker          <entry>[5 KiB, 6 KiB, 7 KiB, 8 KiB]</entry>
616*1208bc7eSAndroid Build Coastguard Worker        </row>
617*1208bc7eSAndroid Build Coastguard Worker        <row>
618*1208bc7eSAndroid Build Coastguard Worker          <entry>2 KiB</entry>
619*1208bc7eSAndroid Build Coastguard Worker          <entry>[10 KiB, 12 KiB, 14 KiB]</entry>
620*1208bc7eSAndroid Build Coastguard Worker        </row>
621*1208bc7eSAndroid Build Coastguard Worker        <row>
622*1208bc7eSAndroid Build Coastguard Worker          <entry morerows="15">Large</entry>
623*1208bc7eSAndroid Build Coastguard Worker          <entry>2 KiB</entry>
624*1208bc7eSAndroid Build Coastguard Worker          <entry>[16 KiB]</entry>
625*1208bc7eSAndroid Build Coastguard Worker        </row>
626*1208bc7eSAndroid Build Coastguard Worker        <row>
627*1208bc7eSAndroid Build Coastguard Worker          <entry>4 KiB</entry>
628*1208bc7eSAndroid Build Coastguard Worker          <entry>[20 KiB, 24 KiB, 28 KiB, 32 KiB]</entry>
629*1208bc7eSAndroid Build Coastguard Worker        </row>
630*1208bc7eSAndroid Build Coastguard Worker        <row>
631*1208bc7eSAndroid Build Coastguard Worker          <entry>8 KiB</entry>
632*1208bc7eSAndroid Build Coastguard Worker          <entry>[40 KiB, 48 KiB, 54 KiB, 64 KiB]</entry>
633*1208bc7eSAndroid Build Coastguard Worker        </row>
634*1208bc7eSAndroid Build Coastguard Worker        <row>
635*1208bc7eSAndroid Build Coastguard Worker          <entry>16 KiB</entry>
636*1208bc7eSAndroid Build Coastguard Worker          <entry>[80 KiB, 96 KiB, 112 KiB, 128 KiB]</entry>
637*1208bc7eSAndroid Build Coastguard Worker        </row>
638*1208bc7eSAndroid Build Coastguard Worker        <row>
639*1208bc7eSAndroid Build Coastguard Worker          <entry>32 KiB</entry>
640*1208bc7eSAndroid Build Coastguard Worker          <entry>[160 KiB, 192 KiB, 224 KiB, 256 KiB]</entry>
641*1208bc7eSAndroid Build Coastguard Worker        </row>
642*1208bc7eSAndroid Build Coastguard Worker        <row>
643*1208bc7eSAndroid Build Coastguard Worker          <entry>64 KiB</entry>
644*1208bc7eSAndroid Build Coastguard Worker          <entry>[320 KiB, 384 KiB, 448 KiB, 512 KiB]</entry>
645*1208bc7eSAndroid Build Coastguard Worker        </row>
646*1208bc7eSAndroid Build Coastguard Worker        <row>
647*1208bc7eSAndroid Build Coastguard Worker          <entry>128 KiB</entry>
648*1208bc7eSAndroid Build Coastguard Worker          <entry>[640 KiB, 768 KiB, 896 KiB, 1 MiB]</entry>
649*1208bc7eSAndroid Build Coastguard Worker        </row>
650*1208bc7eSAndroid Build Coastguard Worker        <row>
651*1208bc7eSAndroid Build Coastguard Worker          <entry>256 KiB</entry>
652*1208bc7eSAndroid Build Coastguard Worker          <entry>[1280 KiB, 1536 KiB, 1792 KiB, 2 MiB]</entry>
653*1208bc7eSAndroid Build Coastguard Worker        </row>
654*1208bc7eSAndroid Build Coastguard Worker        <row>
655*1208bc7eSAndroid Build Coastguard Worker          <entry>512 KiB</entry>
656*1208bc7eSAndroid Build Coastguard Worker          <entry>[2560 KiB, 3 MiB, 3584 KiB, 4 MiB]</entry>
657*1208bc7eSAndroid Build Coastguard Worker        </row>
658*1208bc7eSAndroid Build Coastguard Worker        <row>
659*1208bc7eSAndroid Build Coastguard Worker          <entry>1 MiB</entry>
660*1208bc7eSAndroid Build Coastguard Worker          <entry>[5 MiB, 6 MiB, 7 MiB, 8 MiB]</entry>
661*1208bc7eSAndroid Build Coastguard Worker        </row>
662*1208bc7eSAndroid Build Coastguard Worker        <row>
663*1208bc7eSAndroid Build Coastguard Worker          <entry>2 MiB</entry>
664*1208bc7eSAndroid Build Coastguard Worker          <entry>[10 MiB, 12 MiB, 14 MiB, 16 MiB]</entry>
665*1208bc7eSAndroid Build Coastguard Worker        </row>
666*1208bc7eSAndroid Build Coastguard Worker        <row>
667*1208bc7eSAndroid Build Coastguard Worker          <entry>4 MiB</entry>
668*1208bc7eSAndroid Build Coastguard Worker          <entry>[20 MiB, 24 MiB, 28 MiB, 32 MiB]</entry>
669*1208bc7eSAndroid Build Coastguard Worker        </row>
670*1208bc7eSAndroid Build Coastguard Worker        <row>
671*1208bc7eSAndroid Build Coastguard Worker          <entry>8 MiB</entry>
672*1208bc7eSAndroid Build Coastguard Worker          <entry>[40 MiB, 48 MiB, 56 MiB, 64 MiB]</entry>
673*1208bc7eSAndroid Build Coastguard Worker        </row>
674*1208bc7eSAndroid Build Coastguard Worker        <row>
675*1208bc7eSAndroid Build Coastguard Worker          <entry>...</entry>
676*1208bc7eSAndroid Build Coastguard Worker          <entry>...</entry>
677*1208bc7eSAndroid Build Coastguard Worker        </row>
678*1208bc7eSAndroid Build Coastguard Worker        <row>
679*1208bc7eSAndroid Build Coastguard Worker          <entry>512 PiB</entry>
680*1208bc7eSAndroid Build Coastguard Worker          <entry>[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]</entry>
681*1208bc7eSAndroid Build Coastguard Worker        </row>
682*1208bc7eSAndroid Build Coastguard Worker        <row>
683*1208bc7eSAndroid Build Coastguard Worker          <entry>1 EiB</entry>
684*1208bc7eSAndroid Build Coastguard Worker          <entry>[5 EiB, 6 EiB, 7 EiB]</entry>
685*1208bc7eSAndroid Build Coastguard Worker        </row>
686*1208bc7eSAndroid Build Coastguard Worker      </tbody>
687*1208bc7eSAndroid Build Coastguard Worker      </tgroup>
688*1208bc7eSAndroid Build Coastguard Worker    </table>
689*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
690*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="mallctl_namespace">
691*1208bc7eSAndroid Build Coastguard Worker    <title>MALLCTL NAMESPACE</title>
692*1208bc7eSAndroid Build Coastguard Worker    <para>The following names are defined in the namespace accessible via the
693*1208bc7eSAndroid Build Coastguard Worker    <function>mallctl*()</function> functions.  Value types are specified in
694*1208bc7eSAndroid Build Coastguard Worker    parentheses, their readable/writable statuses are encoded as
695*1208bc7eSAndroid Build Coastguard Worker    <literal>rw</literal>, <literal>r-</literal>, <literal>-w</literal>, or
696*1208bc7eSAndroid Build Coastguard Worker    <literal>--</literal>, and required build configuration flags follow, if
697*1208bc7eSAndroid Build Coastguard Worker    any.  A name element encoded as <literal>&lt;i&gt;</literal> or
698*1208bc7eSAndroid Build Coastguard Worker    <literal>&lt;j&gt;</literal> indicates an integer component, where the
699*1208bc7eSAndroid Build Coastguard Worker    integer varies from 0 to some upper value that must be determined via
700*1208bc7eSAndroid Build Coastguard Worker    introspection.  In the case of <mallctl>stats.arenas.&lt;i&gt;.*</mallctl>
701*1208bc7eSAndroid Build Coastguard Worker    and <mallctl>arena.&lt;i&gt;.{initialized,purge,decay,dss}</mallctl>,
702*1208bc7eSAndroid Build Coastguard Worker    <literal>&lt;i&gt;</literal> equal to
703*1208bc7eSAndroid Build Coastguard Worker    <constant>MALLCTL_ARENAS_ALL</constant> can be used to operate on all arenas
704*1208bc7eSAndroid Build Coastguard Worker    or access the summation of statistics from all arenas; similarly
705*1208bc7eSAndroid Build Coastguard Worker    <literal>&lt;i&gt;</literal> equal to
706*1208bc7eSAndroid Build Coastguard Worker    <constant>MALLCTL_ARENAS_DESTROYED</constant> can be used to access the
707*1208bc7eSAndroid Build Coastguard Worker    summation of statistics from all destroyed arenas.  These constants can be
708*1208bc7eSAndroid Build Coastguard Worker    utilized either via <function>mallctlnametomib()</function> followed by
709*1208bc7eSAndroid Build Coastguard Worker    <function>mallctlbymib()</function>, or via code such as the following:
710*1208bc7eSAndroid Build Coastguard Worker    <programlisting language="C"><![CDATA[
711*1208bc7eSAndroid Build Coastguard Worker#define STRINGIFY_HELPER(x) #x
712*1208bc7eSAndroid Build Coastguard Worker#define STRINGIFY(x) STRINGIFY_HELPER(x)
713*1208bc7eSAndroid Build Coastguard Worker
714*1208bc7eSAndroid Build Coastguard Workermallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
715*1208bc7eSAndroid Build Coastguard Worker    NULL, NULL, NULL, 0);]]></programlisting>
716*1208bc7eSAndroid Build Coastguard Worker    Take special note of the <link
717*1208bc7eSAndroid Build Coastguard Worker    linkend="epoch"><mallctl>epoch</mallctl></link> mallctl, which controls
718*1208bc7eSAndroid Build Coastguard Worker    refreshing of cached dynamic statistics.</para>
719*1208bc7eSAndroid Build Coastguard Worker
720*1208bc7eSAndroid Build Coastguard Worker    <variablelist>
721*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="version">
722*1208bc7eSAndroid Build Coastguard Worker        <term>
723*1208bc7eSAndroid Build Coastguard Worker          <mallctl>version</mallctl>
724*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
725*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
726*1208bc7eSAndroid Build Coastguard Worker        </term>
727*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Return the jemalloc version string.</para></listitem>
728*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
729*1208bc7eSAndroid Build Coastguard Worker
730*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="epoch">
731*1208bc7eSAndroid Build Coastguard Worker        <term>
732*1208bc7eSAndroid Build Coastguard Worker          <mallctl>epoch</mallctl>
733*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
734*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
735*1208bc7eSAndroid Build Coastguard Worker        </term>
736*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>If a value is passed in, refresh the data from which
737*1208bc7eSAndroid Build Coastguard Worker        the <function>mallctl*()</function> functions report values,
738*1208bc7eSAndroid Build Coastguard Worker        and increment the epoch.  Return the current epoch.  This is useful for
739*1208bc7eSAndroid Build Coastguard Worker        detecting whether another thread caused a refresh.</para></listitem>
740*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
741*1208bc7eSAndroid Build Coastguard Worker
742*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="background_thread">
743*1208bc7eSAndroid Build Coastguard Worker        <term>
744*1208bc7eSAndroid Build Coastguard Worker          <mallctl>background_thread</mallctl>
745*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
746*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
747*1208bc7eSAndroid Build Coastguard Worker        </term>
748*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Enable/disable internal background worker threads.  When
749*1208bc7eSAndroid Build Coastguard Worker        set to true, background threads are created on demand (the number of
750*1208bc7eSAndroid Build Coastguard Worker        background threads will be no more than the number of CPUs or active
751*1208bc7eSAndroid Build Coastguard Worker        arenas).  Threads run periodically, and handle <link
752*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.decay">purging</link> asynchronously.  When switching
753*1208bc7eSAndroid Build Coastguard Worker        off, background threads are terminated synchronously.  Note that after
754*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>fork</refentrytitle><manvolnum>2</manvolnum></citerefentry>
755*1208bc7eSAndroid Build Coastguard Worker        function, the state in the child process will be disabled regardless
756*1208bc7eSAndroid Build Coastguard Worker        the state in parent process. See <link
757*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.background_thread.num_threads"><mallctl>stats.background_thread</mallctl></link>
758*1208bc7eSAndroid Build Coastguard Worker        for related stats.  <link
759*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.background_thread"><mallctl>opt.background_thread</mallctl></link>
760*1208bc7eSAndroid Build Coastguard Worker        can be used to set the default option.  This option is only available on
761*1208bc7eSAndroid Build Coastguard Worker        selected pthread-based platforms.</para></listitem>
762*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
763*1208bc7eSAndroid Build Coastguard Worker
764*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="max_background_threads">
765*1208bc7eSAndroid Build Coastguard Worker        <term>
766*1208bc7eSAndroid Build Coastguard Worker          <mallctl>max_background_threads</mallctl>
767*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
768*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
769*1208bc7eSAndroid Build Coastguard Worker        </term>
770*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum number of background worker threads that will
771*1208bc7eSAndroid Build Coastguard Worker        be created.  This value is capped at <link
772*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.max_background_threads"><mallctl>opt.max_background_threads</mallctl></link> at
773*1208bc7eSAndroid Build Coastguard Worker        startup.</para></listitem>
774*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
775*1208bc7eSAndroid Build Coastguard Worker
776*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.cache_oblivious">
777*1208bc7eSAndroid Build Coastguard Worker        <term>
778*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.cache_oblivious</mallctl>
779*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
780*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
781*1208bc7eSAndroid Build Coastguard Worker        </term>
782*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-cache-oblivious</option> was specified
783*1208bc7eSAndroid Build Coastguard Worker        during build configuration.</para></listitem>
784*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
785*1208bc7eSAndroid Build Coastguard Worker
786*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.debug">
787*1208bc7eSAndroid Build Coastguard Worker        <term>
788*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.debug</mallctl>
789*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
790*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
791*1208bc7eSAndroid Build Coastguard Worker        </term>
792*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-debug</option> was specified during
793*1208bc7eSAndroid Build Coastguard Worker        build configuration.</para></listitem>
794*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
795*1208bc7eSAndroid Build Coastguard Worker
796*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.fill">
797*1208bc7eSAndroid Build Coastguard Worker        <term>
798*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.fill</mallctl>
799*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
800*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
801*1208bc7eSAndroid Build Coastguard Worker        </term>
802*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-fill</option> was specified during
803*1208bc7eSAndroid Build Coastguard Worker        build configuration.</para></listitem>
804*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
805*1208bc7eSAndroid Build Coastguard Worker
806*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.lazy_lock">
807*1208bc7eSAndroid Build Coastguard Worker        <term>
808*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.lazy_lock</mallctl>
809*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
810*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
811*1208bc7eSAndroid Build Coastguard Worker        </term>
812*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-lazy-lock</option> was specified
813*1208bc7eSAndroid Build Coastguard Worker        during build configuration.</para></listitem>
814*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
815*1208bc7eSAndroid Build Coastguard Worker
816*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.malloc_conf">
817*1208bc7eSAndroid Build Coastguard Worker        <term>
818*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.malloc_conf</mallctl>
819*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
820*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
821*1208bc7eSAndroid Build Coastguard Worker        </term>
822*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Embedded configure-time-specified run-time options
823*1208bc7eSAndroid Build Coastguard Worker        string, empty unless <option>--with-malloc-conf</option> was specified
824*1208bc7eSAndroid Build Coastguard Worker        during build configuration.</para></listitem>
825*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
826*1208bc7eSAndroid Build Coastguard Worker
827*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.prof">
828*1208bc7eSAndroid Build Coastguard Worker        <term>
829*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.prof</mallctl>
830*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
831*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
832*1208bc7eSAndroid Build Coastguard Worker        </term>
833*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-prof</option> was specified during
834*1208bc7eSAndroid Build Coastguard Worker        build configuration.</para></listitem>
835*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
836*1208bc7eSAndroid Build Coastguard Worker
837*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.prof_libgcc">
838*1208bc7eSAndroid Build Coastguard Worker        <term>
839*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.prof_libgcc</mallctl>
840*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
841*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
842*1208bc7eSAndroid Build Coastguard Worker        </term>
843*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--disable-prof-libgcc</option> was not
844*1208bc7eSAndroid Build Coastguard Worker        specified during build configuration.</para></listitem>
845*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
846*1208bc7eSAndroid Build Coastguard Worker
847*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.prof_libunwind">
848*1208bc7eSAndroid Build Coastguard Worker        <term>
849*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.prof_libunwind</mallctl>
850*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
851*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
852*1208bc7eSAndroid Build Coastguard Worker        </term>
853*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-prof-libunwind</option> was specified
854*1208bc7eSAndroid Build Coastguard Worker        during build configuration.</para></listitem>
855*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
856*1208bc7eSAndroid Build Coastguard Worker
857*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.stats">
858*1208bc7eSAndroid Build Coastguard Worker        <term>
859*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.stats</mallctl>
860*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
861*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
862*1208bc7eSAndroid Build Coastguard Worker        </term>
863*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-stats</option> was specified during
864*1208bc7eSAndroid Build Coastguard Worker        build configuration.</para></listitem>
865*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
866*1208bc7eSAndroid Build Coastguard Worker
867*1208bc7eSAndroid Build Coastguard Worker
868*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.utrace">
869*1208bc7eSAndroid Build Coastguard Worker        <term>
870*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.utrace</mallctl>
871*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
872*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
873*1208bc7eSAndroid Build Coastguard Worker        </term>
874*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-utrace</option> was specified during
875*1208bc7eSAndroid Build Coastguard Worker        build configuration.</para></listitem>
876*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
877*1208bc7eSAndroid Build Coastguard Worker
878*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="config.xmalloc">
879*1208bc7eSAndroid Build Coastguard Worker        <term>
880*1208bc7eSAndroid Build Coastguard Worker          <mallctl>config.xmalloc</mallctl>
881*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
882*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
883*1208bc7eSAndroid Build Coastguard Worker        </term>
884*1208bc7eSAndroid Build Coastguard Worker        <listitem><para><option>--enable-xmalloc</option> was specified during
885*1208bc7eSAndroid Build Coastguard Worker        build configuration.</para></listitem>
886*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
887*1208bc7eSAndroid Build Coastguard Worker
888*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.abort">
889*1208bc7eSAndroid Build Coastguard Worker        <term>
890*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.abort</mallctl>
891*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
892*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
893*1208bc7eSAndroid Build Coastguard Worker        </term>
894*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Abort-on-warning enabled/disabled.  If true, most
895*1208bc7eSAndroid Build Coastguard Worker        warnings are fatal.  Note that runtime option warnings are not included
896*1208bc7eSAndroid Build Coastguard Worker        (see <link
897*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.abort_conf"><mallctl>opt.abort_conf</mallctl></link> for
898*1208bc7eSAndroid Build Coastguard Worker        that). The process will call
899*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>abort</refentrytitle>
900*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry> in these cases.  This option is
901*1208bc7eSAndroid Build Coastguard Worker        disabled by default unless <option>--enable-debug</option> is
902*1208bc7eSAndroid Build Coastguard Worker        specified during configuration, in which case it is enabled by default.
903*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
904*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
905*1208bc7eSAndroid Build Coastguard Worker
906*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.abort_conf">
907*1208bc7eSAndroid Build Coastguard Worker        <term>
908*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.abort_conf</mallctl>
909*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
910*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
911*1208bc7eSAndroid Build Coastguard Worker        </term>
912*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Abort-on-invalid-configuration enabled/disabled.  If
913*1208bc7eSAndroid Build Coastguard Worker        true, invalid runtime options are fatal.  The process will call
914*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>abort</refentrytitle>
915*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry> in these cases.  This option is
916*1208bc7eSAndroid Build Coastguard Worker        disabled by default unless <option>--enable-debug</option> is
917*1208bc7eSAndroid Build Coastguard Worker        specified during configuration, in which case it is enabled by default.
918*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
919*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
920*1208bc7eSAndroid Build Coastguard Worker
921*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.metadata_thp">
922*1208bc7eSAndroid Build Coastguard Worker        <term>
923*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.metadata_thp</mallctl>
924*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
925*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
926*1208bc7eSAndroid Build Coastguard Worker        </term>
927*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Controls whether to allow jemalloc to use transparent
928*1208bc7eSAndroid Build Coastguard Worker        huge page (THP) for internal metadata (see <link
929*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.metadata">stats.metadata</link>).  <quote>always</quote>
930*1208bc7eSAndroid Build Coastguard Worker        allows such usage.  <quote>auto</quote> uses no THP initially, but may
931*1208bc7eSAndroid Build Coastguard Worker        begin to do so when metadata usage reaches certain level.  The default
932*1208bc7eSAndroid Build Coastguard Worker        is <quote>disabled</quote>.</para></listitem>
933*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
934*1208bc7eSAndroid Build Coastguard Worker
935*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.retain">
936*1208bc7eSAndroid Build Coastguard Worker        <term>
937*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.retain</mallctl>
938*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
939*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
940*1208bc7eSAndroid Build Coastguard Worker        </term>
941*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>If true, retain unused virtual memory for later reuse
942*1208bc7eSAndroid Build Coastguard Worker        rather than discarding it by calling
943*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>munmap</refentrytitle>
944*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> or equivalent (see <link
945*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.retained">stats.retained</link> for related details).
946*1208bc7eSAndroid Build Coastguard Worker        This option is disabled by default unless discarding virtual memory is
947*1208bc7eSAndroid Build Coastguard Worker        known to trigger
948*1208bc7eSAndroid Build Coastguard Worker        platform-specific performance problems, e.g. for [64-bit] Linux, which
949*1208bc7eSAndroid Build Coastguard Worker        has a quirk in its virtual memory allocation algorithm that causes
950*1208bc7eSAndroid Build Coastguard Worker        semi-permanent VM map holes under normal jemalloc operation.  Although
951*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>munmap</refentrytitle>
952*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> causes issues on 32-bit Linux as
953*1208bc7eSAndroid Build Coastguard Worker        well, retaining virtual memory for 32-bit Linux is disabled by default
954*1208bc7eSAndroid Build Coastguard Worker        due to the practical possibility of address space exhaustion.
955*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
956*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
957*1208bc7eSAndroid Build Coastguard Worker
958*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.dss">
959*1208bc7eSAndroid Build Coastguard Worker        <term>
960*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.dss</mallctl>
961*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
962*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
963*1208bc7eSAndroid Build Coastguard Worker        </term>
964*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle>
965*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry>) allocation precedence as
966*1208bc7eSAndroid Build Coastguard Worker        related to <citerefentry><refentrytitle>mmap</refentrytitle>
967*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> allocation.  The following
968*1208bc7eSAndroid Build Coastguard Worker        settings are supported if
969*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>sbrk</refentrytitle>
970*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> is supported by the operating
971*1208bc7eSAndroid Build Coastguard Worker        system: <quote>disabled</quote>, <quote>primary</quote>, and
972*1208bc7eSAndroid Build Coastguard Worker        <quote>secondary</quote>; otherwise only <quote>disabled</quote> is
973*1208bc7eSAndroid Build Coastguard Worker        supported.  The default is <quote>secondary</quote> if
974*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>sbrk</refentrytitle>
975*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> is supported by the operating
976*1208bc7eSAndroid Build Coastguard Worker        system; <quote>disabled</quote> otherwise.
977*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
978*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
979*1208bc7eSAndroid Build Coastguard Worker
980*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.narenas">
981*1208bc7eSAndroid Build Coastguard Worker        <term>
982*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.narenas</mallctl>
983*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
984*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
985*1208bc7eSAndroid Build Coastguard Worker        </term>
986*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum number of arenas to use for automatic
987*1208bc7eSAndroid Build Coastguard Worker        multiplexing of threads and arenas.  The default is four times the
988*1208bc7eSAndroid Build Coastguard Worker        number of CPUs, or one if there is a single CPU.</para></listitem>
989*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
990*1208bc7eSAndroid Build Coastguard Worker
991*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.percpu_arena">
992*1208bc7eSAndroid Build Coastguard Worker        <term>
993*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.percpu_arena</mallctl>
994*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
995*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
996*1208bc7eSAndroid Build Coastguard Worker        </term>
997*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Per CPU arena mode.  Use the <quote>percpu</quote>
998*1208bc7eSAndroid Build Coastguard Worker        setting to enable this feature, which uses number of CPUs to determine
999*1208bc7eSAndroid Build Coastguard Worker        number of arenas, and bind threads to arenas dynamically based on the
1000*1208bc7eSAndroid Build Coastguard Worker        CPU the thread runs on currently.  <quote>phycpu</quote> setting uses
1001*1208bc7eSAndroid Build Coastguard Worker        one arena per physical CPU, which means the two hyper threads on the
1002*1208bc7eSAndroid Build Coastguard Worker        same CPU share one arena.  Note that no runtime checking regarding the
1003*1208bc7eSAndroid Build Coastguard Worker        availability of hyper threading is done at the moment.  When set to
1004*1208bc7eSAndroid Build Coastguard Worker        <quote>disabled</quote>, narenas and thread to arena association will
1005*1208bc7eSAndroid Build Coastguard Worker        not be impacted by this option.  The default is <quote>disabled</quote>.
1006*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1007*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1008*1208bc7eSAndroid Build Coastguard Worker
1009*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.background_thread">
1010*1208bc7eSAndroid Build Coastguard Worker        <term>
1011*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.background_thread</mallctl>
1012*1208bc7eSAndroid Build Coastguard Worker          (<type>const bool</type>)
1013*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1014*1208bc7eSAndroid Build Coastguard Worker        </term>
1015*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Internal background worker threads enabled/disabled.
1016*1208bc7eSAndroid Build Coastguard Worker        Because of potential circular dependencies, enabling background thread
1017*1208bc7eSAndroid Build Coastguard Worker        using this option may cause crash or deadlock during initialization. For
1018*1208bc7eSAndroid Build Coastguard Worker        a reliable way to use this feature, see <link
1019*1208bc7eSAndroid Build Coastguard Worker        linkend="background_thread">background_thread</link> for dynamic control
1020*1208bc7eSAndroid Build Coastguard Worker        options and details.  This option is disabled by
1021*1208bc7eSAndroid Build Coastguard Worker        default.</para></listitem>
1022*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1023*1208bc7eSAndroid Build Coastguard Worker
1024*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.max_background_threads">
1025*1208bc7eSAndroid Build Coastguard Worker        <term>
1026*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.max_background_threads</mallctl>
1027*1208bc7eSAndroid Build Coastguard Worker          (<type>const size_t</type>)
1028*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1029*1208bc7eSAndroid Build Coastguard Worker        </term>
1030*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum number of background threads that will be created
1031*1208bc7eSAndroid Build Coastguard Worker        if <link linkend="background_thread">background_thread</link> is set.
1032*1208bc7eSAndroid Build Coastguard Worker        Defaults to number of cpus.</para></listitem>
1033*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1034*1208bc7eSAndroid Build Coastguard Worker
1035*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.dirty_decay_ms">
1036*1208bc7eSAndroid Build Coastguard Worker        <term>
1037*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.dirty_decay_ms</mallctl>
1038*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
1039*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1040*1208bc7eSAndroid Build Coastguard Worker        </term>
1041*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Approximate time in milliseconds from the creation of a
1042*1208bc7eSAndroid Build Coastguard Worker        set of unused dirty pages until an equivalent set of unused dirty pages
1043*1208bc7eSAndroid Build Coastguard Worker        is purged (i.e. converted to muzzy via e.g.
1044*1208bc7eSAndroid Build Coastguard Worker        <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>
1045*1208bc7eSAndroid Build Coastguard Worker        if supported by the operating system, or converted to clean otherwise)
1046*1208bc7eSAndroid Build Coastguard Worker        and/or reused.  Dirty pages are defined as previously having been
1047*1208bc7eSAndroid Build Coastguard Worker        potentially written to by the application, and therefore consuming
1048*1208bc7eSAndroid Build Coastguard Worker        physical memory, yet having no current use.  The pages are incrementally
1049*1208bc7eSAndroid Build Coastguard Worker        purged according to a sigmoidal decay curve that starts and ends with
1050*1208bc7eSAndroid Build Coastguard Worker        zero purge rate.  A decay time of 0 causes all unused dirty pages to be
1051*1208bc7eSAndroid Build Coastguard Worker        purged immediately upon creation.  A decay time of -1 disables purging.
1052*1208bc7eSAndroid Build Coastguard Worker        The default decay time is 10 seconds.  See <link
1053*1208bc7eSAndroid Build Coastguard Worker        linkend="arenas.dirty_decay_ms"><mallctl>arenas.dirty_decay_ms</mallctl></link>
1054*1208bc7eSAndroid Build Coastguard Worker        and <link
1055*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.dirty_decay_ms"><mallctl>arena.&lt;i&gt;.dirty_decay_ms</mallctl></link>
1056*1208bc7eSAndroid Build Coastguard Worker        for related dynamic control options.  See <link
1057*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
1058*1208bc7eSAndroid Build Coastguard Worker        for a description of muzzy pages.</para></listitem>
1059*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1060*1208bc7eSAndroid Build Coastguard Worker
1061*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.muzzy_decay_ms">
1062*1208bc7eSAndroid Build Coastguard Worker        <term>
1063*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.muzzy_decay_ms</mallctl>
1064*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
1065*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1066*1208bc7eSAndroid Build Coastguard Worker        </term>
1067*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Approximate time in milliseconds from the creation of a
1068*1208bc7eSAndroid Build Coastguard Worker        set of unused muzzy pages until an equivalent set of unused muzzy pages
1069*1208bc7eSAndroid Build Coastguard Worker        is purged (i.e. converted to clean) and/or reused.  Muzzy pages are
1070*1208bc7eSAndroid Build Coastguard Worker        defined as previously having been unused dirty pages that were
1071*1208bc7eSAndroid Build Coastguard Worker        subsequently purged in a manner that left them subject to the
1072*1208bc7eSAndroid Build Coastguard Worker        reclamation whims of the operating system (e.g.
1073*1208bc7eSAndroid Build Coastguard Worker        <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>),
1074*1208bc7eSAndroid Build Coastguard Worker        and therefore in an indeterminate state.  The pages are incrementally
1075*1208bc7eSAndroid Build Coastguard Worker        purged according to a sigmoidal decay curve that starts and ends with
1076*1208bc7eSAndroid Build Coastguard Worker        zero purge rate.  A decay time of 0 causes all unused muzzy pages to be
1077*1208bc7eSAndroid Build Coastguard Worker        purged immediately upon creation.  A decay time of -1 disables purging.
1078*1208bc7eSAndroid Build Coastguard Worker        The default decay time is 10 seconds.  See <link
1079*1208bc7eSAndroid Build Coastguard Worker        linkend="arenas.muzzy_decay_ms"><mallctl>arenas.muzzy_decay_ms</mallctl></link>
1080*1208bc7eSAndroid Build Coastguard Worker        and <link
1081*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.muzzy_decay_ms"><mallctl>arena.&lt;i&gt;.muzzy_decay_ms</mallctl></link>
1082*1208bc7eSAndroid Build Coastguard Worker        for related dynamic control options.</para></listitem>
1083*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1084*1208bc7eSAndroid Build Coastguard Worker
1085*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.lg_extent_max_active_fit">
1086*1208bc7eSAndroid Build Coastguard Worker        <term>
1087*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.lg_extent_max_active_fit</mallctl>
1088*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
1089*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1090*1208bc7eSAndroid Build Coastguard Worker        </term>
1091*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>When reusing dirty extents, this determines the (log
1092*1208bc7eSAndroid Build Coastguard Worker        base 2 of the) maximum ratio between the size of the active extent
1093*1208bc7eSAndroid Build Coastguard Worker        selected (to split off from) and the size of the requested allocation.
1094*1208bc7eSAndroid Build Coastguard Worker        This prevents the splitting of large active extents for smaller
1095*1208bc7eSAndroid Build Coastguard Worker        allocations, which can reduce fragmentation over the long run
1096*1208bc7eSAndroid Build Coastguard Worker        (especially for non-active extents).  Lower value may reduce
1097*1208bc7eSAndroid Build Coastguard Worker        fragmentation, at the cost of extra active extents.  The default value
1098*1208bc7eSAndroid Build Coastguard Worker        is 6, which gives a maximum ratio of 64 (2^6).</para></listitem>
1099*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1100*1208bc7eSAndroid Build Coastguard Worker
1101*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.stats_print">
1102*1208bc7eSAndroid Build Coastguard Worker        <term>
1103*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.stats_print</mallctl>
1104*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1105*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1106*1208bc7eSAndroid Build Coastguard Worker        </term>
1107*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Enable/disable statistics printing at exit.  If
1108*1208bc7eSAndroid Build Coastguard Worker        enabled, the <function>malloc_stats_print()</function>
1109*1208bc7eSAndroid Build Coastguard Worker        function is called at program exit via an
1110*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>atexit</refentrytitle>
1111*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry> function.  <link
1112*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.stats_print_opts"><mallctl>opt.stats_print_opts</mallctl></link>
1113*1208bc7eSAndroid Build Coastguard Worker        can be combined to specify output options. If
1114*1208bc7eSAndroid Build Coastguard Worker        <option>--enable-stats</option> is specified during configuration, this
1115*1208bc7eSAndroid Build Coastguard Worker        has the potential to cause deadlock for a multi-threaded process that
1116*1208bc7eSAndroid Build Coastguard Worker        exits while one or more threads are executing in the memory allocation
1117*1208bc7eSAndroid Build Coastguard Worker        functions.  Furthermore, <function>atexit()</function> may
1118*1208bc7eSAndroid Build Coastguard Worker        allocate memory during application initialization and then deadlock
1119*1208bc7eSAndroid Build Coastguard Worker        internally when jemalloc in turn calls
1120*1208bc7eSAndroid Build Coastguard Worker        <function>atexit()</function>, so this option is not
1121*1208bc7eSAndroid Build Coastguard Worker        universally usable (though the application can register its own
1122*1208bc7eSAndroid Build Coastguard Worker        <function>atexit()</function> function with equivalent
1123*1208bc7eSAndroid Build Coastguard Worker        functionality).  Therefore, this option should only be used with care;
1124*1208bc7eSAndroid Build Coastguard Worker        it is primarily intended as a performance tuning aid during application
1125*1208bc7eSAndroid Build Coastguard Worker        development.  This option is disabled by default.</para></listitem>
1126*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1127*1208bc7eSAndroid Build Coastguard Worker
1128*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.stats_print_opts">
1129*1208bc7eSAndroid Build Coastguard Worker        <term>
1130*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.stats_print_opts</mallctl>
1131*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
1132*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1133*1208bc7eSAndroid Build Coastguard Worker        </term>
1134*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Options (the <parameter>opts</parameter> string) to pass
1135*1208bc7eSAndroid Build Coastguard Worker        to the <function>malloc_stats_print()</function> at exit (enabled
1136*1208bc7eSAndroid Build Coastguard Worker        through <link
1137*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.stats_print"><mallctl>opt.stats_print</mallctl></link>). See
1138*1208bc7eSAndroid Build Coastguard Worker        available options in <link
1139*1208bc7eSAndroid Build Coastguard Worker        linkend="malloc_stats_print_opts"><function>malloc_stats_print()</function></link>.
1140*1208bc7eSAndroid Build Coastguard Worker        Has no effect unless <link
1141*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.stats_print"><mallctl>opt.stats_print</mallctl></link> is
1142*1208bc7eSAndroid Build Coastguard Worker        enabled.  The default is <quote></quote>.</para></listitem>
1143*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1144*1208bc7eSAndroid Build Coastguard Worker
1145*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.junk">
1146*1208bc7eSAndroid Build Coastguard Worker        <term>
1147*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.junk</mallctl>
1148*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
1149*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1150*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-fill</option>]
1151*1208bc7eSAndroid Build Coastguard Worker        </term>
1152*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Junk filling.  If set to <quote>alloc</quote>, each byte
1153*1208bc7eSAndroid Build Coastguard Worker        of uninitialized allocated memory will be initialized to
1154*1208bc7eSAndroid Build Coastguard Worker        <literal>0xa5</literal>.  If set to <quote>free</quote>, all deallocated
1155*1208bc7eSAndroid Build Coastguard Worker        memory will be initialized to <literal>0x5a</literal>.  If set to
1156*1208bc7eSAndroid Build Coastguard Worker        <quote>true</quote>, both allocated and deallocated memory will be
1157*1208bc7eSAndroid Build Coastguard Worker        initialized, and if set to <quote>false</quote>, junk filling be
1158*1208bc7eSAndroid Build Coastguard Worker        disabled entirely.  This is intended for debugging and will impact
1159*1208bc7eSAndroid Build Coastguard Worker        performance negatively.  This option is <quote>false</quote> by default
1160*1208bc7eSAndroid Build Coastguard Worker        unless <option>--enable-debug</option> is specified during
1161*1208bc7eSAndroid Build Coastguard Worker        configuration, in which case it is <quote>true</quote> by
1162*1208bc7eSAndroid Build Coastguard Worker        default.</para></listitem>
1163*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1164*1208bc7eSAndroid Build Coastguard Worker
1165*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.zero">
1166*1208bc7eSAndroid Build Coastguard Worker        <term>
1167*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.zero</mallctl>
1168*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1169*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1170*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-fill</option>]
1171*1208bc7eSAndroid Build Coastguard Worker        </term>
1172*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Zero filling enabled/disabled.  If enabled, each byte
1173*1208bc7eSAndroid Build Coastguard Worker        of uninitialized allocated memory will be initialized to 0.  Note that
1174*1208bc7eSAndroid Build Coastguard Worker        this initialization only happens once for each byte, so
1175*1208bc7eSAndroid Build Coastguard Worker        <function>realloc()</function> and
1176*1208bc7eSAndroid Build Coastguard Worker        <function>rallocx()</function> calls do not zero memory that
1177*1208bc7eSAndroid Build Coastguard Worker        was previously allocated.  This is intended for debugging and will
1178*1208bc7eSAndroid Build Coastguard Worker        impact performance negatively.  This option is disabled by default.
1179*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1180*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1181*1208bc7eSAndroid Build Coastguard Worker
1182*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.utrace">
1183*1208bc7eSAndroid Build Coastguard Worker        <term>
1184*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.utrace</mallctl>
1185*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1186*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1187*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-utrace</option>]
1188*1208bc7eSAndroid Build Coastguard Worker        </term>
1189*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Allocation tracing based on
1190*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>utrace</refentrytitle>
1191*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> enabled/disabled.  This option
1192*1208bc7eSAndroid Build Coastguard Worker        is disabled by default.</para></listitem>
1193*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1194*1208bc7eSAndroid Build Coastguard Worker
1195*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.xmalloc">
1196*1208bc7eSAndroid Build Coastguard Worker        <term>
1197*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.xmalloc</mallctl>
1198*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1199*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1200*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-xmalloc</option>]
1201*1208bc7eSAndroid Build Coastguard Worker        </term>
1202*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Abort-on-out-of-memory enabled/disabled.  If enabled,
1203*1208bc7eSAndroid Build Coastguard Worker        rather than returning failure for any allocation function, display a
1204*1208bc7eSAndroid Build Coastguard Worker        diagnostic message on <constant>STDERR_FILENO</constant> and cause the
1205*1208bc7eSAndroid Build Coastguard Worker        program to drop core (using
1206*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>abort</refentrytitle>
1207*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry>).  If an application is
1208*1208bc7eSAndroid Build Coastguard Worker        designed to depend on this behavior, set the option at compile time by
1209*1208bc7eSAndroid Build Coastguard Worker        including the following in the source code:
1210*1208bc7eSAndroid Build Coastguard Worker        <programlisting language="C"><![CDATA[
1211*1208bc7eSAndroid Build Coastguard Workermalloc_conf = "xmalloc:true";]]></programlisting>
1212*1208bc7eSAndroid Build Coastguard Worker        This option is disabled by default.</para></listitem>
1213*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1214*1208bc7eSAndroid Build Coastguard Worker
1215*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.tcache">
1216*1208bc7eSAndroid Build Coastguard Worker        <term>
1217*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.tcache</mallctl>
1218*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1219*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1220*1208bc7eSAndroid Build Coastguard Worker        </term>
1221*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Thread-specific caching (tcache) enabled/disabled.  When
1222*1208bc7eSAndroid Build Coastguard Worker        there are multiple threads, each thread uses a tcache for objects up to
1223*1208bc7eSAndroid Build Coastguard Worker        a certain size.  Thread-specific caching allows many allocations to be
1224*1208bc7eSAndroid Build Coastguard Worker        satisfied without performing any thread synchronization, at the cost of
1225*1208bc7eSAndroid Build Coastguard Worker        increased memory use.  See the <link
1226*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.lg_tcache_max"><mallctl>opt.lg_tcache_max</mallctl></link>
1227*1208bc7eSAndroid Build Coastguard Worker        option for related tuning information.  This option is enabled by
1228*1208bc7eSAndroid Build Coastguard Worker        default.</para></listitem>
1229*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1230*1208bc7eSAndroid Build Coastguard Worker
1231*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.lg_tcache_max">
1232*1208bc7eSAndroid Build Coastguard Worker        <term>
1233*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.lg_tcache_max</mallctl>
1234*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
1235*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1236*1208bc7eSAndroid Build Coastguard Worker        </term>
1237*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum size class (log base 2) to cache in the
1238*1208bc7eSAndroid Build Coastguard Worker        thread-specific cache (tcache).  At a minimum, all small size classes
1239*1208bc7eSAndroid Build Coastguard Worker        are cached, and at a maximum all large size classes are cached.  The
1240*1208bc7eSAndroid Build Coastguard Worker        default maximum is 32 KiB (2^15).</para></listitem>
1241*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1242*1208bc7eSAndroid Build Coastguard Worker
1243*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.thp">
1244*1208bc7eSAndroid Build Coastguard Worker        <term>
1245*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.thp</mallctl>
1246*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
1247*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1248*1208bc7eSAndroid Build Coastguard Worker        </term>
1249*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Transparent hugepage (THP) mode. Settings "always",
1250*1208bc7eSAndroid Build Coastguard Worker        "never" and "default" are available if THP is supported by the operating
1251*1208bc7eSAndroid Build Coastguard Worker        system.  The "always" setting enables transparent hugepage for all user
1252*1208bc7eSAndroid Build Coastguard Worker        memory mappings with
1253*1208bc7eSAndroid Build Coastguard Worker        <parameter><constant>MADV_HUGEPAGE</constant></parameter>; "never"
1254*1208bc7eSAndroid Build Coastguard Worker        ensures no transparent hugepage with
1255*1208bc7eSAndroid Build Coastguard Worker        <parameter><constant>MADV_NOHUGEPAGE</constant></parameter>; the default
1256*1208bc7eSAndroid Build Coastguard Worker        setting "default" makes no changes.  Note that: this option does not
1257*1208bc7eSAndroid Build Coastguard Worker        affect THP for jemalloc internal metadata (see <link
1258*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.metadata_thp"><mallctl>opt.metadata_thp</mallctl></link>);
1259*1208bc7eSAndroid Build Coastguard Worker        in addition, for arenas with customized <link
1260*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.extent_hooks"><mallctl>extent_hooks</mallctl></link>,
1261*1208bc7eSAndroid Build Coastguard Worker        this option is bypassed as it is implemented as part of the default
1262*1208bc7eSAndroid Build Coastguard Worker        extent hooks.</para></listitem>
1263*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1264*1208bc7eSAndroid Build Coastguard Worker
1265*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof">
1266*1208bc7eSAndroid Build Coastguard Worker        <term>
1267*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof</mallctl>
1268*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1269*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1270*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1271*1208bc7eSAndroid Build Coastguard Worker        </term>
1272*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Memory profiling enabled/disabled.  If enabled, profile
1273*1208bc7eSAndroid Build Coastguard Worker        memory allocation activity.  See the <link
1274*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link>
1275*1208bc7eSAndroid Build Coastguard Worker        option for on-the-fly activation/deactivation.  See the <link
1276*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>
1277*1208bc7eSAndroid Build Coastguard Worker        option for probabilistic sampling control.  See the <link
1278*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link>
1279*1208bc7eSAndroid Build Coastguard Worker        option for control of cumulative sample reporting.  See the <link
1280*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
1281*1208bc7eSAndroid Build Coastguard Worker        option for information on interval-triggered profile dumping, the <link
1282*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_gdump"><mallctl>opt.prof_gdump</mallctl></link>
1283*1208bc7eSAndroid Build Coastguard Worker        option for information on high-water-triggered profile dumping, and the
1284*1208bc7eSAndroid Build Coastguard Worker        <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl></link>
1285*1208bc7eSAndroid Build Coastguard Worker        option for final profile dumping.  Profile output is compatible with
1286*1208bc7eSAndroid Build Coastguard Worker        the <command>jeprof</command> command, which is based on the
1287*1208bc7eSAndroid Build Coastguard Worker        <command>pprof</command> that is developed as part of the <ulink
1288*1208bc7eSAndroid Build Coastguard Worker        url="http://code.google.com/p/gperftools/">gperftools
1289*1208bc7eSAndroid Build Coastguard Worker        package</ulink>.  See <link linkend="heap_profile_format">HEAP PROFILE
1290*1208bc7eSAndroid Build Coastguard Worker        FORMAT</link> for heap profile format documentation.</para></listitem>
1291*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1292*1208bc7eSAndroid Build Coastguard Worker
1293*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_prefix">
1294*1208bc7eSAndroid Build Coastguard Worker        <term>
1295*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_prefix</mallctl>
1296*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
1297*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1298*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1299*1208bc7eSAndroid Build Coastguard Worker        </term>
1300*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Filename prefix for profile dumps.  If the prefix is
1301*1208bc7eSAndroid Build Coastguard Worker        set to the empty string, no automatic dumps will occur; this is
1302*1208bc7eSAndroid Build Coastguard Worker        primarily useful for disabling the automatic final heap dump (which
1303*1208bc7eSAndroid Build Coastguard Worker        also disables leak reporting, if enabled).  The default prefix is
1304*1208bc7eSAndroid Build Coastguard Worker        <filename>jeprof</filename>.</para></listitem>
1305*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1306*1208bc7eSAndroid Build Coastguard Worker
1307*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_active">
1308*1208bc7eSAndroid Build Coastguard Worker        <term>
1309*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_active</mallctl>
1310*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1311*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1312*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1313*1208bc7eSAndroid Build Coastguard Worker        </term>
1314*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Profiling activated/deactivated.  This is a secondary
1315*1208bc7eSAndroid Build Coastguard Worker        control mechanism that makes it possible to start the application with
1316*1208bc7eSAndroid Build Coastguard Worker        profiling enabled (see the <link
1317*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option) but
1318*1208bc7eSAndroid Build Coastguard Worker        inactive, then toggle profiling at any time during program execution
1319*1208bc7eSAndroid Build Coastguard Worker        with the <link
1320*1208bc7eSAndroid Build Coastguard Worker        linkend="prof.active"><mallctl>prof.active</mallctl></link> mallctl.
1321*1208bc7eSAndroid Build Coastguard Worker        This option is enabled by default.</para></listitem>
1322*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1323*1208bc7eSAndroid Build Coastguard Worker
1324*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_thread_active_init">
1325*1208bc7eSAndroid Build Coastguard Worker        <term>
1326*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_thread_active_init</mallctl>
1327*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1328*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1329*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1330*1208bc7eSAndroid Build Coastguard Worker        </term>
1331*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Initial setting for <link
1332*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link>
1333*1208bc7eSAndroid Build Coastguard Worker        in newly created threads.  The initial setting for newly created threads
1334*1208bc7eSAndroid Build Coastguard Worker        can also be changed during execution via the <link
1335*1208bc7eSAndroid Build Coastguard Worker        linkend="prof.thread_active_init"><mallctl>prof.thread_active_init</mallctl></link>
1336*1208bc7eSAndroid Build Coastguard Worker        mallctl.  This option is enabled by default.</para></listitem>
1337*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1338*1208bc7eSAndroid Build Coastguard Worker
1339*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.lg_prof_sample">
1340*1208bc7eSAndroid Build Coastguard Worker        <term>
1341*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.lg_prof_sample</mallctl>
1342*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
1343*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1344*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1345*1208bc7eSAndroid Build Coastguard Worker        </term>
1346*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Average interval (log base 2) between allocation
1347*1208bc7eSAndroid Build Coastguard Worker        samples, as measured in bytes of allocation activity.  Increasing the
1348*1208bc7eSAndroid Build Coastguard Worker        sampling interval decreases profile fidelity, but also decreases the
1349*1208bc7eSAndroid Build Coastguard Worker        computational overhead.  The default sample interval is 512 KiB (2^19
1350*1208bc7eSAndroid Build Coastguard Worker        B).</para></listitem>
1351*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1352*1208bc7eSAndroid Build Coastguard Worker
1353*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_accum">
1354*1208bc7eSAndroid Build Coastguard Worker        <term>
1355*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_accum</mallctl>
1356*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1357*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1358*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1359*1208bc7eSAndroid Build Coastguard Worker        </term>
1360*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Reporting of cumulative object/byte counts in profile
1361*1208bc7eSAndroid Build Coastguard Worker        dumps enabled/disabled.  If this option is enabled, every unique
1362*1208bc7eSAndroid Build Coastguard Worker        backtrace must be stored for the duration of execution.  Depending on
1363*1208bc7eSAndroid Build Coastguard Worker        the application, this can impose a large memory overhead, and the
1364*1208bc7eSAndroid Build Coastguard Worker        cumulative counts are not always of interest.  This option is disabled
1365*1208bc7eSAndroid Build Coastguard Worker        by default.</para></listitem>
1366*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1367*1208bc7eSAndroid Build Coastguard Worker
1368*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.lg_prof_interval">
1369*1208bc7eSAndroid Build Coastguard Worker        <term>
1370*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.lg_prof_interval</mallctl>
1371*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
1372*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1373*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1374*1208bc7eSAndroid Build Coastguard Worker        </term>
1375*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Average interval (log base 2) between memory profile
1376*1208bc7eSAndroid Build Coastguard Worker        dumps, as measured in bytes of allocation activity.  The actual
1377*1208bc7eSAndroid Build Coastguard Worker        interval between dumps may be sporadic because decentralized allocation
1378*1208bc7eSAndroid Build Coastguard Worker        counters are used to avoid synchronization bottlenecks.  Profiles are
1379*1208bc7eSAndroid Build Coastguard Worker        dumped to files named according to the pattern
1380*1208bc7eSAndroid Build Coastguard Worker        <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.i&lt;iseq&gt;.heap</filename>,
1381*1208bc7eSAndroid Build Coastguard Worker        where <literal>&lt;prefix&gt;</literal> is controlled by the
1382*1208bc7eSAndroid Build Coastguard Worker        <link
1383*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
1384*1208bc7eSAndroid Build Coastguard Worker        option.  By default, interval-triggered profile dumping is disabled
1385*1208bc7eSAndroid Build Coastguard Worker        (encoded as -1).
1386*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1387*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1388*1208bc7eSAndroid Build Coastguard Worker
1389*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_gdump">
1390*1208bc7eSAndroid Build Coastguard Worker        <term>
1391*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_gdump</mallctl>
1392*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1393*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1394*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1395*1208bc7eSAndroid Build Coastguard Worker        </term>
1396*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Set the initial state of <link
1397*1208bc7eSAndroid Build Coastguard Worker        linkend="prof.gdump"><mallctl>prof.gdump</mallctl></link>, which when
1398*1208bc7eSAndroid Build Coastguard Worker        enabled triggers a memory profile dump every time the total virtual
1399*1208bc7eSAndroid Build Coastguard Worker        memory exceeds the previous maximum.  This option is disabled by
1400*1208bc7eSAndroid Build Coastguard Worker        default.</para></listitem>
1401*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1402*1208bc7eSAndroid Build Coastguard Worker
1403*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_final">
1404*1208bc7eSAndroid Build Coastguard Worker        <term>
1405*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_final</mallctl>
1406*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1407*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1408*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1409*1208bc7eSAndroid Build Coastguard Worker        </term>
1410*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Use an
1411*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>atexit</refentrytitle>
1412*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry> function to dump final memory
1413*1208bc7eSAndroid Build Coastguard Worker        usage to a file named according to the pattern
1414*1208bc7eSAndroid Build Coastguard Worker        <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</filename>,
1415*1208bc7eSAndroid Build Coastguard Worker        where <literal>&lt;prefix&gt;</literal> is controlled by the <link
1416*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
1417*1208bc7eSAndroid Build Coastguard Worker        option.  Note that <function>atexit()</function> may allocate
1418*1208bc7eSAndroid Build Coastguard Worker        memory during application initialization and then deadlock internally
1419*1208bc7eSAndroid Build Coastguard Worker        when jemalloc in turn calls <function>atexit()</function>, so
1420*1208bc7eSAndroid Build Coastguard Worker        this option is not universally usable (though the application can
1421*1208bc7eSAndroid Build Coastguard Worker        register its own <function>atexit()</function> function with
1422*1208bc7eSAndroid Build Coastguard Worker        equivalent functionality).  This option is disabled by
1423*1208bc7eSAndroid Build Coastguard Worker        default.</para></listitem>
1424*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1425*1208bc7eSAndroid Build Coastguard Worker
1426*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="opt.prof_leak">
1427*1208bc7eSAndroid Build Coastguard Worker        <term>
1428*1208bc7eSAndroid Build Coastguard Worker          <mallctl>opt.prof_leak</mallctl>
1429*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1430*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1431*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1432*1208bc7eSAndroid Build Coastguard Worker        </term>
1433*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Leak reporting enabled/disabled.  If enabled, use an
1434*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>atexit</refentrytitle>
1435*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry> function to report memory leaks
1436*1208bc7eSAndroid Build Coastguard Worker        detected by allocation sampling.  See the
1437*1208bc7eSAndroid Build Coastguard Worker        <link linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option for
1438*1208bc7eSAndroid Build Coastguard Worker        information on analyzing heap profile output.  This option is disabled
1439*1208bc7eSAndroid Build Coastguard Worker        by default.</para></listitem>
1440*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1441*1208bc7eSAndroid Build Coastguard Worker
1442*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.arena">
1443*1208bc7eSAndroid Build Coastguard Worker        <term>
1444*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.arena</mallctl>
1445*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
1446*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1447*1208bc7eSAndroid Build Coastguard Worker        </term>
1448*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get or set the arena associated with the calling
1449*1208bc7eSAndroid Build Coastguard Worker        thread.  If the specified arena was not initialized beforehand (see the
1450*1208bc7eSAndroid Build Coastguard Worker        <link
1451*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.initialized"><mallctl>arena.i.initialized</mallctl></link>
1452*1208bc7eSAndroid Build Coastguard Worker        mallctl), it will be automatically initialized as a side effect of
1453*1208bc7eSAndroid Build Coastguard Worker        calling this interface.</para></listitem>
1454*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1455*1208bc7eSAndroid Build Coastguard Worker
1456*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.allocated">
1457*1208bc7eSAndroid Build Coastguard Worker        <term>
1458*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.allocated</mallctl>
1459*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
1460*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1461*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
1462*1208bc7eSAndroid Build Coastguard Worker        </term>
1463*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get the total number of bytes ever allocated by the
1464*1208bc7eSAndroid Build Coastguard Worker        calling thread.  This counter has the potential to wrap around; it is
1465*1208bc7eSAndroid Build Coastguard Worker        up to the application to appropriately interpret the counter in such
1466*1208bc7eSAndroid Build Coastguard Worker        cases.</para></listitem>
1467*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1468*1208bc7eSAndroid Build Coastguard Worker
1469*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.allocatedp">
1470*1208bc7eSAndroid Build Coastguard Worker        <term>
1471*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.allocatedp</mallctl>
1472*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t *</type>)
1473*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1474*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
1475*1208bc7eSAndroid Build Coastguard Worker        </term>
1476*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get a pointer to the the value that is returned by the
1477*1208bc7eSAndroid Build Coastguard Worker        <link
1478*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link>
1479*1208bc7eSAndroid Build Coastguard Worker        mallctl.  This is useful for avoiding the overhead of repeated
1480*1208bc7eSAndroid Build Coastguard Worker        <function>mallctl*()</function> calls.</para></listitem>
1481*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1482*1208bc7eSAndroid Build Coastguard Worker
1483*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.deallocated">
1484*1208bc7eSAndroid Build Coastguard Worker        <term>
1485*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.deallocated</mallctl>
1486*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
1487*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1488*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
1489*1208bc7eSAndroid Build Coastguard Worker        </term>
1490*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get the total number of bytes ever deallocated by the
1491*1208bc7eSAndroid Build Coastguard Worker        calling thread.  This counter has the potential to wrap around; it is
1492*1208bc7eSAndroid Build Coastguard Worker        up to the application to appropriately interpret the counter in such
1493*1208bc7eSAndroid Build Coastguard Worker        cases.</para></listitem>
1494*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1495*1208bc7eSAndroid Build Coastguard Worker
1496*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.deallocatedp">
1497*1208bc7eSAndroid Build Coastguard Worker        <term>
1498*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.deallocatedp</mallctl>
1499*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t *</type>)
1500*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1501*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
1502*1208bc7eSAndroid Build Coastguard Worker        </term>
1503*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get a pointer to the the value that is returned by the
1504*1208bc7eSAndroid Build Coastguard Worker        <link
1505*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link>
1506*1208bc7eSAndroid Build Coastguard Worker        mallctl.  This is useful for avoiding the overhead of repeated
1507*1208bc7eSAndroid Build Coastguard Worker        <function>mallctl*()</function> calls.</para></listitem>
1508*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1509*1208bc7eSAndroid Build Coastguard Worker
1510*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.tcache.enabled">
1511*1208bc7eSAndroid Build Coastguard Worker        <term>
1512*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.tcache.enabled</mallctl>
1513*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1514*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1515*1208bc7eSAndroid Build Coastguard Worker        </term>
1516*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Enable/disable calling thread's tcache.  The tcache is
1517*1208bc7eSAndroid Build Coastguard Worker        implicitly flushed as a side effect of becoming
1518*1208bc7eSAndroid Build Coastguard Worker        disabled (see <link
1519*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>).
1520*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1521*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1522*1208bc7eSAndroid Build Coastguard Worker
1523*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.tcache.flush">
1524*1208bc7eSAndroid Build Coastguard Worker        <term>
1525*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.tcache.flush</mallctl>
1526*1208bc7eSAndroid Build Coastguard Worker          (<type>void</type>)
1527*1208bc7eSAndroid Build Coastguard Worker          <literal>--</literal>
1528*1208bc7eSAndroid Build Coastguard Worker        </term>
1529*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Flush calling thread's thread-specific cache (tcache).
1530*1208bc7eSAndroid Build Coastguard Worker        This interface releases all cached objects and internal data structures
1531*1208bc7eSAndroid Build Coastguard Worker        associated with the calling thread's tcache.  Ordinarily, this interface
1532*1208bc7eSAndroid Build Coastguard Worker        need not be called, since automatic periodic incremental garbage
1533*1208bc7eSAndroid Build Coastguard Worker        collection occurs, and the thread cache is automatically discarded when
1534*1208bc7eSAndroid Build Coastguard Worker        a thread exits.  However, garbage collection is triggered by allocation
1535*1208bc7eSAndroid Build Coastguard Worker        activity, so it is possible for a thread that stops
1536*1208bc7eSAndroid Build Coastguard Worker        allocating/deallocating to retain its cache indefinitely, in which case
1537*1208bc7eSAndroid Build Coastguard Worker        the developer may find manual flushing useful.</para></listitem>
1538*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1539*1208bc7eSAndroid Build Coastguard Worker
1540*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.prof.name">
1541*1208bc7eSAndroid Build Coastguard Worker        <term>
1542*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.prof.name</mallctl>
1543*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
1544*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal> or
1545*1208bc7eSAndroid Build Coastguard Worker          <literal>-w</literal>
1546*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1547*1208bc7eSAndroid Build Coastguard Worker        </term>
1548*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get/set the descriptive name associated with the calling
1549*1208bc7eSAndroid Build Coastguard Worker        thread in memory profile dumps.  An internal copy of the name string is
1550*1208bc7eSAndroid Build Coastguard Worker        created, so the input string need not be maintained after this interface
1551*1208bc7eSAndroid Build Coastguard Worker        completes execution.  The output string of this interface should be
1552*1208bc7eSAndroid Build Coastguard Worker        copied for non-ephemeral uses, because multiple implementation details
1553*1208bc7eSAndroid Build Coastguard Worker        can cause asynchronous string deallocation.  Furthermore, each
1554*1208bc7eSAndroid Build Coastguard Worker        invocation of this interface can only read or write; simultaneous
1555*1208bc7eSAndroid Build Coastguard Worker        read/write is not supported due to string lifetime limitations.  The
1556*1208bc7eSAndroid Build Coastguard Worker        name string must be nil-terminated and comprised only of characters in
1557*1208bc7eSAndroid Build Coastguard Worker        the sets recognized
1558*1208bc7eSAndroid Build Coastguard Worker        by <citerefentry><refentrytitle>isgraph</refentrytitle>
1559*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry> and
1560*1208bc7eSAndroid Build Coastguard Worker        <citerefentry><refentrytitle>isblank</refentrytitle>
1561*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>3</manvolnum></citerefentry>.</para></listitem>
1562*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1563*1208bc7eSAndroid Build Coastguard Worker
1564*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="thread.prof.active">
1565*1208bc7eSAndroid Build Coastguard Worker        <term>
1566*1208bc7eSAndroid Build Coastguard Worker          <mallctl>thread.prof.active</mallctl>
1567*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1568*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1569*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
1570*1208bc7eSAndroid Build Coastguard Worker        </term>
1571*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Control whether sampling is currently active for the
1572*1208bc7eSAndroid Build Coastguard Worker        calling thread.  This is an activation mechanism in addition to <link
1573*1208bc7eSAndroid Build Coastguard Worker        linkend="prof.active"><mallctl>prof.active</mallctl></link>; both must
1574*1208bc7eSAndroid Build Coastguard Worker        be active for the calling thread to sample.  This flag is enabled by
1575*1208bc7eSAndroid Build Coastguard Worker        default.</para></listitem>
1576*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1577*1208bc7eSAndroid Build Coastguard Worker
1578*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="tcache.create">
1579*1208bc7eSAndroid Build Coastguard Worker        <term>
1580*1208bc7eSAndroid Build Coastguard Worker          <mallctl>tcache.create</mallctl>
1581*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
1582*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1583*1208bc7eSAndroid Build Coastguard Worker        </term>
1584*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Create an explicit thread-specific cache (tcache) and
1585*1208bc7eSAndroid Build Coastguard Worker        return an identifier that can be passed to the <link
1586*1208bc7eSAndroid Build Coastguard Worker        linkend="MALLOCX_TCACHE"><constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant></link>
1587*1208bc7eSAndroid Build Coastguard Worker        macro to explicitly use the specified cache rather than the
1588*1208bc7eSAndroid Build Coastguard Worker        automatically managed one that is used by default.  Each explicit cache
1589*1208bc7eSAndroid Build Coastguard Worker        can be used by only one thread at a time; the application must assure
1590*1208bc7eSAndroid Build Coastguard Worker        that this constraint holds.
1591*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1592*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1593*1208bc7eSAndroid Build Coastguard Worker
1594*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="tcache.flush">
1595*1208bc7eSAndroid Build Coastguard Worker        <term>
1596*1208bc7eSAndroid Build Coastguard Worker          <mallctl>tcache.flush</mallctl>
1597*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
1598*1208bc7eSAndroid Build Coastguard Worker          <literal>-w</literal>
1599*1208bc7eSAndroid Build Coastguard Worker        </term>
1600*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Flush the specified thread-specific cache (tcache).  The
1601*1208bc7eSAndroid Build Coastguard Worker        same considerations apply to this interface as to <link
1602*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>,
1603*1208bc7eSAndroid Build Coastguard Worker        except that the tcache will never be automatically discarded.
1604*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1605*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1606*1208bc7eSAndroid Build Coastguard Worker
1607*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="tcache.destroy">
1608*1208bc7eSAndroid Build Coastguard Worker        <term>
1609*1208bc7eSAndroid Build Coastguard Worker          <mallctl>tcache.destroy</mallctl>
1610*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
1611*1208bc7eSAndroid Build Coastguard Worker          <literal>-w</literal>
1612*1208bc7eSAndroid Build Coastguard Worker        </term>
1613*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Flush the specified thread-specific cache (tcache) and
1614*1208bc7eSAndroid Build Coastguard Worker        make the identifier available for use during a future tcache creation.
1615*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1616*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1617*1208bc7eSAndroid Build Coastguard Worker
1618*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.initialized">
1619*1208bc7eSAndroid Build Coastguard Worker        <term>
1620*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.initialized</mallctl>
1621*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
1622*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1623*1208bc7eSAndroid Build Coastguard Worker        </term>
1624*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get whether the specified arena's statistics are
1625*1208bc7eSAndroid Build Coastguard Worker        initialized (i.e. the arena was initialized prior to the current epoch).
1626*1208bc7eSAndroid Build Coastguard Worker        This interface can also be nominally used to query whether the merged
1627*1208bc7eSAndroid Build Coastguard Worker        statistics corresponding to <constant>MALLCTL_ARENAS_ALL</constant> are
1628*1208bc7eSAndroid Build Coastguard Worker        initialized (always true).</para></listitem>
1629*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1630*1208bc7eSAndroid Build Coastguard Worker
1631*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.decay">
1632*1208bc7eSAndroid Build Coastguard Worker        <term>
1633*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.decay</mallctl>
1634*1208bc7eSAndroid Build Coastguard Worker          (<type>void</type>)
1635*1208bc7eSAndroid Build Coastguard Worker          <literal>--</literal>
1636*1208bc7eSAndroid Build Coastguard Worker        </term>
1637*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Trigger decay-based purging of unused dirty/muzzy pages
1638*1208bc7eSAndroid Build Coastguard Worker        for arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals
1639*1208bc7eSAndroid Build Coastguard Worker        <constant>MALLCTL_ARENAS_ALL</constant>.  The proportion of unused
1640*1208bc7eSAndroid Build Coastguard Worker        dirty/muzzy pages to be purged depends on the current time; see <link
1641*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link>
1642*1208bc7eSAndroid Build Coastguard Worker        and <link
1643*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.muzzy_decay_ms"><mallctl>opt.muzy_decay_ms</mallctl></link>
1644*1208bc7eSAndroid Build Coastguard Worker        for details.</para></listitem>
1645*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1646*1208bc7eSAndroid Build Coastguard Worker
1647*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.purge">
1648*1208bc7eSAndroid Build Coastguard Worker        <term>
1649*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.purge</mallctl>
1650*1208bc7eSAndroid Build Coastguard Worker          (<type>void</type>)
1651*1208bc7eSAndroid Build Coastguard Worker          <literal>--</literal>
1652*1208bc7eSAndroid Build Coastguard Worker        </term>
1653*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Purge all unused dirty pages for arena &lt;i&gt;, or for
1654*1208bc7eSAndroid Build Coastguard Worker        all arenas if &lt;i&gt; equals <constant>MALLCTL_ARENAS_ALL</constant>.
1655*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
1656*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1657*1208bc7eSAndroid Build Coastguard Worker
1658*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.reset">
1659*1208bc7eSAndroid Build Coastguard Worker        <term>
1660*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.reset</mallctl>
1661*1208bc7eSAndroid Build Coastguard Worker          (<type>void</type>)
1662*1208bc7eSAndroid Build Coastguard Worker          <literal>--</literal>
1663*1208bc7eSAndroid Build Coastguard Worker        </term>
1664*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Discard all of the arena's extant allocations.  This
1665*1208bc7eSAndroid Build Coastguard Worker        interface can only be used with arenas explicitly created via <link
1666*1208bc7eSAndroid Build Coastguard Worker        linkend="arenas.create"><mallctl>arenas.create</mallctl></link>.  None
1667*1208bc7eSAndroid Build Coastguard Worker        of the arena's discarded/cached allocations may accessed afterward.  As
1668*1208bc7eSAndroid Build Coastguard Worker        part of this requirement, all thread caches which were used to
1669*1208bc7eSAndroid Build Coastguard Worker        allocate/deallocate in conjunction with the arena must be flushed
1670*1208bc7eSAndroid Build Coastguard Worker        beforehand.</para></listitem>
1671*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1672*1208bc7eSAndroid Build Coastguard Worker
1673*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.destroy">
1674*1208bc7eSAndroid Build Coastguard Worker        <term>
1675*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.destroy</mallctl>
1676*1208bc7eSAndroid Build Coastguard Worker          (<type>void</type>)
1677*1208bc7eSAndroid Build Coastguard Worker          <literal>--</literal>
1678*1208bc7eSAndroid Build Coastguard Worker        </term>
1679*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Destroy the arena.  Discard all of the arena's extant
1680*1208bc7eSAndroid Build Coastguard Worker        allocations using the same mechanism as for <link
1681*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.reset"><mallctl>arena.&lt;i&gt;.reset</mallctl></link>
1682*1208bc7eSAndroid Build Coastguard Worker        (with all the same constraints and side effects), merge the arena stats
1683*1208bc7eSAndroid Build Coastguard Worker        into those accessible at arena index
1684*1208bc7eSAndroid Build Coastguard Worker        <constant>MALLCTL_ARENAS_DESTROYED</constant>, and then completely
1685*1208bc7eSAndroid Build Coastguard Worker        discard all metadata associated with the arena.  Future calls to <link
1686*1208bc7eSAndroid Build Coastguard Worker        linkend="arenas.create"><mallctl>arenas.create</mallctl></link> may
1687*1208bc7eSAndroid Build Coastguard Worker        recycle the arena index.  Destruction will fail if any threads are
1688*1208bc7eSAndroid Build Coastguard Worker        currently associated with the arena as a result of calls to <link
1689*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.arena"><mallctl>thread.arena</mallctl></link>.</para></listitem>
1690*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1691*1208bc7eSAndroid Build Coastguard Worker
1692*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.dss">
1693*1208bc7eSAndroid Build Coastguard Worker        <term>
1694*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.dss</mallctl>
1695*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
1696*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1697*1208bc7eSAndroid Build Coastguard Worker        </term>
1698*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Set the precedence of dss allocation as related to mmap
1699*1208bc7eSAndroid Build Coastguard Worker        allocation for arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals
1700*1208bc7eSAndroid Build Coastguard Worker        <constant>MALLCTL_ARENAS_ALL</constant>.  See <link
1701*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for supported
1702*1208bc7eSAndroid Build Coastguard Worker        settings.</para></listitem>
1703*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1704*1208bc7eSAndroid Build Coastguard Worker
1705*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.dirty_decay_ms">
1706*1208bc7eSAndroid Build Coastguard Worker        <term>
1707*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.dirty_decay_ms</mallctl>
1708*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
1709*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1710*1208bc7eSAndroid Build Coastguard Worker        </term>
1711*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current per-arena approximate time in milliseconds from
1712*1208bc7eSAndroid Build Coastguard Worker        the creation of a set of unused dirty pages until an equivalent set of
1713*1208bc7eSAndroid Build Coastguard Worker        unused dirty pages is purged and/or reused.  Each time this interface is
1714*1208bc7eSAndroid Build Coastguard Worker        set, all currently unused dirty pages are considered to have fully
1715*1208bc7eSAndroid Build Coastguard Worker        decayed, which causes immediate purging of all unused dirty pages unless
1716*1208bc7eSAndroid Build Coastguard Worker        the decay time is set to -1 (i.e. purging disabled).  See <link
1717*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link>
1718*1208bc7eSAndroid Build Coastguard Worker        for additional information.</para></listitem>
1719*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1720*1208bc7eSAndroid Build Coastguard Worker
1721*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.muzzy_decay_ms">
1722*1208bc7eSAndroid Build Coastguard Worker        <term>
1723*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.muzzy_decay_ms</mallctl>
1724*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
1725*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1726*1208bc7eSAndroid Build Coastguard Worker        </term>
1727*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current per-arena approximate time in milliseconds from
1728*1208bc7eSAndroid Build Coastguard Worker        the creation of a set of unused muzzy pages until an equivalent set of
1729*1208bc7eSAndroid Build Coastguard Worker        unused muzzy pages is purged and/or reused.  Each time this interface is
1730*1208bc7eSAndroid Build Coastguard Worker        set, all currently unused muzzy pages are considered to have fully
1731*1208bc7eSAndroid Build Coastguard Worker        decayed, which causes immediate purging of all unused muzzy pages unless
1732*1208bc7eSAndroid Build Coastguard Worker        the decay time is set to -1 (i.e. purging disabled).  See <link
1733*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
1734*1208bc7eSAndroid Build Coastguard Worker        for additional information.</para></listitem>
1735*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1736*1208bc7eSAndroid Build Coastguard Worker
1737*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.retain_grow_limit">
1738*1208bc7eSAndroid Build Coastguard Worker        <term>
1739*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.retain_grow_limit</mallctl>
1740*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
1741*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1742*1208bc7eSAndroid Build Coastguard Worker        </term>
1743*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum size to grow retained region (only relevant when
1744*1208bc7eSAndroid Build Coastguard Worker        <link linkend="opt.retain"><mallctl>opt.retain</mallctl></link> is
1745*1208bc7eSAndroid Build Coastguard Worker        enabled).  This controls the maximum increment to expand virtual memory,
1746*1208bc7eSAndroid Build Coastguard Worker        or allocation through <link
1747*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.extent_hooks"><mallctl>arena.&lt;i&gt;extent_hooks</mallctl></link>.
1748*1208bc7eSAndroid Build Coastguard Worker        In particular, if customized extent hooks reserve physical memory
1749*1208bc7eSAndroid Build Coastguard Worker        (e.g. 1G huge pages), this is useful to control the allocation hook's
1750*1208bc7eSAndroid Build Coastguard Worker        input size.  The default is no limit.</para></listitem>
1751*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1752*1208bc7eSAndroid Build Coastguard Worker
1753*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arena.i.extent_hooks">
1754*1208bc7eSAndroid Build Coastguard Worker        <term>
1755*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arena.&lt;i&gt;.extent_hooks</mallctl>
1756*1208bc7eSAndroid Build Coastguard Worker          (<type>extent_hooks_t *</type>)
1757*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
1758*1208bc7eSAndroid Build Coastguard Worker        </term>
1759*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get or set the extent management hook functions for
1760*1208bc7eSAndroid Build Coastguard Worker        arena &lt;i&gt;.  The functions must be capable of operating on all
1761*1208bc7eSAndroid Build Coastguard Worker        extant extents associated with arena &lt;i&gt;, usually by passing
1762*1208bc7eSAndroid Build Coastguard Worker        unknown extents to the replaced functions.  In practice, it is feasible
1763*1208bc7eSAndroid Build Coastguard Worker        to control allocation for arenas explicitly created via <link
1764*1208bc7eSAndroid Build Coastguard Worker        linkend="arenas.create"><mallctl>arenas.create</mallctl></link> such
1765*1208bc7eSAndroid Build Coastguard Worker        that all extents originate from an application-supplied extent allocator
1766*1208bc7eSAndroid Build Coastguard Worker        (by specifying the custom extent hook functions during arena creation),
1767*1208bc7eSAndroid Build Coastguard Worker        but the automatically created arenas will have already created extents
1768*1208bc7eSAndroid Build Coastguard Worker        prior to the application having an opportunity to take over extent
1769*1208bc7eSAndroid Build Coastguard Worker        allocation.</para>
1770*1208bc7eSAndroid Build Coastguard Worker
1771*1208bc7eSAndroid Build Coastguard Worker        <programlisting language="C"><![CDATA[
1772*1208bc7eSAndroid Build Coastguard Workertypedef extent_hooks_s extent_hooks_t;
1773*1208bc7eSAndroid Build Coastguard Workerstruct extent_hooks_s {
1774*1208bc7eSAndroid Build Coastguard Worker	extent_alloc_t		*alloc;
1775*1208bc7eSAndroid Build Coastguard Worker	extent_dalloc_t		*dalloc;
1776*1208bc7eSAndroid Build Coastguard Worker	extent_destroy_t	*destroy;
1777*1208bc7eSAndroid Build Coastguard Worker	extent_commit_t		*commit;
1778*1208bc7eSAndroid Build Coastguard Worker	extent_decommit_t	*decommit;
1779*1208bc7eSAndroid Build Coastguard Worker	extent_purge_t		*purge_lazy;
1780*1208bc7eSAndroid Build Coastguard Worker	extent_purge_t		*purge_forced;
1781*1208bc7eSAndroid Build Coastguard Worker	extent_split_t		*split;
1782*1208bc7eSAndroid Build Coastguard Worker	extent_merge_t		*merge;
1783*1208bc7eSAndroid Build Coastguard Worker};]]></programlisting>
1784*1208bc7eSAndroid Build Coastguard Worker        <para>The <type>extent_hooks_t</type> structure comprises function
1785*1208bc7eSAndroid Build Coastguard Worker        pointers which are described individually below.  jemalloc uses these
1786*1208bc7eSAndroid Build Coastguard Worker        functions to manage extent lifetime, which starts off with allocation of
1787*1208bc7eSAndroid Build Coastguard Worker        mapped committed memory, in the simplest case followed by deallocation.
1788*1208bc7eSAndroid Build Coastguard Worker        However, there are performance and platform reasons to retain extents
1789*1208bc7eSAndroid Build Coastguard Worker        for later reuse.  Cleanup attempts cascade from deallocation to decommit
1790*1208bc7eSAndroid Build Coastguard Worker        to forced purging to lazy purging, which gives the extent management
1791*1208bc7eSAndroid Build Coastguard Worker        functions opportunities to reject the most permanent cleanup operations
1792*1208bc7eSAndroid Build Coastguard Worker        in favor of less permanent (and often less costly) operations.  All
1793*1208bc7eSAndroid Build Coastguard Worker        operations except allocation can be universally opted out of by setting
1794*1208bc7eSAndroid Build Coastguard Worker        the hook pointers to <constant>NULL</constant>, or selectively opted out
1795*1208bc7eSAndroid Build Coastguard Worker        of by returning failure.  Note that once the extent hook is set, the
1796*1208bc7eSAndroid Build Coastguard Worker        structure is accessed directly by the associated arenas, so it must
1797*1208bc7eSAndroid Build Coastguard Worker        remain valid for the entire lifetime of the arenas.</para>
1798*1208bc7eSAndroid Build Coastguard Worker
1799*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1800*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef void *<function>(extent_alloc_t)</function></funcdef>
1801*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1802*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>new_addr</parameter></paramdef>
1803*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1804*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>alignment</parameter></paramdef>
1805*1208bc7eSAndroid Build Coastguard Worker          <paramdef>bool *<parameter>zero</parameter></paramdef>
1806*1208bc7eSAndroid Build Coastguard Worker          <paramdef>bool *<parameter>commit</parameter></paramdef>
1807*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1808*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1809*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1810*1208bc7eSAndroid Build Coastguard Worker        <para>An extent allocation function conforms to the
1811*1208bc7eSAndroid Build Coastguard Worker        <type>extent_alloc_t</type> type and upon success returns a pointer to
1812*1208bc7eSAndroid Build Coastguard Worker        <parameter>size</parameter> bytes of mapped memory on behalf of arena
1813*1208bc7eSAndroid Build Coastguard Worker        <parameter>arena_ind</parameter> such that the extent's base address is
1814*1208bc7eSAndroid Build Coastguard Worker        a multiple of <parameter>alignment</parameter>, as well as setting
1815*1208bc7eSAndroid Build Coastguard Worker        <parameter>*zero</parameter> to indicate whether the extent is zeroed
1816*1208bc7eSAndroid Build Coastguard Worker        and <parameter>*commit</parameter> to indicate whether the extent is
1817*1208bc7eSAndroid Build Coastguard Worker        committed.  Upon error the function returns <constant>NULL</constant>
1818*1208bc7eSAndroid Build Coastguard Worker        and leaves <parameter>*zero</parameter> and
1819*1208bc7eSAndroid Build Coastguard Worker        <parameter>*commit</parameter> unmodified.  The
1820*1208bc7eSAndroid Build Coastguard Worker        <parameter>size</parameter> parameter is always a multiple of the page
1821*1208bc7eSAndroid Build Coastguard Worker        size.  The <parameter>alignment</parameter> parameter is always a power
1822*1208bc7eSAndroid Build Coastguard Worker        of two at least as large as the page size.  Zeroing is mandatory if
1823*1208bc7eSAndroid Build Coastguard Worker        <parameter>*zero</parameter> is true upon function entry.  Committing is
1824*1208bc7eSAndroid Build Coastguard Worker        mandatory if <parameter>*commit</parameter> is true upon function entry.
1825*1208bc7eSAndroid Build Coastguard Worker        If <parameter>new_addr</parameter> is not <constant>NULL</constant>, the
1826*1208bc7eSAndroid Build Coastguard Worker        returned pointer must be <parameter>new_addr</parameter> on success or
1827*1208bc7eSAndroid Build Coastguard Worker        <constant>NULL</constant> on error.  Committed memory may be committed
1828*1208bc7eSAndroid Build Coastguard Worker        in absolute terms as on a system that does not overcommit, or in
1829*1208bc7eSAndroid Build Coastguard Worker        implicit terms as on a system that overcommits and satisfies physical
1830*1208bc7eSAndroid Build Coastguard Worker        memory needs on demand via soft page faults.  Note that replacing the
1831*1208bc7eSAndroid Build Coastguard Worker        default extent allocation function makes the arena's <link
1832*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.dss"><mallctl>arena.&lt;i&gt;.dss</mallctl></link>
1833*1208bc7eSAndroid Build Coastguard Worker        setting irrelevant.</para>
1834*1208bc7eSAndroid Build Coastguard Worker
1835*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1836*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef bool <function>(extent_dalloc_t)</function></funcdef>
1837*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1838*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr</parameter></paramdef>
1839*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1840*1208bc7eSAndroid Build Coastguard Worker          <paramdef>bool <parameter>committed</parameter></paramdef>
1841*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1842*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1843*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1844*1208bc7eSAndroid Build Coastguard Worker        <para>
1845*1208bc7eSAndroid Build Coastguard Worker        An extent deallocation function conforms to the
1846*1208bc7eSAndroid Build Coastguard Worker        <type>extent_dalloc_t</type> type and deallocates an extent at given
1847*1208bc7eSAndroid Build Coastguard Worker        <parameter>addr</parameter> and <parameter>size</parameter> with
1848*1208bc7eSAndroid Build Coastguard Worker        <parameter>committed</parameter>/decommited memory as indicated, on
1849*1208bc7eSAndroid Build Coastguard Worker        behalf of arena <parameter>arena_ind</parameter>, returning false upon
1850*1208bc7eSAndroid Build Coastguard Worker        success.  If the function returns true, this indicates opt-out from
1851*1208bc7eSAndroid Build Coastguard Worker        deallocation; the virtual memory mapping associated with the extent
1852*1208bc7eSAndroid Build Coastguard Worker        remains mapped, in the same commit state, and available for future use,
1853*1208bc7eSAndroid Build Coastguard Worker        in which case it will be automatically retained for later reuse.</para>
1854*1208bc7eSAndroid Build Coastguard Worker
1855*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1856*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef void <function>(extent_destroy_t)</function></funcdef>
1857*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1858*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr</parameter></paramdef>
1859*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1860*1208bc7eSAndroid Build Coastguard Worker          <paramdef>bool <parameter>committed</parameter></paramdef>
1861*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1862*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1863*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1864*1208bc7eSAndroid Build Coastguard Worker        <para>
1865*1208bc7eSAndroid Build Coastguard Worker        An extent destruction function conforms to the
1866*1208bc7eSAndroid Build Coastguard Worker        <type>extent_destroy_t</type> type and unconditionally destroys an
1867*1208bc7eSAndroid Build Coastguard Worker        extent at given <parameter>addr</parameter> and
1868*1208bc7eSAndroid Build Coastguard Worker        <parameter>size</parameter> with
1869*1208bc7eSAndroid Build Coastguard Worker        <parameter>committed</parameter>/decommited memory as indicated, on
1870*1208bc7eSAndroid Build Coastguard Worker        behalf of arena <parameter>arena_ind</parameter>.  This function may be
1871*1208bc7eSAndroid Build Coastguard Worker        called to destroy retained extents during arena destruction (see <link
1872*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.destroy"><mallctl>arena.&lt;i&gt;.destroy</mallctl></link>).</para>
1873*1208bc7eSAndroid Build Coastguard Worker
1874*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1875*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef bool <function>(extent_commit_t)</function></funcdef>
1876*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1877*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr</parameter></paramdef>
1878*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1879*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>offset</parameter></paramdef>
1880*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>length</parameter></paramdef>
1881*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1882*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1883*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1884*1208bc7eSAndroid Build Coastguard Worker        <para>An extent commit function conforms to the
1885*1208bc7eSAndroid Build Coastguard Worker        <type>extent_commit_t</type> type and commits zeroed physical memory to
1886*1208bc7eSAndroid Build Coastguard Worker        back pages within an extent at given <parameter>addr</parameter> and
1887*1208bc7eSAndroid Build Coastguard Worker        <parameter>size</parameter> at <parameter>offset</parameter> bytes,
1888*1208bc7eSAndroid Build Coastguard Worker        extending for <parameter>length</parameter> on behalf of arena
1889*1208bc7eSAndroid Build Coastguard Worker        <parameter>arena_ind</parameter>, returning false upon success.
1890*1208bc7eSAndroid Build Coastguard Worker        Committed memory may be committed in absolute terms as on a system that
1891*1208bc7eSAndroid Build Coastguard Worker        does not overcommit, or in implicit terms as on a system that
1892*1208bc7eSAndroid Build Coastguard Worker        overcommits and satisfies physical memory needs on demand via soft page
1893*1208bc7eSAndroid Build Coastguard Worker        faults. If the function returns true, this indicates insufficient
1894*1208bc7eSAndroid Build Coastguard Worker        physical memory to satisfy the request.</para>
1895*1208bc7eSAndroid Build Coastguard Worker
1896*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1897*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef bool <function>(extent_decommit_t)</function></funcdef>
1898*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1899*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr</parameter></paramdef>
1900*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1901*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>offset</parameter></paramdef>
1902*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>length</parameter></paramdef>
1903*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1904*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1905*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1906*1208bc7eSAndroid Build Coastguard Worker        <para>An extent decommit function conforms to the
1907*1208bc7eSAndroid Build Coastguard Worker        <type>extent_decommit_t</type> type and decommits any physical memory
1908*1208bc7eSAndroid Build Coastguard Worker        that is backing pages within an extent at given
1909*1208bc7eSAndroid Build Coastguard Worker        <parameter>addr</parameter> and <parameter>size</parameter> at
1910*1208bc7eSAndroid Build Coastguard Worker        <parameter>offset</parameter> bytes, extending for
1911*1208bc7eSAndroid Build Coastguard Worker        <parameter>length</parameter> on behalf of arena
1912*1208bc7eSAndroid Build Coastguard Worker        <parameter>arena_ind</parameter>, returning false upon success, in which
1913*1208bc7eSAndroid Build Coastguard Worker        case the pages will be committed via the extent commit function before
1914*1208bc7eSAndroid Build Coastguard Worker        being reused.  If the function returns true, this indicates opt-out from
1915*1208bc7eSAndroid Build Coastguard Worker        decommit; the memory remains committed and available for future use, in
1916*1208bc7eSAndroid Build Coastguard Worker        which case it will be automatically retained for later reuse.</para>
1917*1208bc7eSAndroid Build Coastguard Worker
1918*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1919*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef bool <function>(extent_purge_t)</function></funcdef>
1920*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1921*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr</parameter></paramdef>
1922*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1923*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>offset</parameter></paramdef>
1924*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>length</parameter></paramdef>
1925*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1926*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1927*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1928*1208bc7eSAndroid Build Coastguard Worker        <para>An extent purge function conforms to the
1929*1208bc7eSAndroid Build Coastguard Worker        <type>extent_purge_t</type> type and discards physical pages
1930*1208bc7eSAndroid Build Coastguard Worker        within the virtual memory mapping associated with an extent at given
1931*1208bc7eSAndroid Build Coastguard Worker        <parameter>addr</parameter> and <parameter>size</parameter> at
1932*1208bc7eSAndroid Build Coastguard Worker        <parameter>offset</parameter> bytes, extending for
1933*1208bc7eSAndroid Build Coastguard Worker        <parameter>length</parameter> on behalf of arena
1934*1208bc7eSAndroid Build Coastguard Worker        <parameter>arena_ind</parameter>.  A lazy extent purge function (e.g.
1935*1208bc7eSAndroid Build Coastguard Worker        implemented via
1936*1208bc7eSAndroid Build Coastguard Worker        <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>)
1937*1208bc7eSAndroid Build Coastguard Worker        can delay purging indefinitely and leave the pages within the purged
1938*1208bc7eSAndroid Build Coastguard Worker        virtual memory range in an indeterminite state, whereas a forced extent
1939*1208bc7eSAndroid Build Coastguard Worker        purge function immediately purges, and the pages within the virtual
1940*1208bc7eSAndroid Build Coastguard Worker        memory range will be zero-filled the next time they are accessed.  If
1941*1208bc7eSAndroid Build Coastguard Worker        the function returns true, this indicates failure to purge.</para>
1942*1208bc7eSAndroid Build Coastguard Worker
1943*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1944*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef bool <function>(extent_split_t)</function></funcdef>
1945*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1946*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr</parameter></paramdef>
1947*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size</parameter></paramdef>
1948*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size_a</parameter></paramdef>
1949*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size_b</parameter></paramdef>
1950*1208bc7eSAndroid Build Coastguard Worker          <paramdef>bool <parameter>committed</parameter></paramdef>
1951*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1952*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1953*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1954*1208bc7eSAndroid Build Coastguard Worker        <para>An extent split function conforms to the
1955*1208bc7eSAndroid Build Coastguard Worker        <type>extent_split_t</type> type and optionally splits an extent at
1956*1208bc7eSAndroid Build Coastguard Worker        given <parameter>addr</parameter> and <parameter>size</parameter> into
1957*1208bc7eSAndroid Build Coastguard Worker        two adjacent extents, the first of <parameter>size_a</parameter> bytes,
1958*1208bc7eSAndroid Build Coastguard Worker        and the second of <parameter>size_b</parameter> bytes, operating on
1959*1208bc7eSAndroid Build Coastguard Worker        <parameter>committed</parameter>/decommitted memory as indicated, on
1960*1208bc7eSAndroid Build Coastguard Worker        behalf of arena <parameter>arena_ind</parameter>, returning false upon
1961*1208bc7eSAndroid Build Coastguard Worker        success.  If the function returns true, this indicates that the extent
1962*1208bc7eSAndroid Build Coastguard Worker        remains unsplit and therefore should continue to be operated on as a
1963*1208bc7eSAndroid Build Coastguard Worker        whole.</para>
1964*1208bc7eSAndroid Build Coastguard Worker
1965*1208bc7eSAndroid Build Coastguard Worker        <funcsynopsis><funcprototype>
1966*1208bc7eSAndroid Build Coastguard Worker          <funcdef>typedef bool <function>(extent_merge_t)</function></funcdef>
1967*1208bc7eSAndroid Build Coastguard Worker          <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef>
1968*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr_a</parameter></paramdef>
1969*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size_a</parameter></paramdef>
1970*1208bc7eSAndroid Build Coastguard Worker          <paramdef>void *<parameter>addr_b</parameter></paramdef>
1971*1208bc7eSAndroid Build Coastguard Worker          <paramdef>size_t <parameter>size_b</parameter></paramdef>
1972*1208bc7eSAndroid Build Coastguard Worker          <paramdef>bool <parameter>committed</parameter></paramdef>
1973*1208bc7eSAndroid Build Coastguard Worker          <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
1974*1208bc7eSAndroid Build Coastguard Worker        </funcprototype></funcsynopsis>
1975*1208bc7eSAndroid Build Coastguard Worker        <literallayout></literallayout>
1976*1208bc7eSAndroid Build Coastguard Worker        <para>An extent merge function conforms to the
1977*1208bc7eSAndroid Build Coastguard Worker        <type>extent_merge_t</type> type and optionally merges adjacent extents,
1978*1208bc7eSAndroid Build Coastguard Worker        at given <parameter>addr_a</parameter> and <parameter>size_a</parameter>
1979*1208bc7eSAndroid Build Coastguard Worker        with given <parameter>addr_b</parameter> and
1980*1208bc7eSAndroid Build Coastguard Worker        <parameter>size_b</parameter> into one contiguous extent, operating on
1981*1208bc7eSAndroid Build Coastguard Worker        <parameter>committed</parameter>/decommitted memory as indicated, on
1982*1208bc7eSAndroid Build Coastguard Worker        behalf of arena <parameter>arena_ind</parameter>, returning false upon
1983*1208bc7eSAndroid Build Coastguard Worker        success.  If the function returns true, this indicates that the extents
1984*1208bc7eSAndroid Build Coastguard Worker        remain distinct mappings and therefore should continue to be operated on
1985*1208bc7eSAndroid Build Coastguard Worker        independently.</para>
1986*1208bc7eSAndroid Build Coastguard Worker        </listitem>
1987*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1988*1208bc7eSAndroid Build Coastguard Worker
1989*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.narenas">
1990*1208bc7eSAndroid Build Coastguard Worker        <term>
1991*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.narenas</mallctl>
1992*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
1993*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
1994*1208bc7eSAndroid Build Coastguard Worker        </term>
1995*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current limit on number of arenas.</para></listitem>
1996*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
1997*1208bc7eSAndroid Build Coastguard Worker
1998*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.dirty_decay_ms">
1999*1208bc7eSAndroid Build Coastguard Worker        <term>
2000*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.dirty_decay_ms</mallctl>
2001*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
2002*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2003*1208bc7eSAndroid Build Coastguard Worker        </term>
2004*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current default per-arena approximate time in
2005*1208bc7eSAndroid Build Coastguard Worker        milliseconds from the creation of a set of unused dirty pages until an
2006*1208bc7eSAndroid Build Coastguard Worker        equivalent set of unused dirty pages is purged and/or reused, used to
2007*1208bc7eSAndroid Build Coastguard Worker        initialize <link
2008*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.dirty_decay_ms"><mallctl>arena.&lt;i&gt;.dirty_decay_ms</mallctl></link>
2009*1208bc7eSAndroid Build Coastguard Worker        during arena creation.  See <link
2010*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link>
2011*1208bc7eSAndroid Build Coastguard Worker        for additional information.</para></listitem>
2012*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2013*1208bc7eSAndroid Build Coastguard Worker
2014*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.muzzy_decay_ms">
2015*1208bc7eSAndroid Build Coastguard Worker        <term>
2016*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.muzzy_decay_ms</mallctl>
2017*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
2018*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2019*1208bc7eSAndroid Build Coastguard Worker        </term>
2020*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current default per-arena approximate time in
2021*1208bc7eSAndroid Build Coastguard Worker        milliseconds from the creation of a set of unused muzzy pages until an
2022*1208bc7eSAndroid Build Coastguard Worker        equivalent set of unused muzzy pages is purged and/or reused, used to
2023*1208bc7eSAndroid Build Coastguard Worker        initialize <link
2024*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.muzzy_decay_ms"><mallctl>arena.&lt;i&gt;.muzzy_decay_ms</mallctl></link>
2025*1208bc7eSAndroid Build Coastguard Worker        during arena creation.  See <link
2026*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
2027*1208bc7eSAndroid Build Coastguard Worker        for additional information.</para></listitem>
2028*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2029*1208bc7eSAndroid Build Coastguard Worker
2030*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.quantum">
2031*1208bc7eSAndroid Build Coastguard Worker        <term>
2032*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.quantum</mallctl>
2033*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2034*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2035*1208bc7eSAndroid Build Coastguard Worker        </term>
2036*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Quantum size.</para></listitem>
2037*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2038*1208bc7eSAndroid Build Coastguard Worker
2039*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.page">
2040*1208bc7eSAndroid Build Coastguard Worker        <term>
2041*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.page</mallctl>
2042*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2043*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2044*1208bc7eSAndroid Build Coastguard Worker        </term>
2045*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Page size.</para></listitem>
2046*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2047*1208bc7eSAndroid Build Coastguard Worker
2048*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.tcache_max">
2049*1208bc7eSAndroid Build Coastguard Worker        <term>
2050*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.tcache_max</mallctl>
2051*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2052*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2053*1208bc7eSAndroid Build Coastguard Worker        </term>
2054*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum thread-cached size class.</para></listitem>
2055*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2056*1208bc7eSAndroid Build Coastguard Worker
2057*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.nbins">
2058*1208bc7eSAndroid Build Coastguard Worker        <term>
2059*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.nbins</mallctl>
2060*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
2061*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2062*1208bc7eSAndroid Build Coastguard Worker        </term>
2063*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of bin size classes.</para></listitem>
2064*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2065*1208bc7eSAndroid Build Coastguard Worker
2066*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.nhbins">
2067*1208bc7eSAndroid Build Coastguard Worker        <term>
2068*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.nhbins</mallctl>
2069*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
2070*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2071*1208bc7eSAndroid Build Coastguard Worker        </term>
2072*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of thread cache bin size
2073*1208bc7eSAndroid Build Coastguard Worker        classes.</para></listitem>
2074*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2075*1208bc7eSAndroid Build Coastguard Worker
2076*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.bin.i.size">
2077*1208bc7eSAndroid Build Coastguard Worker        <term>
2078*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.bin.&lt;i&gt;.size</mallctl>
2079*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2080*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2081*1208bc7eSAndroid Build Coastguard Worker        </term>
2082*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum size supported by size class.</para></listitem>
2083*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2084*1208bc7eSAndroid Build Coastguard Worker
2085*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.bin.i.nregs">
2086*1208bc7eSAndroid Build Coastguard Worker        <term>
2087*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.bin.&lt;i&gt;.nregs</mallctl>
2088*1208bc7eSAndroid Build Coastguard Worker          (<type>uint32_t</type>)
2089*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2090*1208bc7eSAndroid Build Coastguard Worker        </term>
2091*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of regions per slab.</para></listitem>
2092*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2093*1208bc7eSAndroid Build Coastguard Worker
2094*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.bin.i.slab_size">
2095*1208bc7eSAndroid Build Coastguard Worker        <term>
2096*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.bin.&lt;i&gt;.slab_size</mallctl>
2097*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2098*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2099*1208bc7eSAndroid Build Coastguard Worker        </term>
2100*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of bytes per slab.</para></listitem>
2101*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2102*1208bc7eSAndroid Build Coastguard Worker
2103*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.nlextents">
2104*1208bc7eSAndroid Build Coastguard Worker        <term>
2105*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.nlextents</mallctl>
2106*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
2107*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2108*1208bc7eSAndroid Build Coastguard Worker        </term>
2109*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of large size classes.</para></listitem>
2110*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2111*1208bc7eSAndroid Build Coastguard Worker
2112*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.lextent.i.size">
2113*1208bc7eSAndroid Build Coastguard Worker        <term>
2114*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.lextent.&lt;i&gt;.size</mallctl>
2115*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2116*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2117*1208bc7eSAndroid Build Coastguard Worker        </term>
2118*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum size supported by this large size
2119*1208bc7eSAndroid Build Coastguard Worker        class.</para></listitem>
2120*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2121*1208bc7eSAndroid Build Coastguard Worker
2122*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.create">
2123*1208bc7eSAndroid Build Coastguard Worker        <term>
2124*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.create</mallctl>
2125*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>, <type>extent_hooks_t *</type>)
2126*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2127*1208bc7eSAndroid Build Coastguard Worker        </term>
2128*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Explicitly create a new arena outside the range of
2129*1208bc7eSAndroid Build Coastguard Worker        automatically managed arenas, with optionally specified extent hooks,
2130*1208bc7eSAndroid Build Coastguard Worker        and return the new arena index.</para></listitem>
2131*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2132*1208bc7eSAndroid Build Coastguard Worker
2133*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="arenas.lookup">
2134*1208bc7eSAndroid Build Coastguard Worker        <term>
2135*1208bc7eSAndroid Build Coastguard Worker          <mallctl>arenas.lookup</mallctl>
2136*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>, <type>void*</type>)
2137*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2138*1208bc7eSAndroid Build Coastguard Worker        </term>
2139*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Index of the arena to which an allocation belongs to.</para></listitem>
2140*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2141*1208bc7eSAndroid Build Coastguard Worker
2142*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.thread_active_init">
2143*1208bc7eSAndroid Build Coastguard Worker        <term>
2144*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.thread_active_init</mallctl>
2145*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
2146*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2147*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2148*1208bc7eSAndroid Build Coastguard Worker        </term>
2149*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Control the initial setting for <link
2150*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link>
2151*1208bc7eSAndroid Build Coastguard Worker        in newly created threads.  See the <link
2152*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_thread_active_init"><mallctl>opt.prof_thread_active_init</mallctl></link>
2153*1208bc7eSAndroid Build Coastguard Worker        option for additional information.</para></listitem>
2154*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2155*1208bc7eSAndroid Build Coastguard Worker
2156*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.active">
2157*1208bc7eSAndroid Build Coastguard Worker        <term>
2158*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.active</mallctl>
2159*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
2160*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2161*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2162*1208bc7eSAndroid Build Coastguard Worker        </term>
2163*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Control whether sampling is currently active.  See the
2164*1208bc7eSAndroid Build Coastguard Worker        <link
2165*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link>
2166*1208bc7eSAndroid Build Coastguard Worker        option for additional information, as well as the interrelated <link
2167*1208bc7eSAndroid Build Coastguard Worker        linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link>
2168*1208bc7eSAndroid Build Coastguard Worker        mallctl.</para></listitem>
2169*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2170*1208bc7eSAndroid Build Coastguard Worker
2171*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.dump">
2172*1208bc7eSAndroid Build Coastguard Worker        <term>
2173*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.dump</mallctl>
2174*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
2175*1208bc7eSAndroid Build Coastguard Worker          <literal>-w</literal>
2176*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2177*1208bc7eSAndroid Build Coastguard Worker        </term>
2178*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Dump a memory profile to the specified file, or if NULL
2179*1208bc7eSAndroid Build Coastguard Worker        is specified, to a file according to the pattern
2180*1208bc7eSAndroid Build Coastguard Worker        <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.m&lt;mseq&gt;.heap</filename>,
2181*1208bc7eSAndroid Build Coastguard Worker        where <literal>&lt;prefix&gt;</literal> is controlled by the
2182*1208bc7eSAndroid Build Coastguard Worker        <link
2183*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
2184*1208bc7eSAndroid Build Coastguard Worker        option.</para></listitem>
2185*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2186*1208bc7eSAndroid Build Coastguard Worker
2187*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.gdump">
2188*1208bc7eSAndroid Build Coastguard Worker        <term>
2189*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.gdump</mallctl>
2190*1208bc7eSAndroid Build Coastguard Worker          (<type>bool</type>)
2191*1208bc7eSAndroid Build Coastguard Worker          <literal>rw</literal>
2192*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2193*1208bc7eSAndroid Build Coastguard Worker        </term>
2194*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>When enabled, trigger a memory profile dump every time
2195*1208bc7eSAndroid Build Coastguard Worker        the total virtual memory exceeds the previous maximum.  Profiles are
2196*1208bc7eSAndroid Build Coastguard Worker        dumped to files named according to the pattern
2197*1208bc7eSAndroid Build Coastguard Worker        <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.u&lt;useq&gt;.heap</filename>,
2198*1208bc7eSAndroid Build Coastguard Worker        where <literal>&lt;prefix&gt;</literal> is controlled by the <link
2199*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
2200*1208bc7eSAndroid Build Coastguard Worker        option.</para></listitem>
2201*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2202*1208bc7eSAndroid Build Coastguard Worker
2203*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.reset">
2204*1208bc7eSAndroid Build Coastguard Worker        <term>
2205*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.reset</mallctl>
2206*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2207*1208bc7eSAndroid Build Coastguard Worker          <literal>-w</literal>
2208*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2209*1208bc7eSAndroid Build Coastguard Worker        </term>
2210*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Reset all memory profile statistics, and optionally
2211*1208bc7eSAndroid Build Coastguard Worker        update the sample rate (see <link
2212*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>
2213*1208bc7eSAndroid Build Coastguard Worker        and <link
2214*1208bc7eSAndroid Build Coastguard Worker        linkend="prof.lg_sample"><mallctl>prof.lg_sample</mallctl></link>).
2215*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2216*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2217*1208bc7eSAndroid Build Coastguard Worker
2218*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.lg_sample">
2219*1208bc7eSAndroid Build Coastguard Worker        <term>
2220*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.lg_sample</mallctl>
2221*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2222*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2223*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2224*1208bc7eSAndroid Build Coastguard Worker        </term>
2225*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Get the current sample rate (see <link
2226*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>).
2227*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2228*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2229*1208bc7eSAndroid Build Coastguard Worker
2230*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="prof.interval">
2231*1208bc7eSAndroid Build Coastguard Worker        <term>
2232*1208bc7eSAndroid Build Coastguard Worker          <mallctl>prof.interval</mallctl>
2233*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2234*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2235*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-prof</option>]
2236*1208bc7eSAndroid Build Coastguard Worker        </term>
2237*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Average number of bytes allocated between
2238*1208bc7eSAndroid Build Coastguard Worker        interval-based profile dumps.  See the
2239*1208bc7eSAndroid Build Coastguard Worker        <link
2240*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
2241*1208bc7eSAndroid Build Coastguard Worker        option for additional information.</para></listitem>
2242*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2243*1208bc7eSAndroid Build Coastguard Worker
2244*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.allocated">
2245*1208bc7eSAndroid Build Coastguard Worker        <term>
2246*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.allocated</mallctl>
2247*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2248*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2249*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2250*1208bc7eSAndroid Build Coastguard Worker        </term>
2251*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of bytes allocated by the
2252*1208bc7eSAndroid Build Coastguard Worker        application.</para></listitem>
2253*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2254*1208bc7eSAndroid Build Coastguard Worker
2255*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.active">
2256*1208bc7eSAndroid Build Coastguard Worker        <term>
2257*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.active</mallctl>
2258*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2259*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2260*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2261*1208bc7eSAndroid Build Coastguard Worker        </term>
2262*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of bytes in active pages allocated by the
2263*1208bc7eSAndroid Build Coastguard Worker        application.  This is a multiple of the page size, and greater than or
2264*1208bc7eSAndroid Build Coastguard Worker        equal to <link
2265*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.allocated"><mallctl>stats.allocated</mallctl></link>.
2266*1208bc7eSAndroid Build Coastguard Worker        This does not include <link linkend="stats.arenas.i.pdirty">
2267*1208bc7eSAndroid Build Coastguard Worker        <mallctl>stats.arenas.&lt;i&gt;.pdirty</mallctl></link>,
2268*1208bc7eSAndroid Build Coastguard Worker        <link linkend="stats.arenas.i.pmuzzy">
2269*1208bc7eSAndroid Build Coastguard Worker        <mallctl>stats.arenas.&lt;i&gt;.pmuzzy</mallctl></link>, nor pages
2270*1208bc7eSAndroid Build Coastguard Worker        entirely devoted to allocator metadata.</para></listitem>
2271*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2272*1208bc7eSAndroid Build Coastguard Worker
2273*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.metadata">
2274*1208bc7eSAndroid Build Coastguard Worker        <term>
2275*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.metadata</mallctl>
2276*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2277*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2278*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2279*1208bc7eSAndroid Build Coastguard Worker        </term>
2280*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of bytes dedicated to metadata, which
2281*1208bc7eSAndroid Build Coastguard Worker        comprise base allocations used for bootstrap-sensitive allocator
2282*1208bc7eSAndroid Build Coastguard Worker        metadata structures (see <link
2283*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.arenas.i.base"><mallctl>stats.arenas.&lt;i&gt;.base</mallctl></link>)
2284*1208bc7eSAndroid Build Coastguard Worker        and internal allocations (see <link
2285*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.arenas.i.internal"><mallctl>stats.arenas.&lt;i&gt;.internal</mallctl></link>).
2286*1208bc7eSAndroid Build Coastguard Worker        Transparent huge page (enabled with <link
2287*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.metadata_thp">opt.metadata_thp</link>) usage is not
2288*1208bc7eSAndroid Build Coastguard Worker        considered.</para></listitem>
2289*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2290*1208bc7eSAndroid Build Coastguard Worker
2291*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.metadata_thp">
2292*1208bc7eSAndroid Build Coastguard Worker        <term>
2293*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.metadata_thp</mallctl>
2294*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2295*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2296*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2297*1208bc7eSAndroid Build Coastguard Worker        </term>
2298*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of transparent huge pages (THP) used for
2299*1208bc7eSAndroid Build Coastguard Worker        metadata.  See <link
2300*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.metadata"><mallctl>stats.metadata</mallctl></link> and
2301*1208bc7eSAndroid Build Coastguard Worker        <link linkend="opt.metadata_thp">opt.metadata_thp</link>) for
2302*1208bc7eSAndroid Build Coastguard Worker        details.</para></listitem>
2303*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2304*1208bc7eSAndroid Build Coastguard Worker
2305*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.resident">
2306*1208bc7eSAndroid Build Coastguard Worker        <term>
2307*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.resident</mallctl>
2308*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2309*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2310*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2311*1208bc7eSAndroid Build Coastguard Worker        </term>
2312*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum number of bytes in physically resident data
2313*1208bc7eSAndroid Build Coastguard Worker        pages mapped by the allocator, comprising all pages dedicated to
2314*1208bc7eSAndroid Build Coastguard Worker        allocator metadata, pages backing active allocations, and unused dirty
2315*1208bc7eSAndroid Build Coastguard Worker        pages.  This is a maximum rather than precise because pages may not
2316*1208bc7eSAndroid Build Coastguard Worker        actually be physically resident if they correspond to demand-zeroed
2317*1208bc7eSAndroid Build Coastguard Worker        virtual memory that has not yet been touched.  This is a multiple of the
2318*1208bc7eSAndroid Build Coastguard Worker        page size, and is larger than <link
2319*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.active"><mallctl>stats.active</mallctl></link>.</para></listitem>
2320*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2321*1208bc7eSAndroid Build Coastguard Worker
2322*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.mapped">
2323*1208bc7eSAndroid Build Coastguard Worker        <term>
2324*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.mapped</mallctl>
2325*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2326*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2327*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2328*1208bc7eSAndroid Build Coastguard Worker        </term>
2329*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of bytes in active extents mapped by the
2330*1208bc7eSAndroid Build Coastguard Worker        allocator.  This is larger than <link
2331*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.active"><mallctl>stats.active</mallctl></link>.  This
2332*1208bc7eSAndroid Build Coastguard Worker        does not include inactive extents, even those that contain unused dirty
2333*1208bc7eSAndroid Build Coastguard Worker        pages, which means that there is no strict ordering between this and
2334*1208bc7eSAndroid Build Coastguard Worker        <link
2335*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.resident"><mallctl>stats.resident</mallctl></link>.</para></listitem>
2336*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2337*1208bc7eSAndroid Build Coastguard Worker
2338*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.retained">
2339*1208bc7eSAndroid Build Coastguard Worker        <term>
2340*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.retained</mallctl>
2341*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2342*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2343*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2344*1208bc7eSAndroid Build Coastguard Worker        </term>
2345*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Total number of bytes in virtual memory mappings that
2346*1208bc7eSAndroid Build Coastguard Worker        were retained rather than being returned to the operating system via
2347*1208bc7eSAndroid Build Coastguard Worker        e.g. <citerefentry><refentrytitle>munmap</refentrytitle>
2348*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> or similar.  Retained virtual
2349*1208bc7eSAndroid Build Coastguard Worker        memory is typically untouched, decommitted, or purged, so it has no
2350*1208bc7eSAndroid Build Coastguard Worker        strongly associated physical memory (see <link
2351*1208bc7eSAndroid Build Coastguard Worker        linkend="arena.i.extent_hooks">extent hooks</link> for details).
2352*1208bc7eSAndroid Build Coastguard Worker        Retained memory is excluded from mapped memory statistics, e.g. <link
2353*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.mapped"><mallctl>stats.mapped</mallctl></link>.
2354*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2355*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2356*1208bc7eSAndroid Build Coastguard Worker
2357*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.background_thread.num_threads">
2358*1208bc7eSAndroid Build Coastguard Worker        <term>
2359*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.background_thread.num_threads</mallctl>
2360*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2361*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2362*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2363*1208bc7eSAndroid Build Coastguard Worker        </term>
2364*1208bc7eSAndroid Build Coastguard Worker        <listitem><para> Number of <link linkend="background_thread">background
2365*1208bc7eSAndroid Build Coastguard Worker        threads</link> running currently.</para></listitem>
2366*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2367*1208bc7eSAndroid Build Coastguard Worker
2368*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.background_thread.num_runs">
2369*1208bc7eSAndroid Build Coastguard Worker        <term>
2370*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.background_thread.num_runs</mallctl>
2371*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2372*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2373*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2374*1208bc7eSAndroid Build Coastguard Worker        </term>
2375*1208bc7eSAndroid Build Coastguard Worker        <listitem><para> Total number of runs from all <link
2376*1208bc7eSAndroid Build Coastguard Worker        linkend="background_thread">background threads</link>.</para></listitem>
2377*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2378*1208bc7eSAndroid Build Coastguard Worker
2379*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.background_thread.run_interval">
2380*1208bc7eSAndroid Build Coastguard Worker        <term>
2381*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.background_thread.run_interval</mallctl>
2382*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2383*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2384*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2385*1208bc7eSAndroid Build Coastguard Worker        </term>
2386*1208bc7eSAndroid Build Coastguard Worker        <listitem><para> Average run interval in nanoseconds of <link
2387*1208bc7eSAndroid Build Coastguard Worker        linkend="background_thread">background threads</link>.</para></listitem>
2388*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2389*1208bc7eSAndroid Build Coastguard Worker
2390*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.mutexes.ctl">
2391*1208bc7eSAndroid Build Coastguard Worker        <term>
2392*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.mutexes.ctl.{counter};</mallctl>
2393*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>)
2394*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2395*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2396*1208bc7eSAndroid Build Coastguard Worker        </term>
2397*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>ctl</varname> mutex (global
2398*1208bc7eSAndroid Build Coastguard Worker        scope; mallctl related).  <mallctl>{counter}</mallctl> is one of the
2399*1208bc7eSAndroid Build Coastguard Worker        counters below:</para>
2400*1208bc7eSAndroid Build Coastguard Worker        <varlistentry id="mutex_counters">
2401*1208bc7eSAndroid Build Coastguard Worker          <listitem><para><varname>num_ops</varname> (<type>uint64_t</type>):
2402*1208bc7eSAndroid Build Coastguard Worker          Total number of lock acquisition operations on this mutex.</para>
2403*1208bc7eSAndroid Build Coastguard Worker
2404*1208bc7eSAndroid Build Coastguard Worker	  <para><varname>num_spin_acq</varname> (<type>uint64_t</type>): Number
2405*1208bc7eSAndroid Build Coastguard Worker	  of times the mutex was spin-acquired.  When the mutex is currently
2406*1208bc7eSAndroid Build Coastguard Worker	  locked and cannot be acquired immediately, a short period of
2407*1208bc7eSAndroid Build Coastguard Worker	  spin-retry within jemalloc will be performed.  Acquired through spin
2408*1208bc7eSAndroid Build Coastguard Worker	  generally means the contention was lightweight and not causing context
2409*1208bc7eSAndroid Build Coastguard Worker	  switches.</para>
2410*1208bc7eSAndroid Build Coastguard Worker
2411*1208bc7eSAndroid Build Coastguard Worker	  <para><varname>num_wait</varname> (<type>uint64_t</type>): Number of
2412*1208bc7eSAndroid Build Coastguard Worker	  times the mutex was wait-acquired, which means the mutex contention
2413*1208bc7eSAndroid Build Coastguard Worker	  was not solved by spin-retry, and blocking operation was likely
2414*1208bc7eSAndroid Build Coastguard Worker	  involved in order to acquire the mutex.  This event generally implies
2415*1208bc7eSAndroid Build Coastguard Worker	  higher cost / longer delay, and should be investigated if it happens
2416*1208bc7eSAndroid Build Coastguard Worker	  often.</para>
2417*1208bc7eSAndroid Build Coastguard Worker
2418*1208bc7eSAndroid Build Coastguard Worker	  <para><varname>max_wait_time</varname> (<type>uint64_t</type>):
2419*1208bc7eSAndroid Build Coastguard Worker	  Maximum length of time in nanoseconds spent on a single wait-acquired
2420*1208bc7eSAndroid Build Coastguard Worker	  lock operation.  Note that to avoid profiling overhead on the common
2421*1208bc7eSAndroid Build Coastguard Worker	  path, this does not consider spin-acquired cases.</para>
2422*1208bc7eSAndroid Build Coastguard Worker
2423*1208bc7eSAndroid Build Coastguard Worker	  <para><varname>total_wait_time</varname> (<type>uint64_t</type>):
2424*1208bc7eSAndroid Build Coastguard Worker	  Cumulative time in nanoseconds spent on wait-acquired lock operations.
2425*1208bc7eSAndroid Build Coastguard Worker	  Similarly, spin-acquired cases are not considered.</para>
2426*1208bc7eSAndroid Build Coastguard Worker
2427*1208bc7eSAndroid Build Coastguard Worker	  <para><varname>max_num_thds</varname> (<type>uint32_t</type>): Maximum
2428*1208bc7eSAndroid Build Coastguard Worker	  number of threads waiting on this mutex simultaneously.  Similarly,
2429*1208bc7eSAndroid Build Coastguard Worker	  spin-acquired cases are not considered.</para>
2430*1208bc7eSAndroid Build Coastguard Worker
2431*1208bc7eSAndroid Build Coastguard Worker	  <para><varname>num_owner_switch</varname> (<type>uint64_t</type>):
2432*1208bc7eSAndroid Build Coastguard Worker	  Number of times the current mutex owner is different from the previous
2433*1208bc7eSAndroid Build Coastguard Worker	  one.  This event does not generally imply an issue; rather it is an
2434*1208bc7eSAndroid Build Coastguard Worker	  indicator of how often the protected data are accessed by different
2435*1208bc7eSAndroid Build Coastguard Worker	  threads.
2436*1208bc7eSAndroid Build Coastguard Worker	  </para>
2437*1208bc7eSAndroid Build Coastguard Worker	  </listitem>
2438*1208bc7eSAndroid Build Coastguard Worker	</varlistentry>
2439*1208bc7eSAndroid Build Coastguard Worker	</listitem>
2440*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2441*1208bc7eSAndroid Build Coastguard Worker
2442*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.mutexes.background_thread">
2443*1208bc7eSAndroid Build Coastguard Worker        <term>
2444*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.mutexes.background_thread.{counter}</mallctl>
2445*1208bc7eSAndroid Build Coastguard Worker	  (<type>counter specific type</type>) <literal>r-</literal>
2446*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2447*1208bc7eSAndroid Build Coastguard Worker        </term>
2448*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>background_thread</varname> mutex
2449*1208bc7eSAndroid Build Coastguard Worker        (global scope; <link
2450*1208bc7eSAndroid Build Coastguard Worker        linkend="background_thread"><mallctl>background_thread</mallctl></link>
2451*1208bc7eSAndroid Build Coastguard Worker        related).  <mallctl>{counter}</mallctl> is one of the counters in <link
2452*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
2453*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
2454*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2455*1208bc7eSAndroid Build Coastguard Worker
2456*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.mutexes.prof">
2457*1208bc7eSAndroid Build Coastguard Worker        <term>
2458*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.mutexes.prof.{counter}</mallctl>
2459*1208bc7eSAndroid Build Coastguard Worker	  (<type>counter specific type</type>) <literal>r-</literal>
2460*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2461*1208bc7eSAndroid Build Coastguard Worker        </term>
2462*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>prof</varname> mutex (global
2463*1208bc7eSAndroid Build Coastguard Worker        scope; profiling related).  <mallctl>{counter}</mallctl> is one of the
2464*1208bc7eSAndroid Build Coastguard Worker        counters in <link linkend="mutex_counters">mutex profiling
2465*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
2466*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2467*1208bc7eSAndroid Build Coastguard Worker
2468*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.mutexes.reset">
2469*1208bc7eSAndroid Build Coastguard Worker        <term>
2470*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.mutexes.reset</mallctl>
2471*1208bc7eSAndroid Build Coastguard Worker	  (<type>void</type>) <literal>--</literal>
2472*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2473*1208bc7eSAndroid Build Coastguard Worker        </term>
2474*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Reset all mutex profile statistics, including global
2475*1208bc7eSAndroid Build Coastguard Worker        mutexes, arena mutexes and bin mutexes.</para></listitem>
2476*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2477*1208bc7eSAndroid Build Coastguard Worker
2478*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.dss">
2479*1208bc7eSAndroid Build Coastguard Worker        <term>
2480*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.dss</mallctl>
2481*1208bc7eSAndroid Build Coastguard Worker          (<type>const char *</type>)
2482*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2483*1208bc7eSAndroid Build Coastguard Worker        </term>
2484*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle>
2485*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry>) allocation precedence as
2486*1208bc7eSAndroid Build Coastguard Worker        related to <citerefentry><refentrytitle>mmap</refentrytitle>
2487*1208bc7eSAndroid Build Coastguard Worker        <manvolnum>2</manvolnum></citerefentry> allocation.  See <link
2488*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for details.
2489*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2490*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2491*1208bc7eSAndroid Build Coastguard Worker
2492*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.dirty_decay_ms">
2493*1208bc7eSAndroid Build Coastguard Worker        <term>
2494*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.dirty_decay_ms</mallctl>
2495*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
2496*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2497*1208bc7eSAndroid Build Coastguard Worker        </term>
2498*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Approximate time in milliseconds from the creation of a
2499*1208bc7eSAndroid Build Coastguard Worker        set of unused dirty pages until an equivalent set of unused dirty pages
2500*1208bc7eSAndroid Build Coastguard Worker        is purged and/or reused.  See <link
2501*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link>
2502*1208bc7eSAndroid Build Coastguard Worker        for details.</para></listitem>
2503*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2504*1208bc7eSAndroid Build Coastguard Worker
2505*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.muzzy_decay_ms">
2506*1208bc7eSAndroid Build Coastguard Worker        <term>
2507*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.muzzy_decay_ms</mallctl>
2508*1208bc7eSAndroid Build Coastguard Worker          (<type>ssize_t</type>)
2509*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2510*1208bc7eSAndroid Build Coastguard Worker        </term>
2511*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Approximate time in milliseconds from the creation of a
2512*1208bc7eSAndroid Build Coastguard Worker        set of unused muzzy pages until an equivalent set of unused muzzy pages
2513*1208bc7eSAndroid Build Coastguard Worker        is purged and/or reused.  See <link
2514*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
2515*1208bc7eSAndroid Build Coastguard Worker        for details.</para></listitem>
2516*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2517*1208bc7eSAndroid Build Coastguard Worker
2518*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.nthreads">
2519*1208bc7eSAndroid Build Coastguard Worker        <term>
2520*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.nthreads</mallctl>
2521*1208bc7eSAndroid Build Coastguard Worker          (<type>unsigned</type>)
2522*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2523*1208bc7eSAndroid Build Coastguard Worker        </term>
2524*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of threads currently assigned to
2525*1208bc7eSAndroid Build Coastguard Worker        arena.</para></listitem>
2526*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2527*1208bc7eSAndroid Build Coastguard Worker
2528*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.uptime">
2529*1208bc7eSAndroid Build Coastguard Worker        <term>
2530*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.uptime</mallctl>
2531*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2532*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2533*1208bc7eSAndroid Build Coastguard Worker        </term>
2534*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Time elapsed (in nanoseconds) since the arena was
2535*1208bc7eSAndroid Build Coastguard Worker        created.  If &lt;i&gt; equals <constant>0</constant> or
2536*1208bc7eSAndroid Build Coastguard Worker        <constant>MALLCTL_ARENAS_ALL</constant>, this is the uptime since malloc
2537*1208bc7eSAndroid Build Coastguard Worker        initialization.</para></listitem>
2538*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2539*1208bc7eSAndroid Build Coastguard Worker
2540*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.pactive">
2541*1208bc7eSAndroid Build Coastguard Worker        <term>
2542*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.pactive</mallctl>
2543*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2544*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2545*1208bc7eSAndroid Build Coastguard Worker        </term>
2546*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of pages in active extents.</para></listitem>
2547*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2548*1208bc7eSAndroid Build Coastguard Worker
2549*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.pdirty">
2550*1208bc7eSAndroid Build Coastguard Worker        <term>
2551*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.pdirty</mallctl>
2552*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2553*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2554*1208bc7eSAndroid Build Coastguard Worker        </term>
2555*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of pages within unused extents that are
2556*1208bc7eSAndroid Build Coastguard Worker        potentially dirty, and for which <function>madvise()</function> or
2557*1208bc7eSAndroid Build Coastguard Worker        similar has not been called.  See <link
2558*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link>
2559*1208bc7eSAndroid Build Coastguard Worker        for a description of dirty pages.</para></listitem>
2560*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2561*1208bc7eSAndroid Build Coastguard Worker
2562*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.pmuzzy">
2563*1208bc7eSAndroid Build Coastguard Worker        <term>
2564*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.pmuzzy</mallctl>
2565*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2566*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2567*1208bc7eSAndroid Build Coastguard Worker        </term>
2568*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of pages within unused extents that are muzzy.
2569*1208bc7eSAndroid Build Coastguard Worker        See <link
2570*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
2571*1208bc7eSAndroid Build Coastguard Worker        for a description of muzzy pages.</para></listitem>
2572*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2573*1208bc7eSAndroid Build Coastguard Worker
2574*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mapped">
2575*1208bc7eSAndroid Build Coastguard Worker        <term>
2576*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mapped</mallctl>
2577*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2578*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2579*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2580*1208bc7eSAndroid Build Coastguard Worker        </term>
2581*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of mapped bytes.</para></listitem>
2582*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2583*1208bc7eSAndroid Build Coastguard Worker
2584*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.retained">
2585*1208bc7eSAndroid Build Coastguard Worker        <term>
2586*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.retained</mallctl>
2587*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2588*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2589*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2590*1208bc7eSAndroid Build Coastguard Worker        </term>
2591*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of retained bytes.  See <link
2592*1208bc7eSAndroid Build Coastguard Worker        linkend="stats.retained"><mallctl>stats.retained</mallctl></link> for
2593*1208bc7eSAndroid Build Coastguard Worker        details.</para></listitem>
2594*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2595*1208bc7eSAndroid Build Coastguard Worker
2596*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.base">
2597*1208bc7eSAndroid Build Coastguard Worker        <term>
2598*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.base</mallctl>
2599*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2600*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2601*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2602*1208bc7eSAndroid Build Coastguard Worker        </term>
2603*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>
2604*1208bc7eSAndroid Build Coastguard Worker        Number of bytes dedicated to bootstrap-sensitive allocator metadata
2605*1208bc7eSAndroid Build Coastguard Worker        structures.</para></listitem>
2606*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2607*1208bc7eSAndroid Build Coastguard Worker
2608*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.internal">
2609*1208bc7eSAndroid Build Coastguard Worker        <term>
2610*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.internal</mallctl>
2611*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2612*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2613*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2614*1208bc7eSAndroid Build Coastguard Worker        </term>
2615*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of bytes dedicated to internal allocations.
2616*1208bc7eSAndroid Build Coastguard Worker        Internal allocations differ from application-originated allocations in
2617*1208bc7eSAndroid Build Coastguard Worker        that they are for internal use, and that they are omitted from heap
2618*1208bc7eSAndroid Build Coastguard Worker        profiles.</para></listitem>
2619*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2620*1208bc7eSAndroid Build Coastguard Worker
2621*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.metadata_thp">
2622*1208bc7eSAndroid Build Coastguard Worker        <term>
2623*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.metadata_thp</mallctl>
2624*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2625*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2626*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2627*1208bc7eSAndroid Build Coastguard Worker        </term>
2628*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of transparent huge pages (THP) used for
2629*1208bc7eSAndroid Build Coastguard Worker        metadata.  See <link linkend="opt.metadata_thp">opt.metadata_thp</link>
2630*1208bc7eSAndroid Build Coastguard Worker        for details.</para></listitem>
2631*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2632*1208bc7eSAndroid Build Coastguard Worker
2633*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.resident">
2634*1208bc7eSAndroid Build Coastguard Worker        <term>
2635*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.resident</mallctl>
2636*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2637*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2638*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2639*1208bc7eSAndroid Build Coastguard Worker        </term>
2640*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Maximum number of bytes in physically resident data
2641*1208bc7eSAndroid Build Coastguard Worker        pages mapped by the arena, comprising all pages dedicated to allocator
2642*1208bc7eSAndroid Build Coastguard Worker        metadata, pages backing active allocations, and unused dirty pages.
2643*1208bc7eSAndroid Build Coastguard Worker        This is a maximum rather than precise because pages may not actually be
2644*1208bc7eSAndroid Build Coastguard Worker        physically resident if they correspond to demand-zeroed virtual memory
2645*1208bc7eSAndroid Build Coastguard Worker        that has not yet been touched.  This is a multiple of the page
2646*1208bc7eSAndroid Build Coastguard Worker        size.</para></listitem>
2647*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2648*1208bc7eSAndroid Build Coastguard Worker
2649*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.dirty_npurge">
2650*1208bc7eSAndroid Build Coastguard Worker        <term>
2651*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.dirty_npurge</mallctl>
2652*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2653*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2654*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2655*1208bc7eSAndroid Build Coastguard Worker        </term>
2656*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of dirty page purge sweeps performed.
2657*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2658*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2659*1208bc7eSAndroid Build Coastguard Worker
2660*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.dirty_nmadvise">
2661*1208bc7eSAndroid Build Coastguard Worker        <term>
2662*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.dirty_nmadvise</mallctl>
2663*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2664*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2665*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2666*1208bc7eSAndroid Build Coastguard Worker        </term>
2667*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of <function>madvise()</function> or similar
2668*1208bc7eSAndroid Build Coastguard Worker        calls made to purge dirty pages.</para></listitem>
2669*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2670*1208bc7eSAndroid Build Coastguard Worker
2671*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.dirty_purged">
2672*1208bc7eSAndroid Build Coastguard Worker        <term>
2673*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.dirty_purged</mallctl>
2674*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2675*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2676*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2677*1208bc7eSAndroid Build Coastguard Worker        </term>
2678*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of dirty pages purged.</para></listitem>
2679*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2680*1208bc7eSAndroid Build Coastguard Worker
2681*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.muzzy_npurge">
2682*1208bc7eSAndroid Build Coastguard Worker        <term>
2683*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.muzzy_npurge</mallctl>
2684*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2685*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2686*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2687*1208bc7eSAndroid Build Coastguard Worker        </term>
2688*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of muzzy page purge sweeps performed.
2689*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2690*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2691*1208bc7eSAndroid Build Coastguard Worker
2692*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.muzzy_nmadvise">
2693*1208bc7eSAndroid Build Coastguard Worker        <term>
2694*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.muzzy_nmadvise</mallctl>
2695*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2696*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2697*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2698*1208bc7eSAndroid Build Coastguard Worker        </term>
2699*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of <function>madvise()</function> or similar
2700*1208bc7eSAndroid Build Coastguard Worker        calls made to purge muzzy pages.</para></listitem>
2701*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2702*1208bc7eSAndroid Build Coastguard Worker
2703*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.muzzy_purged">
2704*1208bc7eSAndroid Build Coastguard Worker        <term>
2705*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.muzzy_purged</mallctl>
2706*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2707*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2708*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2709*1208bc7eSAndroid Build Coastguard Worker        </term>
2710*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of muzzy pages purged.</para></listitem>
2711*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2712*1208bc7eSAndroid Build Coastguard Worker
2713*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.small.allocated">
2714*1208bc7eSAndroid Build Coastguard Worker        <term>
2715*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.small.allocated</mallctl>
2716*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2717*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2718*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2719*1208bc7eSAndroid Build Coastguard Worker        </term>
2720*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of bytes currently allocated by small objects.
2721*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2722*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2723*1208bc7eSAndroid Build Coastguard Worker
2724*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.small.nmalloc">
2725*1208bc7eSAndroid Build Coastguard Worker        <term>
2726*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.small.nmalloc</mallctl>
2727*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2728*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2729*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2730*1208bc7eSAndroid Build Coastguard Worker        </term>
2731*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a small allocation was
2732*1208bc7eSAndroid Build Coastguard Worker        requested from the arena's bins, whether to fill the relevant tcache if
2733*1208bc7eSAndroid Build Coastguard Worker        <link linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is
2734*1208bc7eSAndroid Build Coastguard Worker        enabled, or to directly satisfy an allocation request
2735*1208bc7eSAndroid Build Coastguard Worker        otherwise.</para></listitem>
2736*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2737*1208bc7eSAndroid Build Coastguard Worker
2738*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.small.ndalloc">
2739*1208bc7eSAndroid Build Coastguard Worker        <term>
2740*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.small.ndalloc</mallctl>
2741*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2742*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2743*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2744*1208bc7eSAndroid Build Coastguard Worker        </term>
2745*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a small allocation was
2746*1208bc7eSAndroid Build Coastguard Worker        returned to the arena's bins, whether to flush the relevant tcache if
2747*1208bc7eSAndroid Build Coastguard Worker        <link linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is
2748*1208bc7eSAndroid Build Coastguard Worker        enabled, or to directly deallocate an allocation
2749*1208bc7eSAndroid Build Coastguard Worker        otherwise.</para></listitem>
2750*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2751*1208bc7eSAndroid Build Coastguard Worker
2752*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.small.nrequests">
2753*1208bc7eSAndroid Build Coastguard Worker        <term>
2754*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.small.nrequests</mallctl>
2755*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2756*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2757*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2758*1208bc7eSAndroid Build Coastguard Worker        </term>
2759*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of allocation requests satisfied by
2760*1208bc7eSAndroid Build Coastguard Worker        all bin size classes.</para></listitem>
2761*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2762*1208bc7eSAndroid Build Coastguard Worker
2763*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.large.allocated">
2764*1208bc7eSAndroid Build Coastguard Worker        <term>
2765*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.large.allocated</mallctl>
2766*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2767*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2768*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2769*1208bc7eSAndroid Build Coastguard Worker        </term>
2770*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Number of bytes currently allocated by large objects.
2771*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2772*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2773*1208bc7eSAndroid Build Coastguard Worker
2774*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.large.nmalloc">
2775*1208bc7eSAndroid Build Coastguard Worker        <term>
2776*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.large.nmalloc</mallctl>
2777*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2778*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2779*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2780*1208bc7eSAndroid Build Coastguard Worker        </term>
2781*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a large extent was allocated
2782*1208bc7eSAndroid Build Coastguard Worker        from the arena, whether to fill the relevant tcache if <link
2783*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and
2784*1208bc7eSAndroid Build Coastguard Worker        the size class is within the range being cached, or to directly satisfy
2785*1208bc7eSAndroid Build Coastguard Worker        an allocation request otherwise.</para></listitem>
2786*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2787*1208bc7eSAndroid Build Coastguard Worker
2788*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.large.ndalloc">
2789*1208bc7eSAndroid Build Coastguard Worker        <term>
2790*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.large.ndalloc</mallctl>
2791*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2792*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2793*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2794*1208bc7eSAndroid Build Coastguard Worker        </term>
2795*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a large extent was returned
2796*1208bc7eSAndroid Build Coastguard Worker        to the arena, whether to flush the relevant tcache if <link
2797*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and
2798*1208bc7eSAndroid Build Coastguard Worker        the size class is within the range being cached, or to directly
2799*1208bc7eSAndroid Build Coastguard Worker        deallocate an allocation otherwise.</para></listitem>
2800*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2801*1208bc7eSAndroid Build Coastguard Worker
2802*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.large.nrequests">
2803*1208bc7eSAndroid Build Coastguard Worker        <term>
2804*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.large.nrequests</mallctl>
2805*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2806*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2807*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2808*1208bc7eSAndroid Build Coastguard Worker        </term>
2809*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of allocation requests satisfied by
2810*1208bc7eSAndroid Build Coastguard Worker        all large size classes.</para></listitem>
2811*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2812*1208bc7eSAndroid Build Coastguard Worker
2813*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.nmalloc">
2814*1208bc7eSAndroid Build Coastguard Worker        <term>
2815*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nmalloc</mallctl>
2816*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2817*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2818*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2819*1208bc7eSAndroid Build Coastguard Worker        </term>
2820*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a bin region of the
2821*1208bc7eSAndroid Build Coastguard Worker        corresponding size class was allocated from the arena, whether to fill
2822*1208bc7eSAndroid Build Coastguard Worker        the relevant tcache if <link
2823*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled, or
2824*1208bc7eSAndroid Build Coastguard Worker        to directly satisfy an allocation request otherwise.</para></listitem>
2825*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2826*1208bc7eSAndroid Build Coastguard Worker
2827*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.ndalloc">
2828*1208bc7eSAndroid Build Coastguard Worker        <term>
2829*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.ndalloc</mallctl>
2830*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2831*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2832*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2833*1208bc7eSAndroid Build Coastguard Worker        </term>
2834*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a bin region of the
2835*1208bc7eSAndroid Build Coastguard Worker        corresponding size class was returned to the arena, whether to flush the
2836*1208bc7eSAndroid Build Coastguard Worker        relevant tcache if <link
2837*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled, or
2838*1208bc7eSAndroid Build Coastguard Worker        to directly deallocate an allocation otherwise.</para></listitem>
2839*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2840*1208bc7eSAndroid Build Coastguard Worker
2841*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.nrequests">
2842*1208bc7eSAndroid Build Coastguard Worker        <term>
2843*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nrequests</mallctl>
2844*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2845*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2846*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2847*1208bc7eSAndroid Build Coastguard Worker        </term>
2848*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of allocation requests satisfied by
2849*1208bc7eSAndroid Build Coastguard Worker        bin regions of the corresponding size class.</para></listitem>
2850*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2851*1208bc7eSAndroid Build Coastguard Worker
2852*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.curregs">
2853*1208bc7eSAndroid Build Coastguard Worker        <term>
2854*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curregs</mallctl>
2855*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2856*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2857*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2858*1208bc7eSAndroid Build Coastguard Worker        </term>
2859*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current number of regions for this size
2860*1208bc7eSAndroid Build Coastguard Worker        class.</para></listitem>
2861*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2862*1208bc7eSAndroid Build Coastguard Worker
2863*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.nfills">
2864*1208bc7eSAndroid Build Coastguard Worker        <term>
2865*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nfills</mallctl>
2866*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2867*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2868*1208bc7eSAndroid Build Coastguard Worker        </term>
2869*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of tcache fills.</para></listitem>
2870*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2871*1208bc7eSAndroid Build Coastguard Worker
2872*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.nflushes">
2873*1208bc7eSAndroid Build Coastguard Worker        <term>
2874*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nflushes</mallctl>
2875*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2876*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2877*1208bc7eSAndroid Build Coastguard Worker        </term>
2878*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of tcache flushes.</para></listitem>
2879*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2880*1208bc7eSAndroid Build Coastguard Worker
2881*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.nslabs">
2882*1208bc7eSAndroid Build Coastguard Worker        <term>
2883*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nslabs</mallctl>
2884*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2885*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2886*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2887*1208bc7eSAndroid Build Coastguard Worker        </term>
2888*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of slabs created.</para></listitem>
2889*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2890*1208bc7eSAndroid Build Coastguard Worker
2891*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.nreslabs">
2892*1208bc7eSAndroid Build Coastguard Worker        <term>
2893*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nreslabs</mallctl>
2894*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2895*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2896*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2897*1208bc7eSAndroid Build Coastguard Worker        </term>
2898*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times the current slab from which
2899*1208bc7eSAndroid Build Coastguard Worker        to allocate changed.</para></listitem>
2900*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2901*1208bc7eSAndroid Build Coastguard Worker
2902*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.j.curslabs">
2903*1208bc7eSAndroid Build Coastguard Worker        <term>
2904*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curslabs</mallctl>
2905*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2906*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2907*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2908*1208bc7eSAndroid Build Coastguard Worker        </term>
2909*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current number of slabs.</para></listitem>
2910*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2911*1208bc7eSAndroid Build Coastguard Worker
2912*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.bins.mutex">
2913*1208bc7eSAndroid Build Coastguard Worker        <term>
2914*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.mutex.{counter}</mallctl>
2915*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
2916*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2917*1208bc7eSAndroid Build Coastguard Worker        </term>
2918*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on
2919*1208bc7eSAndroid Build Coastguard Worker        <varname>arena.&lt;i&gt;.bins.&lt;j&gt;</varname> mutex (arena bin
2920*1208bc7eSAndroid Build Coastguard Worker        scope; bin operation related).  <mallctl>{counter}</mallctl> is one of
2921*1208bc7eSAndroid Build Coastguard Worker        the counters in <link linkend="mutex_counters">mutex profiling
2922*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
2923*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2924*1208bc7eSAndroid Build Coastguard Worker
2925*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.lextents.j.nmalloc">
2926*1208bc7eSAndroid Build Coastguard Worker        <term>
2927*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.lextents.&lt;j&gt;.nmalloc</mallctl>
2928*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2929*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2930*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2931*1208bc7eSAndroid Build Coastguard Worker        </term>
2932*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a large extent of the
2933*1208bc7eSAndroid Build Coastguard Worker        corresponding size class was allocated from the arena, whether to fill
2934*1208bc7eSAndroid Build Coastguard Worker        the relevant tcache if <link
2935*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and
2936*1208bc7eSAndroid Build Coastguard Worker        the size class is within the range being cached, or to directly satisfy
2937*1208bc7eSAndroid Build Coastguard Worker        an allocation request otherwise.</para></listitem>
2938*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2939*1208bc7eSAndroid Build Coastguard Worker
2940*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.lextents.j.ndalloc">
2941*1208bc7eSAndroid Build Coastguard Worker        <term>
2942*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.lextents.&lt;j&gt;.ndalloc</mallctl>
2943*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2944*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2945*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2946*1208bc7eSAndroid Build Coastguard Worker        </term>
2947*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of times a large extent of the
2948*1208bc7eSAndroid Build Coastguard Worker        corresponding size class was returned to the arena, whether to flush the
2949*1208bc7eSAndroid Build Coastguard Worker        relevant tcache if <link
2950*1208bc7eSAndroid Build Coastguard Worker        linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and
2951*1208bc7eSAndroid Build Coastguard Worker        the size class is within the range being cached, or to directly
2952*1208bc7eSAndroid Build Coastguard Worker        deallocate an allocation otherwise.</para></listitem>
2953*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2954*1208bc7eSAndroid Build Coastguard Worker
2955*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.lextents.j.nrequests">
2956*1208bc7eSAndroid Build Coastguard Worker        <term>
2957*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.lextents.&lt;j&gt;.nrequests</mallctl>
2958*1208bc7eSAndroid Build Coastguard Worker          (<type>uint64_t</type>)
2959*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2960*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2961*1208bc7eSAndroid Build Coastguard Worker        </term>
2962*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Cumulative number of allocation requests satisfied by
2963*1208bc7eSAndroid Build Coastguard Worker        large extents of the corresponding size class.</para></listitem>
2964*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2965*1208bc7eSAndroid Build Coastguard Worker
2966*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.lextents.j.curlextents">
2967*1208bc7eSAndroid Build Coastguard Worker        <term>
2968*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.lextents.&lt;j&gt;.curlextents</mallctl>
2969*1208bc7eSAndroid Build Coastguard Worker          (<type>size_t</type>)
2970*1208bc7eSAndroid Build Coastguard Worker          <literal>r-</literal>
2971*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2972*1208bc7eSAndroid Build Coastguard Worker        </term>
2973*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Current number of large allocations for this size class.
2974*1208bc7eSAndroid Build Coastguard Worker        </para></listitem>
2975*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2976*1208bc7eSAndroid Build Coastguard Worker
2977*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.large">
2978*1208bc7eSAndroid Build Coastguard Worker        <term>
2979*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.large.{counter}</mallctl>
2980*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
2981*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2982*1208bc7eSAndroid Build Coastguard Worker        </term>
2983*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.large</varname>
2984*1208bc7eSAndroid Build Coastguard Worker        mutex (arena scope; large allocation related).
2985*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
2986*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
2987*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
2988*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
2989*1208bc7eSAndroid Build Coastguard Worker
2990*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.extent_avail">
2991*1208bc7eSAndroid Build Coastguard Worker        <term>
2992*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.extent_avail.{counter}</mallctl>
2993*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
2994*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
2995*1208bc7eSAndroid Build Coastguard Worker        </term>
2996*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.extent_avail
2997*1208bc7eSAndroid Build Coastguard Worker        </varname> mutex (arena scope; extent avail related).
2998*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
2999*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3000*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3001*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3002*1208bc7eSAndroid Build Coastguard Worker
3003*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.extents_dirty">
3004*1208bc7eSAndroid Build Coastguard Worker        <term>
3005*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.extents_dirty.{counter}</mallctl>
3006*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3007*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3008*1208bc7eSAndroid Build Coastguard Worker        </term>
3009*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.extents_dirty
3010*1208bc7eSAndroid Build Coastguard Worker        </varname> mutex (arena scope; dirty extents related).
3011*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
3012*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3013*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3014*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3015*1208bc7eSAndroid Build Coastguard Worker
3016*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.extents_muzzy">
3017*1208bc7eSAndroid Build Coastguard Worker        <term>
3018*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.extents_muzzy.{counter}</mallctl>
3019*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3020*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3021*1208bc7eSAndroid Build Coastguard Worker        </term>
3022*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.extents_muzzy
3023*1208bc7eSAndroid Build Coastguard Worker        </varname> mutex (arena scope; muzzy extents related).
3024*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
3025*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3026*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3027*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3028*1208bc7eSAndroid Build Coastguard Worker
3029*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.extents_retained">
3030*1208bc7eSAndroid Build Coastguard Worker        <term>
3031*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.extents_retained.{counter}</mallctl>
3032*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3033*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3034*1208bc7eSAndroid Build Coastguard Worker        </term>
3035*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.extents_retained
3036*1208bc7eSAndroid Build Coastguard Worker        </varname> mutex (arena scope; retained extents related).
3037*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
3038*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3039*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3040*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3041*1208bc7eSAndroid Build Coastguard Worker
3042*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.decay_dirty">
3043*1208bc7eSAndroid Build Coastguard Worker        <term>
3044*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.decay_dirty.{counter}</mallctl>
3045*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3046*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3047*1208bc7eSAndroid Build Coastguard Worker        </term>
3048*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.decay_dirty
3049*1208bc7eSAndroid Build Coastguard Worker        </varname> mutex (arena scope; decay for dirty pages related).
3050*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
3051*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3052*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3053*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3054*1208bc7eSAndroid Build Coastguard Worker
3055*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.decay_muzzy">
3056*1208bc7eSAndroid Build Coastguard Worker        <term>
3057*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.decay_muzzy.{counter}</mallctl>
3058*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3059*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3060*1208bc7eSAndroid Build Coastguard Worker        </term>
3061*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.decay_muzzy
3062*1208bc7eSAndroid Build Coastguard Worker        </varname> mutex (arena scope; decay for muzzy pages related).
3063*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
3064*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3065*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3066*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3067*1208bc7eSAndroid Build Coastguard Worker
3068*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.base">
3069*1208bc7eSAndroid Build Coastguard Worker        <term>
3070*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.base.{counter}</mallctl>
3071*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3072*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3073*1208bc7eSAndroid Build Coastguard Worker        </term>
3074*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on <varname>arena.&lt;i&gt;.base</varname>
3075*1208bc7eSAndroid Build Coastguard Worker        mutex (arena scope; base allocator related).
3076*1208bc7eSAndroid Build Coastguard Worker        <mallctl>{counter}</mallctl> is one of the counters in <link
3077*1208bc7eSAndroid Build Coastguard Worker        linkend="mutex_counters">mutex profiling
3078*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3079*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3080*1208bc7eSAndroid Build Coastguard Worker
3081*1208bc7eSAndroid Build Coastguard Worker      <varlistentry id="stats.arenas.i.mutexes.tcache_list">
3082*1208bc7eSAndroid Build Coastguard Worker        <term>
3083*1208bc7eSAndroid Build Coastguard Worker          <mallctl>stats.arenas.&lt;i&gt;.mutexes.tcache_list.{counter}</mallctl>
3084*1208bc7eSAndroid Build Coastguard Worker          (<type>counter specific type</type>) <literal>r-</literal>
3085*1208bc7eSAndroid Build Coastguard Worker          [<option>--enable-stats</option>]
3086*1208bc7eSAndroid Build Coastguard Worker        </term>
3087*1208bc7eSAndroid Build Coastguard Worker        <listitem><para>Statistics on
3088*1208bc7eSAndroid Build Coastguard Worker        <varname>arena.&lt;i&gt;.tcache_list</varname> mutex (arena scope;
3089*1208bc7eSAndroid Build Coastguard Worker        tcache to arena association related).  This mutex is expected to be
3090*1208bc7eSAndroid Build Coastguard Worker        accessed less often.  <mallctl>{counter}</mallctl> is one of the
3091*1208bc7eSAndroid Build Coastguard Worker        counters in <link linkend="mutex_counters">mutex profiling
3092*1208bc7eSAndroid Build Coastguard Worker        counters</link>.</para></listitem>
3093*1208bc7eSAndroid Build Coastguard Worker      </varlistentry>
3094*1208bc7eSAndroid Build Coastguard Worker
3095*1208bc7eSAndroid Build Coastguard Worker    </variablelist>
3096*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3097*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="heap_profile_format">
3098*1208bc7eSAndroid Build Coastguard Worker    <title>HEAP PROFILE FORMAT</title>
3099*1208bc7eSAndroid Build Coastguard Worker    <para>Although the heap profiling functionality was originally designed to
3100*1208bc7eSAndroid Build Coastguard Worker    be compatible with the
3101*1208bc7eSAndroid Build Coastguard Worker    <command>pprof</command> command that is developed as part of the <ulink
3102*1208bc7eSAndroid Build Coastguard Worker    url="http://code.google.com/p/gperftools/">gperftools
3103*1208bc7eSAndroid Build Coastguard Worker    package</ulink>, the addition of per thread heap profiling functionality
3104*1208bc7eSAndroid Build Coastguard Worker    required a different heap profile format.  The <command>jeprof</command>
3105*1208bc7eSAndroid Build Coastguard Worker    command is derived from <command>pprof</command>, with enhancements to
3106*1208bc7eSAndroid Build Coastguard Worker    support the heap profile format described here.</para>
3107*1208bc7eSAndroid Build Coastguard Worker
3108*1208bc7eSAndroid Build Coastguard Worker    <para>In the following hypothetical heap profile, <constant>[...]</constant>
3109*1208bc7eSAndroid Build Coastguard Worker    indicates elision for the sake of compactness.  <programlisting><![CDATA[
3110*1208bc7eSAndroid Build Coastguard Workerheap_v2/524288
3111*1208bc7eSAndroid Build Coastguard Worker  t*: 28106: 56637512 [0: 0]
3112*1208bc7eSAndroid Build Coastguard Worker  [...]
3113*1208bc7eSAndroid Build Coastguard Worker  t3: 352: 16777344 [0: 0]
3114*1208bc7eSAndroid Build Coastguard Worker  [...]
3115*1208bc7eSAndroid Build Coastguard Worker  t99: 17754: 29341640 [0: 0]
3116*1208bc7eSAndroid Build Coastguard Worker  [...]
3117*1208bc7eSAndroid Build Coastguard Worker@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...]
3118*1208bc7eSAndroid Build Coastguard Worker  t*: 13: 6688 [0: 0]
3119*1208bc7eSAndroid Build Coastguard Worker  t3: 12: 6496 [0: ]
3120*1208bc7eSAndroid Build Coastguard Worker  t99: 1: 192 [0: 0]
3121*1208bc7eSAndroid Build Coastguard Worker[...]
3122*1208bc7eSAndroid Build Coastguard Worker
3123*1208bc7eSAndroid Build Coastguard WorkerMAPPED_LIBRARIES:
3124*1208bc7eSAndroid Build Coastguard Worker[...]]]></programlisting> The following matches the above heap profile, but most
3125*1208bc7eSAndroid Build Coastguard Workertokens are replaced with <constant>&lt;description&gt;</constant> to indicate
3126*1208bc7eSAndroid Build Coastguard Workerdescriptions of the corresponding fields.  <programlisting><![CDATA[
3127*1208bc7eSAndroid Build Coastguard Worker<heap_profile_format_version>/<mean_sample_interval>
3128*1208bc7eSAndroid Build Coastguard Worker  <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
3129*1208bc7eSAndroid Build Coastguard Worker  [...]
3130*1208bc7eSAndroid Build Coastguard Worker  <thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
3131*1208bc7eSAndroid Build Coastguard Worker  [...]
3132*1208bc7eSAndroid Build Coastguard Worker  <thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
3133*1208bc7eSAndroid Build Coastguard Worker  [...]
3134*1208bc7eSAndroid Build Coastguard Worker@ <top_frame> <frame> [...] <frame> <frame> <frame> [...]
3135*1208bc7eSAndroid Build Coastguard Worker  <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
3136*1208bc7eSAndroid Build Coastguard Worker  <backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
3137*1208bc7eSAndroid Build Coastguard Worker  <backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
3138*1208bc7eSAndroid Build Coastguard Worker[...]
3139*1208bc7eSAndroid Build Coastguard Worker
3140*1208bc7eSAndroid Build Coastguard WorkerMAPPED_LIBRARIES:
3141*1208bc7eSAndroid Build Coastguard Worker</proc/<pid>/maps>]]></programlisting></para>
3142*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3143*1208bc7eSAndroid Build Coastguard Worker
3144*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="debugging_malloc_problems">
3145*1208bc7eSAndroid Build Coastguard Worker    <title>DEBUGGING MALLOC PROBLEMS</title>
3146*1208bc7eSAndroid Build Coastguard Worker    <para>When debugging, it is a good idea to configure/build jemalloc with
3147*1208bc7eSAndroid Build Coastguard Worker    the <option>--enable-debug</option> and <option>--enable-fill</option>
3148*1208bc7eSAndroid Build Coastguard Worker    options, and recompile the program with suitable options and symbols for
3149*1208bc7eSAndroid Build Coastguard Worker    debugger support.  When so configured, jemalloc incorporates a wide variety
3150*1208bc7eSAndroid Build Coastguard Worker    of run-time assertions that catch application errors such as double-free,
3151*1208bc7eSAndroid Build Coastguard Worker    write-after-free, etc.</para>
3152*1208bc7eSAndroid Build Coastguard Worker
3153*1208bc7eSAndroid Build Coastguard Worker    <para>Programs often accidentally depend on <quote>uninitialized</quote>
3154*1208bc7eSAndroid Build Coastguard Worker    memory actually being filled with zero bytes.  Junk filling
3155*1208bc7eSAndroid Build Coastguard Worker    (see the <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link>
3156*1208bc7eSAndroid Build Coastguard Worker    option) tends to expose such bugs in the form of obviously incorrect
3157*1208bc7eSAndroid Build Coastguard Worker    results and/or coredumps.  Conversely, zero
3158*1208bc7eSAndroid Build Coastguard Worker    filling (see the <link
3159*1208bc7eSAndroid Build Coastguard Worker    linkend="opt.zero"><mallctl>opt.zero</mallctl></link> option) eliminates
3160*1208bc7eSAndroid Build Coastguard Worker    the symptoms of such bugs.  Between these two options, it is usually
3161*1208bc7eSAndroid Build Coastguard Worker    possible to quickly detect, diagnose, and eliminate such bugs.</para>
3162*1208bc7eSAndroid Build Coastguard Worker
3163*1208bc7eSAndroid Build Coastguard Worker    <para>This implementation does not provide much detail about the problems
3164*1208bc7eSAndroid Build Coastguard Worker    it detects, because the performance impact for storing such information
3165*1208bc7eSAndroid Build Coastguard Worker    would be prohibitive.</para>
3166*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3167*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="diagnostic_messages">
3168*1208bc7eSAndroid Build Coastguard Worker    <title>DIAGNOSTIC MESSAGES</title>
3169*1208bc7eSAndroid Build Coastguard Worker    <para>If any of the memory allocation/deallocation functions detect an
3170*1208bc7eSAndroid Build Coastguard Worker    error or warning condition, a message will be printed to file descriptor
3171*1208bc7eSAndroid Build Coastguard Worker    <constant>STDERR_FILENO</constant>.  Errors will result in the process
3172*1208bc7eSAndroid Build Coastguard Worker    dumping core.  If the <link
3173*1208bc7eSAndroid Build Coastguard Worker    linkend="opt.abort"><mallctl>opt.abort</mallctl></link> option is set, most
3174*1208bc7eSAndroid Build Coastguard Worker    warnings are treated as errors.</para>
3175*1208bc7eSAndroid Build Coastguard Worker
3176*1208bc7eSAndroid Build Coastguard Worker    <para>The <varname>malloc_message</varname> variable allows the programmer
3177*1208bc7eSAndroid Build Coastguard Worker    to override the function which emits the text strings forming the errors
3178*1208bc7eSAndroid Build Coastguard Worker    and warnings if for some reason the <constant>STDERR_FILENO</constant> file
3179*1208bc7eSAndroid Build Coastguard Worker    descriptor is not suitable for this.
3180*1208bc7eSAndroid Build Coastguard Worker    <function>malloc_message()</function> takes the
3181*1208bc7eSAndroid Build Coastguard Worker    <parameter>cbopaque</parameter> pointer argument that is
3182*1208bc7eSAndroid Build Coastguard Worker    <constant>NULL</constant> unless overridden by the arguments in a call to
3183*1208bc7eSAndroid Build Coastguard Worker    <function>malloc_stats_print()</function>, followed by a string
3184*1208bc7eSAndroid Build Coastguard Worker    pointer.  Please note that doing anything which tries to allocate memory in
3185*1208bc7eSAndroid Build Coastguard Worker    this function is likely to result in a crash or deadlock.</para>
3186*1208bc7eSAndroid Build Coastguard Worker
3187*1208bc7eSAndroid Build Coastguard Worker    <para>All messages are prefixed by
3188*1208bc7eSAndroid Build Coastguard Worker    <quote><computeroutput>&lt;jemalloc&gt;: </computeroutput></quote>.</para>
3189*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3190*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="return_values">
3191*1208bc7eSAndroid Build Coastguard Worker    <title>RETURN VALUES</title>
3192*1208bc7eSAndroid Build Coastguard Worker    <refsect2>
3193*1208bc7eSAndroid Build Coastguard Worker      <title>Standard API</title>
3194*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>malloc()</function> and
3195*1208bc7eSAndroid Build Coastguard Worker      <function>calloc()</function> functions return a pointer to the
3196*1208bc7eSAndroid Build Coastguard Worker      allocated memory if successful; otherwise a <constant>NULL</constant>
3197*1208bc7eSAndroid Build Coastguard Worker      pointer is returned and <varname>errno</varname> is set to
3198*1208bc7eSAndroid Build Coastguard Worker      <errorname>ENOMEM</errorname>.</para>
3199*1208bc7eSAndroid Build Coastguard Worker
3200*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>posix_memalign()</function> function
3201*1208bc7eSAndroid Build Coastguard Worker      returns the value 0 if successful; otherwise it returns an error value.
3202*1208bc7eSAndroid Build Coastguard Worker      The <function>posix_memalign()</function> function will fail
3203*1208bc7eSAndroid Build Coastguard Worker      if:
3204*1208bc7eSAndroid Build Coastguard Worker        <variablelist>
3205*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3206*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>EINVAL</errorname></term>
3207*1208bc7eSAndroid Build Coastguard Worker
3208*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>The <parameter>alignment</parameter> parameter is
3209*1208bc7eSAndroid Build Coastguard Worker            not a power of 2 at least as large as
3210*1208bc7eSAndroid Build Coastguard Worker            <code language="C">sizeof(<type>void *</type>)</code>.
3211*1208bc7eSAndroid Build Coastguard Worker            </para></listitem>
3212*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3213*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3214*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>ENOMEM</errorname></term>
3215*1208bc7eSAndroid Build Coastguard Worker
3216*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Memory allocation error.</para></listitem>
3217*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3218*1208bc7eSAndroid Build Coastguard Worker        </variablelist>
3219*1208bc7eSAndroid Build Coastguard Worker      </para>
3220*1208bc7eSAndroid Build Coastguard Worker
3221*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>aligned_alloc()</function> function returns
3222*1208bc7eSAndroid Build Coastguard Worker      a pointer to the allocated memory if successful; otherwise a
3223*1208bc7eSAndroid Build Coastguard Worker      <constant>NULL</constant> pointer is returned and
3224*1208bc7eSAndroid Build Coastguard Worker      <varname>errno</varname> is set.  The
3225*1208bc7eSAndroid Build Coastguard Worker      <function>aligned_alloc()</function> function will fail if:
3226*1208bc7eSAndroid Build Coastguard Worker        <variablelist>
3227*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3228*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>EINVAL</errorname></term>
3229*1208bc7eSAndroid Build Coastguard Worker
3230*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>The <parameter>alignment</parameter> parameter is
3231*1208bc7eSAndroid Build Coastguard Worker            not a power of 2.
3232*1208bc7eSAndroid Build Coastguard Worker            </para></listitem>
3233*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3234*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3235*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>ENOMEM</errorname></term>
3236*1208bc7eSAndroid Build Coastguard Worker
3237*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Memory allocation error.</para></listitem>
3238*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3239*1208bc7eSAndroid Build Coastguard Worker        </variablelist>
3240*1208bc7eSAndroid Build Coastguard Worker      </para>
3241*1208bc7eSAndroid Build Coastguard Worker
3242*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>realloc()</function> function returns a
3243*1208bc7eSAndroid Build Coastguard Worker      pointer, possibly identical to <parameter>ptr</parameter>, to the
3244*1208bc7eSAndroid Build Coastguard Worker      allocated memory if successful; otherwise a <constant>NULL</constant>
3245*1208bc7eSAndroid Build Coastguard Worker      pointer is returned, and <varname>errno</varname> is set to
3246*1208bc7eSAndroid Build Coastguard Worker      <errorname>ENOMEM</errorname> if the error was the result of an
3247*1208bc7eSAndroid Build Coastguard Worker      allocation failure.  The <function>realloc()</function>
3248*1208bc7eSAndroid Build Coastguard Worker      function always leaves the original buffer intact when an error occurs.
3249*1208bc7eSAndroid Build Coastguard Worker      </para>
3250*1208bc7eSAndroid Build Coastguard Worker
3251*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>free()</function> function returns no
3252*1208bc7eSAndroid Build Coastguard Worker      value.</para>
3253*1208bc7eSAndroid Build Coastguard Worker    </refsect2>
3254*1208bc7eSAndroid Build Coastguard Worker    <refsect2>
3255*1208bc7eSAndroid Build Coastguard Worker      <title>Non-standard API</title>
3256*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>mallocx()</function> and
3257*1208bc7eSAndroid Build Coastguard Worker      <function>rallocx()</function> functions return a pointer to
3258*1208bc7eSAndroid Build Coastguard Worker      the allocated memory if successful; otherwise a <constant>NULL</constant>
3259*1208bc7eSAndroid Build Coastguard Worker      pointer is returned to indicate insufficient contiguous memory was
3260*1208bc7eSAndroid Build Coastguard Worker      available to service the allocation request.  </para>
3261*1208bc7eSAndroid Build Coastguard Worker
3262*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>xallocx()</function> function returns the
3263*1208bc7eSAndroid Build Coastguard Worker      real size of the resulting resized allocation pointed to by
3264*1208bc7eSAndroid Build Coastguard Worker      <parameter>ptr</parameter>, which is a value less than
3265*1208bc7eSAndroid Build Coastguard Worker      <parameter>size</parameter> if the allocation could not be adequately
3266*1208bc7eSAndroid Build Coastguard Worker      grown in place.  </para>
3267*1208bc7eSAndroid Build Coastguard Worker
3268*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>sallocx()</function> function returns the
3269*1208bc7eSAndroid Build Coastguard Worker      real size of the allocation pointed to by <parameter>ptr</parameter>.
3270*1208bc7eSAndroid Build Coastguard Worker      </para>
3271*1208bc7eSAndroid Build Coastguard Worker
3272*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>nallocx()</function> returns the real size
3273*1208bc7eSAndroid Build Coastguard Worker      that would result from a successful equivalent
3274*1208bc7eSAndroid Build Coastguard Worker      <function>mallocx()</function> function call, or zero if
3275*1208bc7eSAndroid Build Coastguard Worker      insufficient memory is available to perform the size computation.  </para>
3276*1208bc7eSAndroid Build Coastguard Worker
3277*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>mallctl()</function>,
3278*1208bc7eSAndroid Build Coastguard Worker      <function>mallctlnametomib()</function>, and
3279*1208bc7eSAndroid Build Coastguard Worker      <function>mallctlbymib()</function> functions return 0 on
3280*1208bc7eSAndroid Build Coastguard Worker      success; otherwise they return an error value.  The functions will fail
3281*1208bc7eSAndroid Build Coastguard Worker      if:
3282*1208bc7eSAndroid Build Coastguard Worker        <variablelist>
3283*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3284*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>EINVAL</errorname></term>
3285*1208bc7eSAndroid Build Coastguard Worker
3286*1208bc7eSAndroid Build Coastguard Worker            <listitem><para><parameter>newp</parameter> is not
3287*1208bc7eSAndroid Build Coastguard Worker            <constant>NULL</constant>, and <parameter>newlen</parameter> is too
3288*1208bc7eSAndroid Build Coastguard Worker            large or too small.  Alternatively, <parameter>*oldlenp</parameter>
3289*1208bc7eSAndroid Build Coastguard Worker            is too large or too small; in this case as much data as possible
3290*1208bc7eSAndroid Build Coastguard Worker            are read despite the error.</para></listitem>
3291*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3292*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3293*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>ENOENT</errorname></term>
3294*1208bc7eSAndroid Build Coastguard Worker
3295*1208bc7eSAndroid Build Coastguard Worker            <listitem><para><parameter>name</parameter> or
3296*1208bc7eSAndroid Build Coastguard Worker            <parameter>mib</parameter> specifies an unknown/invalid
3297*1208bc7eSAndroid Build Coastguard Worker            value.</para></listitem>
3298*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3299*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3300*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>EPERM</errorname></term>
3301*1208bc7eSAndroid Build Coastguard Worker
3302*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>Attempt to read or write void value, or attempt to
3303*1208bc7eSAndroid Build Coastguard Worker            write read-only value.</para></listitem>
3304*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3305*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3306*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>EAGAIN</errorname></term>
3307*1208bc7eSAndroid Build Coastguard Worker
3308*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>A memory allocation failure
3309*1208bc7eSAndroid Build Coastguard Worker            occurred.</para></listitem>
3310*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3311*1208bc7eSAndroid Build Coastguard Worker          <varlistentry>
3312*1208bc7eSAndroid Build Coastguard Worker            <term><errorname>EFAULT</errorname></term>
3313*1208bc7eSAndroid Build Coastguard Worker
3314*1208bc7eSAndroid Build Coastguard Worker            <listitem><para>An interface with side effects failed in some way
3315*1208bc7eSAndroid Build Coastguard Worker            not directly related to <function>mallctl*()</function>
3316*1208bc7eSAndroid Build Coastguard Worker            read/write processing.</para></listitem>
3317*1208bc7eSAndroid Build Coastguard Worker          </varlistentry>
3318*1208bc7eSAndroid Build Coastguard Worker        </variablelist>
3319*1208bc7eSAndroid Build Coastguard Worker      </para>
3320*1208bc7eSAndroid Build Coastguard Worker
3321*1208bc7eSAndroid Build Coastguard Worker      <para>The <function>malloc_usable_size()</function> function
3322*1208bc7eSAndroid Build Coastguard Worker      returns the usable size of the allocation pointed to by
3323*1208bc7eSAndroid Build Coastguard Worker      <parameter>ptr</parameter>.  </para>
3324*1208bc7eSAndroid Build Coastguard Worker    </refsect2>
3325*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3326*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="environment">
3327*1208bc7eSAndroid Build Coastguard Worker    <title>ENVIRONMENT</title>
3328*1208bc7eSAndroid Build Coastguard Worker    <para>The following environment variable affects the execution of the
3329*1208bc7eSAndroid Build Coastguard Worker    allocation functions:
3330*1208bc7eSAndroid Build Coastguard Worker      <variablelist>
3331*1208bc7eSAndroid Build Coastguard Worker        <varlistentry>
3332*1208bc7eSAndroid Build Coastguard Worker          <term><envar>MALLOC_CONF</envar></term>
3333*1208bc7eSAndroid Build Coastguard Worker
3334*1208bc7eSAndroid Build Coastguard Worker          <listitem><para>If the environment variable
3335*1208bc7eSAndroid Build Coastguard Worker          <envar>MALLOC_CONF</envar> is set, the characters it contains
3336*1208bc7eSAndroid Build Coastguard Worker          will be interpreted as options.</para></listitem>
3337*1208bc7eSAndroid Build Coastguard Worker        </varlistentry>
3338*1208bc7eSAndroid Build Coastguard Worker      </variablelist>
3339*1208bc7eSAndroid Build Coastguard Worker    </para>
3340*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3341*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="examples">
3342*1208bc7eSAndroid Build Coastguard Worker    <title>EXAMPLES</title>
3343*1208bc7eSAndroid Build Coastguard Worker    <para>To dump core whenever a problem occurs:
3344*1208bc7eSAndroid Build Coastguard Worker      <screen>ln -s 'abort:true' /etc/malloc.conf</screen>
3345*1208bc7eSAndroid Build Coastguard Worker    </para>
3346*1208bc7eSAndroid Build Coastguard Worker    <para>To specify in the source that only one arena should be automatically
3347*1208bc7eSAndroid Build Coastguard Worker    created:
3348*1208bc7eSAndroid Build Coastguard Worker      <programlisting language="C"><![CDATA[
3349*1208bc7eSAndroid Build Coastguard Workermalloc_conf = "narenas:1";]]></programlisting></para>
3350*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3351*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="see_also">
3352*1208bc7eSAndroid Build Coastguard Worker    <title>SEE ALSO</title>
3353*1208bc7eSAndroid Build Coastguard Worker    <para><citerefentry><refentrytitle>madvise</refentrytitle>
3354*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry>,
3355*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>mmap</refentrytitle>
3356*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry>,
3357*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>sbrk</refentrytitle>
3358*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry>,
3359*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>utrace</refentrytitle>
3360*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>2</manvolnum></citerefentry>,
3361*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>alloca</refentrytitle>
3362*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>3</manvolnum></citerefentry>,
3363*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>atexit</refentrytitle>
3364*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>3</manvolnum></citerefentry>,
3365*1208bc7eSAndroid Build Coastguard Worker    <citerefentry><refentrytitle>getpagesize</refentrytitle>
3366*1208bc7eSAndroid Build Coastguard Worker    <manvolnum>3</manvolnum></citerefentry></para>
3367*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3368*1208bc7eSAndroid Build Coastguard Worker  <refsect1 id="standards">
3369*1208bc7eSAndroid Build Coastguard Worker    <title>STANDARDS</title>
3370*1208bc7eSAndroid Build Coastguard Worker    <para>The <function>malloc()</function>,
3371*1208bc7eSAndroid Build Coastguard Worker    <function>calloc()</function>,
3372*1208bc7eSAndroid Build Coastguard Worker    <function>realloc()</function>, and
3373*1208bc7eSAndroid Build Coastguard Worker    <function>free()</function> functions conform to ISO/IEC
3374*1208bc7eSAndroid Build Coastguard Worker    9899:1990 (<quote>ISO C90</quote>).</para>
3375*1208bc7eSAndroid Build Coastguard Worker
3376*1208bc7eSAndroid Build Coastguard Worker    <para>The <function>posix_memalign()</function> function conforms
3377*1208bc7eSAndroid Build Coastguard Worker    to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para>
3378*1208bc7eSAndroid Build Coastguard Worker  </refsect1>
3379*1208bc7eSAndroid Build Coastguard Worker</refentry>
3380