1*c43cad87SWarner Losh<<<<<<< HEAD 2*c43cad87SWarner Losh<?xml version='1.0' encoding='UTF-8'?> 3*c43cad87SWarner Losh<?xml-stylesheet type="text/xsl" 4*c43cad87SWarner Losh href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?> 5*c43cad87SWarner Losh<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 6*c43cad87SWarner Losh "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 7*c43cad87SWarner Losh]> 8*c43cad87SWarner Losh 9*c43cad87SWarner Losh<refentry> 10*c43cad87SWarner Losh <refentryinfo> 11*c43cad87SWarner Losh <title>User Manual</title> 12*c43cad87SWarner Losh <productname>jemalloc</productname> 13*c43cad87SWarner Losh <releaseinfo role="version">@jemalloc_version@</releaseinfo> 14*c43cad87SWarner Losh <authorgroup> 15*c43cad87SWarner Losh <author> 16*c43cad87SWarner Losh <firstname>Jason</firstname> 17*c43cad87SWarner Losh <surname>Evans</surname> 18*c43cad87SWarner Losh <personblurb>Author</personblurb> 19*c43cad87SWarner Losh </author> 20*c43cad87SWarner Losh </authorgroup> 21*c43cad87SWarner Losh </refentryinfo> 22*c43cad87SWarner Losh <refmeta> 23*c43cad87SWarner Losh <refentrytitle>JEMALLOC</refentrytitle> 24*c43cad87SWarner Losh <manvolnum>3</manvolnum> 25*c43cad87SWarner Losh </refmeta> 26*c43cad87SWarner Losh <refnamediv> 27*c43cad87SWarner Losh <refdescriptor>jemalloc</refdescriptor> 28*c43cad87SWarner Losh <refname>jemalloc</refname> 29*c43cad87SWarner Losh <!-- Each refname causes a man page file to be created. Only if this were 30*c43cad87SWarner Losh the system malloc(3) implementation would these files be appropriate. 31*c43cad87SWarner Losh <refname>malloc</refname> 32*c43cad87SWarner Losh <refname>calloc</refname> 33*c43cad87SWarner Losh <refname>posix_memalign</refname> 34*c43cad87SWarner Losh <refname>aligned_alloc</refname> 35*c43cad87SWarner Losh <refname>realloc</refname> 36*c43cad87SWarner Losh <refname>free</refname> 37*c43cad87SWarner Losh <refname>mallocx</refname> 38*c43cad87SWarner Losh <refname>rallocx</refname> 39*c43cad87SWarner Losh <refname>xallocx</refname> 40*c43cad87SWarner Losh <refname>sallocx</refname> 41*c43cad87SWarner Losh <refname>dallocx</refname> 42*c43cad87SWarner Losh <refname>sdallocx</refname> 43*c43cad87SWarner Losh <refname>nallocx</refname> 44*c43cad87SWarner Losh <refname>mallctl</refname> 45*c43cad87SWarner Losh <refname>mallctlnametomib</refname> 46*c43cad87SWarner Losh <refname>mallctlbymib</refname> 47*c43cad87SWarner Losh <refname>malloc_stats_print</refname> 48*c43cad87SWarner Losh <refname>malloc_usable_size</refname> 49*c43cad87SWarner Losh --> 50*c43cad87SWarner Losh <refpurpose>general purpose memory allocation functions</refpurpose> 51*c43cad87SWarner Losh </refnamediv> 52*c43cad87SWarner Losh <refsect1 id="library"> 53*c43cad87SWarner Losh <title>LIBRARY</title> 54*c43cad87SWarner Losh <para>This manual describes jemalloc @jemalloc_version@. More information 55*c43cad87SWarner Losh can be found at the <ulink 56*c43cad87SWarner Losh url="http://jemalloc.net/">jemalloc website</ulink>.</para> 57*c43cad87SWarner Losh 58*c43cad87SWarner Losh <para>The following configuration options are enabled in libc's built-in 59*c43cad87SWarner Losh jemalloc: <option>--enable-fill</option>, 60*c43cad87SWarner Losh <option>--enable-lazy-lock</option>, <option>--enable-stats</option>, 61*c43cad87SWarner Losh <option>--enable-utrace</option>, <option>--enable-xmalloc</option>, and 62*c43cad87SWarner Losh <option>--with-malloc-conf=abort_conf:false</option>. 63*c43cad87SWarner Losh Additionally, <option>--enable-debug</option> is enabled in development 64*c43cad87SWarner Losh versions of FreeBSD (controlled by the 65*c43cad87SWarner Losh <constant>MK_MALLOC_PRODUCTION</constant> make variable).</para> 66*c43cad87SWarner Losh 67*c43cad87SWarner Losh </refsect1> 68*c43cad87SWarner Losh <refsynopsisdiv> 69*c43cad87SWarner Losh <title>SYNOPSIS</title> 70*c43cad87SWarner Losh <funcsynopsis> 71*c43cad87SWarner Losh <funcsynopsisinfo>#include <<filename class="headerfile">stdlib.h</filename>> 72*c43cad87SWarner Losh#include <<filename class="headerfile">malloc_np.h</filename>></funcsynopsisinfo> 73*c43cad87SWarner Losh <refsect2> 74*c43cad87SWarner Losh <title>Standard API</title> 75*c43cad87SWarner Losh <funcprototype> 76*c43cad87SWarner Losh <funcdef>void *<function>malloc</function></funcdef> 77*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 78*c43cad87SWarner Losh </funcprototype> 79*c43cad87SWarner Losh <funcprototype> 80*c43cad87SWarner Losh <funcdef>void *<function>calloc</function></funcdef> 81*c43cad87SWarner Losh <paramdef>size_t <parameter>number</parameter></paramdef> 82*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 83*c43cad87SWarner Losh </funcprototype> 84*c43cad87SWarner Losh <funcprototype> 85*c43cad87SWarner Losh <funcdef>int <function>posix_memalign</function></funcdef> 86*c43cad87SWarner Losh <paramdef>void **<parameter>ptr</parameter></paramdef> 87*c43cad87SWarner Losh <paramdef>size_t <parameter>alignment</parameter></paramdef> 88*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 89*c43cad87SWarner Losh </funcprototype> 90*c43cad87SWarner Losh <funcprototype> 91*c43cad87SWarner Losh <funcdef>void *<function>aligned_alloc</function></funcdef> 92*c43cad87SWarner Losh <paramdef>size_t <parameter>alignment</parameter></paramdef> 93*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 94*c43cad87SWarner Losh </funcprototype> 95*c43cad87SWarner Losh <funcprototype> 96*c43cad87SWarner Losh <funcdef>void *<function>realloc</function></funcdef> 97*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 98*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 99*c43cad87SWarner Losh </funcprototype> 100*c43cad87SWarner Losh <funcprototype> 101*c43cad87SWarner Losh <funcdef>void <function>free</function></funcdef> 102*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 103*c43cad87SWarner Losh </funcprototype> 104*c43cad87SWarner Losh </refsect2> 105*c43cad87SWarner Losh <refsect2> 106*c43cad87SWarner Losh <title>Non-standard API</title> 107*c43cad87SWarner Losh <funcprototype> 108*c43cad87SWarner Losh <funcdef>void *<function>mallocx</function></funcdef> 109*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 110*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 111*c43cad87SWarner Losh </funcprototype> 112*c43cad87SWarner Losh <funcprototype> 113*c43cad87SWarner Losh <funcdef>void *<function>rallocx</function></funcdef> 114*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 115*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 116*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 117*c43cad87SWarner Losh </funcprototype> 118*c43cad87SWarner Losh <funcprototype> 119*c43cad87SWarner Losh <funcdef>size_t <function>xallocx</function></funcdef> 120*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 121*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 122*c43cad87SWarner Losh <paramdef>size_t <parameter>extra</parameter></paramdef> 123*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 124*c43cad87SWarner Losh </funcprototype> 125*c43cad87SWarner Losh <funcprototype> 126*c43cad87SWarner Losh <funcdef>size_t <function>sallocx</function></funcdef> 127*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 128*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 129*c43cad87SWarner Losh </funcprototype> 130*c43cad87SWarner Losh <funcprototype> 131*c43cad87SWarner Losh <funcdef>void <function>dallocx</function></funcdef> 132*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 133*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 134*c43cad87SWarner Losh </funcprototype> 135*c43cad87SWarner Losh <funcprototype> 136*c43cad87SWarner Losh <funcdef>void <function>sdallocx</function></funcdef> 137*c43cad87SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 138*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 139*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 140*c43cad87SWarner Losh </funcprototype> 141*c43cad87SWarner Losh <funcprototype> 142*c43cad87SWarner Losh <funcdef>size_t <function>nallocx</function></funcdef> 143*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 144*c43cad87SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 145*c43cad87SWarner Losh </funcprototype> 146*c43cad87SWarner Losh <funcprototype> 147*c43cad87SWarner Losh <funcdef>int <function>mallctl</function></funcdef> 148*c43cad87SWarner Losh <paramdef>const char *<parameter>name</parameter></paramdef> 149*c43cad87SWarner Losh <paramdef>void *<parameter>oldp</parameter></paramdef> 150*c43cad87SWarner Losh <paramdef>size_t *<parameter>oldlenp</parameter></paramdef> 151*c43cad87SWarner Losh <paramdef>void *<parameter>newp</parameter></paramdef> 152*c43cad87SWarner Losh <paramdef>size_t <parameter>newlen</parameter></paramdef> 153*c43cad87SWarner Losh </funcprototype> 154*c43cad87SWarner Losh <funcprototype> 155*c43cad87SWarner Losh <funcdef>int <function>mallctlnametomib</function></funcdef> 156*c43cad87SWarner Losh <paramdef>const char *<parameter>name</parameter></paramdef> 157*c43cad87SWarner Losh <paramdef>size_t *<parameter>mibp</parameter></paramdef> 158*c43cad87SWarner Losh <paramdef>size_t *<parameter>miblenp</parameter></paramdef> 159*c43cad87SWarner Losh </funcprototype> 160*c43cad87SWarner Losh <funcprototype> 161*c43cad87SWarner Losh <funcdef>int <function>mallctlbymib</function></funcdef> 162*c43cad87SWarner Losh <paramdef>const size_t *<parameter>mib</parameter></paramdef> 163*c43cad87SWarner Losh <paramdef>size_t <parameter>miblen</parameter></paramdef> 164*c43cad87SWarner Losh <paramdef>void *<parameter>oldp</parameter></paramdef> 165*c43cad87SWarner Losh <paramdef>size_t *<parameter>oldlenp</parameter></paramdef> 166*c43cad87SWarner Losh <paramdef>void *<parameter>newp</parameter></paramdef> 167*c43cad87SWarner Losh <paramdef>size_t <parameter>newlen</parameter></paramdef> 168*c43cad87SWarner Losh </funcprototype> 169*c43cad87SWarner Losh <funcprototype> 170*c43cad87SWarner Losh <funcdef>void <function>malloc_stats_print</function></funcdef> 171*c43cad87SWarner Losh <paramdef>void <parameter>(*write_cb)</parameter> 172*c43cad87SWarner Losh <funcparams>void *, const char *</funcparams> 173*c43cad87SWarner Losh </paramdef> 174*c43cad87SWarner Losh <paramdef>void *<parameter>cbopaque</parameter></paramdef> 175*c43cad87SWarner Losh <paramdef>const char *<parameter>opts</parameter></paramdef> 176*c43cad87SWarner Losh </funcprototype> 177*c43cad87SWarner Losh <funcprototype> 178*c43cad87SWarner Losh <funcdef>size_t <function>malloc_usable_size</function></funcdef> 179*c43cad87SWarner Losh <paramdef>const void *<parameter>ptr</parameter></paramdef> 180*c43cad87SWarner Losh </funcprototype> 181*c43cad87SWarner Losh <funcprototype> 182*c43cad87SWarner Losh <funcdef>void <function>(*malloc_message)</function></funcdef> 183*c43cad87SWarner Losh <paramdef>void *<parameter>cbopaque</parameter></paramdef> 184*c43cad87SWarner Losh <paramdef>const char *<parameter>s</parameter></paramdef> 185*c43cad87SWarner Losh </funcprototype> 186*c43cad87SWarner Losh <para><type>const char *</type><varname>malloc_conf</varname>;</para> 187*c43cad87SWarner Losh </refsect2> 188*c43cad87SWarner Losh </funcsynopsis> 189*c43cad87SWarner Losh </refsynopsisdiv> 190*c43cad87SWarner Losh <refsect1 id="description"> 191*c43cad87SWarner Losh <title>DESCRIPTION</title> 192*c43cad87SWarner Losh <refsect2> 193*c43cad87SWarner Losh <title>Standard API</title> 194*c43cad87SWarner Losh 195*c43cad87SWarner Losh <para>The <function>malloc()</function> function allocates 196*c43cad87SWarner Losh <parameter>size</parameter> bytes of uninitialized memory. The allocated 197*c43cad87SWarner Losh space is suitably aligned (after possible pointer coercion) for storage 198*c43cad87SWarner Losh of any type of object.</para> 199*c43cad87SWarner Losh 200*c43cad87SWarner Losh <para>The <function>calloc()</function> function allocates 201*c43cad87SWarner Losh space for <parameter>number</parameter> objects, each 202*c43cad87SWarner Losh <parameter>size</parameter> bytes in length. The result is identical to 203*c43cad87SWarner Losh calling <function>malloc()</function> with an argument of 204*c43cad87SWarner Losh <parameter>number</parameter> * <parameter>size</parameter>, with the 205*c43cad87SWarner Losh exception that the allocated memory is explicitly initialized to zero 206*c43cad87SWarner Losh bytes.</para> 207*c43cad87SWarner Losh 208*c43cad87SWarner Losh <para>The <function>posix_memalign()</function> function 209*c43cad87SWarner Losh allocates <parameter>size</parameter> bytes of memory such that the 210*c43cad87SWarner Losh allocation's base address is a multiple of 211*c43cad87SWarner Losh <parameter>alignment</parameter>, and returns the allocation in the value 212*c43cad87SWarner Losh pointed to by <parameter>ptr</parameter>. The requested 213*c43cad87SWarner Losh <parameter>alignment</parameter> must be a power of 2 at least as large as 214*c43cad87SWarner Losh <code language="C">sizeof(<type>void *</type>)</code>.</para> 215*c43cad87SWarner Losh 216*c43cad87SWarner Losh <para>The <function>aligned_alloc()</function> function 217*c43cad87SWarner Losh allocates <parameter>size</parameter> bytes of memory such that the 218*c43cad87SWarner Losh allocation's base address is a multiple of 219*c43cad87SWarner Losh <parameter>alignment</parameter>. The requested 220*c43cad87SWarner Losh <parameter>alignment</parameter> must be a power of 2. Behavior is 221*c43cad87SWarner Losh undefined if <parameter>size</parameter> is not an integral multiple of 222*c43cad87SWarner Losh <parameter>alignment</parameter>.</para> 223*c43cad87SWarner Losh 224*c43cad87SWarner Losh <para>The <function>realloc()</function> function changes the 225*c43cad87SWarner Losh size of the previously allocated memory referenced by 226*c43cad87SWarner Losh <parameter>ptr</parameter> to <parameter>size</parameter> bytes. The 227*c43cad87SWarner Losh contents of the memory are unchanged up to the lesser of the new and old 228*c43cad87SWarner Losh sizes. If the new size is larger, the contents of the newly allocated 229*c43cad87SWarner Losh portion of the memory are undefined. Upon success, the memory referenced 230*c43cad87SWarner Losh by <parameter>ptr</parameter> is freed and a pointer to the newly 231*c43cad87SWarner Losh allocated memory is returned. Note that 232*c43cad87SWarner Losh <function>realloc()</function> may move the memory allocation, 233*c43cad87SWarner Losh resulting in a different return value than <parameter>ptr</parameter>. 234*c43cad87SWarner Losh If <parameter>ptr</parameter> is <constant>NULL</constant>, the 235*c43cad87SWarner Losh <function>realloc()</function> function behaves identically to 236*c43cad87SWarner Losh <function>malloc()</function> for the specified size.</para> 237*c43cad87SWarner Losh 238*c43cad87SWarner Losh <para>The <function>free()</function> function causes the 239*c43cad87SWarner Losh allocated memory referenced by <parameter>ptr</parameter> to be made 240*c43cad87SWarner Losh available for future allocations. If <parameter>ptr</parameter> is 241*c43cad87SWarner Losh <constant>NULL</constant>, no action occurs.</para> 242*c43cad87SWarner Losh </refsect2> 243*c43cad87SWarner Losh <refsect2> 244*c43cad87SWarner Losh <title>Non-standard API</title> 245*c43cad87SWarner Losh <para>The <function>mallocx()</function>, 246*c43cad87SWarner Losh <function>rallocx()</function>, 247*c43cad87SWarner Losh <function>xallocx()</function>, 248*c43cad87SWarner Losh <function>sallocx()</function>, 249*c43cad87SWarner Losh <function>dallocx()</function>, 250*c43cad87SWarner Losh <function>sdallocx()</function>, and 251*c43cad87SWarner Losh <function>nallocx()</function> functions all have a 252*c43cad87SWarner Losh <parameter>flags</parameter> argument that can be used to specify 253*c43cad87SWarner Losh options. The functions only check the options that are contextually 254*c43cad87SWarner Losh relevant. Use bitwise or (<code language="C">|</code>) operations to 255*c43cad87SWarner Losh specify one or more of the following: 256*c43cad87SWarner Losh <variablelist> 257*c43cad87SWarner Losh <varlistentry id="MALLOCX_LG_ALIGN"> 258*c43cad87SWarner Losh <term><constant>MALLOCX_LG_ALIGN(<parameter>la</parameter>) 259*c43cad87SWarner Losh </constant></term> 260*c43cad87SWarner Losh 261*c43cad87SWarner Losh <listitem><para>Align the memory allocation to start at an address 262*c43cad87SWarner Losh that is a multiple of <code language="C">(1 << 263*c43cad87SWarner Losh <parameter>la</parameter>)</code>. This macro does not validate 264*c43cad87SWarner Losh that <parameter>la</parameter> is within the valid 265*c43cad87SWarner Losh range.</para></listitem> 266*c43cad87SWarner Losh </varlistentry> 267*c43cad87SWarner Losh <varlistentry id="MALLOCX_ALIGN"> 268*c43cad87SWarner Losh <term><constant>MALLOCX_ALIGN(<parameter>a</parameter>) 269*c43cad87SWarner Losh </constant></term> 270*c43cad87SWarner Losh 271*c43cad87SWarner Losh <listitem><para>Align the memory allocation to start at an address 272*c43cad87SWarner Losh that is a multiple of <parameter>a</parameter>, where 273*c43cad87SWarner Losh <parameter>a</parameter> is a power of two. This macro does not 274*c43cad87SWarner Losh validate that <parameter>a</parameter> is a power of 2. 275*c43cad87SWarner Losh </para></listitem> 276*c43cad87SWarner Losh </varlistentry> 277*c43cad87SWarner Losh <varlistentry id="MALLOCX_ZERO"> 278*c43cad87SWarner Losh <term><constant>MALLOCX_ZERO</constant></term> 279*c43cad87SWarner Losh 280*c43cad87SWarner Losh <listitem><para>Initialize newly allocated memory to contain zero 281*c43cad87SWarner Losh bytes. In the growing reallocation case, the real size prior to 282*c43cad87SWarner Losh reallocation defines the boundary between untouched bytes and those 283*c43cad87SWarner Losh that are initialized to contain zero bytes. If this macro is 284*c43cad87SWarner Losh absent, newly allocated memory is uninitialized.</para></listitem> 285*c43cad87SWarner Losh </varlistentry> 286*c43cad87SWarner Losh <varlistentry id="MALLOCX_TCACHE"> 287*c43cad87SWarner Losh <term><constant>MALLOCX_TCACHE(<parameter>tc</parameter>) 288*c43cad87SWarner Losh </constant></term> 289*c43cad87SWarner Losh 290*c43cad87SWarner Losh <listitem><para>Use the thread-specific cache (tcache) specified by 291*c43cad87SWarner Losh the identifier <parameter>tc</parameter>, which must have been 292*c43cad87SWarner Losh acquired via the <link 293*c43cad87SWarner Losh linkend="tcache.create"><mallctl>tcache.create</mallctl></link> 294*c43cad87SWarner Losh mallctl. This macro does not validate that 295*c43cad87SWarner Losh <parameter>tc</parameter> specifies a valid 296*c43cad87SWarner Losh identifier.</para></listitem> 297*c43cad87SWarner Losh </varlistentry> 298*c43cad87SWarner Losh <varlistentry id="MALLOC_TCACHE_NONE"> 299*c43cad87SWarner Losh <term><constant>MALLOCX_TCACHE_NONE</constant></term> 300*c43cad87SWarner Losh 301*c43cad87SWarner Losh <listitem><para>Do not use a thread-specific cache (tcache). Unless 302*c43cad87SWarner Losh <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant> or 303*c43cad87SWarner Losh <constant>MALLOCX_TCACHE_NONE</constant> is specified, an 304*c43cad87SWarner Losh automatically managed tcache will be used under many circumstances. 305*c43cad87SWarner Losh This macro cannot be used in the same <parameter>flags</parameter> 306*c43cad87SWarner Losh argument as 307*c43cad87SWarner Losh <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant>.</para></listitem> 308*c43cad87SWarner Losh </varlistentry> 309*c43cad87SWarner Losh <varlistentry id="MALLOCX_ARENA"> 310*c43cad87SWarner Losh <term><constant>MALLOCX_ARENA(<parameter>a</parameter>) 311*c43cad87SWarner Losh </constant></term> 312*c43cad87SWarner Losh 313*c43cad87SWarner Losh <listitem><para>Use the arena specified by the index 314*c43cad87SWarner Losh <parameter>a</parameter>. This macro has no effect for regions that 315*c43cad87SWarner Losh were allocated via an arena other than the one specified. This 316*c43cad87SWarner Losh macro does not validate that <parameter>a</parameter> specifies an 317*c43cad87SWarner Losh arena index in the valid range.</para></listitem> 318*c43cad87SWarner Losh </varlistentry> 319*c43cad87SWarner Losh </variablelist> 320*c43cad87SWarner Losh </para> 321*c43cad87SWarner Losh 322*c43cad87SWarner Losh <para>The <function>mallocx()</function> function allocates at 323*c43cad87SWarner Losh least <parameter>size</parameter> bytes of memory, and returns a pointer 324*c43cad87SWarner Losh to the base address of the allocation. Behavior is undefined if 325*c43cad87SWarner Losh <parameter>size</parameter> is <constant>0</constant>.</para> 326*c43cad87SWarner Losh 327*c43cad87SWarner Losh <para>The <function>rallocx()</function> function resizes the 328*c43cad87SWarner Losh allocation at <parameter>ptr</parameter> to be at least 329*c43cad87SWarner Losh <parameter>size</parameter> bytes, and returns a pointer to the base 330*c43cad87SWarner Losh address of the resulting allocation, which may or may not have moved from 331*c43cad87SWarner Losh its original location. Behavior is undefined if 332*c43cad87SWarner Losh <parameter>size</parameter> is <constant>0</constant>.</para> 333*c43cad87SWarner Losh 334*c43cad87SWarner Losh <para>The <function>xallocx()</function> function resizes the 335*c43cad87SWarner Losh allocation at <parameter>ptr</parameter> in place to be at least 336*c43cad87SWarner Losh <parameter>size</parameter> bytes, and returns the real size of the 337*c43cad87SWarner Losh allocation. If <parameter>extra</parameter> is non-zero, an attempt is 338*c43cad87SWarner Losh made to resize the allocation to be at least <code 339*c43cad87SWarner Losh language="C">(<parameter>size</parameter> + 340*c43cad87SWarner Losh <parameter>extra</parameter>)</code> bytes, though inability to allocate 341*c43cad87SWarner Losh the extra byte(s) will not by itself result in failure to resize. 342*c43cad87SWarner Losh Behavior is undefined if <parameter>size</parameter> is 343*c43cad87SWarner Losh <constant>0</constant>, or if <code 344*c43cad87SWarner Losh language="C">(<parameter>size</parameter> + <parameter>extra</parameter> 345*c43cad87SWarner Losh > <constant>SIZE_T_MAX</constant>)</code>.</para> 346*c43cad87SWarner Losh 347*c43cad87SWarner Losh <para>The <function>sallocx()</function> function returns the 348*c43cad87SWarner Losh real size of the allocation at <parameter>ptr</parameter>.</para> 349*c43cad87SWarner Losh 350*c43cad87SWarner Losh <para>The <function>dallocx()</function> function causes the 351*c43cad87SWarner Losh memory referenced by <parameter>ptr</parameter> to be made available for 352*c43cad87SWarner Losh future allocations.</para> 353*c43cad87SWarner Losh 354*c43cad87SWarner Losh <para>The <function>sdallocx()</function> function is an 355*c43cad87SWarner Losh extension of <function>dallocx()</function> with a 356*c43cad87SWarner Losh <parameter>size</parameter> parameter to allow the caller to pass in the 357*c43cad87SWarner Losh allocation size as an optimization. The minimum valid input size is the 358*c43cad87SWarner Losh original requested size of the allocation, and the maximum valid input 359*c43cad87SWarner Losh size is the corresponding value returned by 360*c43cad87SWarner Losh <function>nallocx()</function> or 361*c43cad87SWarner Losh <function>sallocx()</function>.</para> 362*c43cad87SWarner Losh 363*c43cad87SWarner Losh <para>The <function>nallocx()</function> function allocates no 364*c43cad87SWarner Losh memory, but it performs the same size computation as the 365*c43cad87SWarner Losh <function>mallocx()</function> function, and returns the real 366*c43cad87SWarner Losh size of the allocation that would result from the equivalent 367*c43cad87SWarner Losh <function>mallocx()</function> function call, or 368*c43cad87SWarner Losh <constant>0</constant> if the inputs exceed the maximum supported size 369*c43cad87SWarner Losh class and/or alignment. Behavior is undefined if 370*c43cad87SWarner Losh <parameter>size</parameter> is <constant>0</constant>.</para> 371*c43cad87SWarner Losh 372*c43cad87SWarner Losh <para>The <function>mallctl()</function> function provides a 373*c43cad87SWarner Losh general interface for introspecting the memory allocator, as well as 374*c43cad87SWarner Losh setting modifiable parameters and triggering actions. The 375*c43cad87SWarner Losh period-separated <parameter>name</parameter> argument specifies a 376*c43cad87SWarner Losh location in a tree-structured namespace; see the <xref 377*c43cad87SWarner Losh linkend="mallctl_namespace" xrefstyle="template:%t"/> section for 378*c43cad87SWarner Losh documentation on the tree contents. To read a value, pass a pointer via 379*c43cad87SWarner Losh <parameter>oldp</parameter> to adequate space to contain the value, and a 380*c43cad87SWarner Losh pointer to its length via <parameter>oldlenp</parameter>; otherwise pass 381*c43cad87SWarner Losh <constant>NULL</constant> and <constant>NULL</constant>. Similarly, to 382*c43cad87SWarner Losh write a value, pass a pointer to the value via 383*c43cad87SWarner Losh <parameter>newp</parameter>, and its length via 384*c43cad87SWarner Losh <parameter>newlen</parameter>; otherwise pass <constant>NULL</constant> 385*c43cad87SWarner Losh and <constant>0</constant>.</para> 386*c43cad87SWarner Losh 387*c43cad87SWarner Losh <para>The <function>mallctlnametomib()</function> function 388*c43cad87SWarner Losh provides a way to avoid repeated name lookups for applications that 389*c43cad87SWarner Losh repeatedly query the same portion of the namespace, by translating a name 390*c43cad87SWarner Losh to a <quote>Management Information Base</quote> (MIB) that can be passed 391*c43cad87SWarner Losh repeatedly to <function>mallctlbymib()</function>. Upon 392*c43cad87SWarner Losh successful return from <function>mallctlnametomib()</function>, 393*c43cad87SWarner Losh <parameter>mibp</parameter> contains an array of 394*c43cad87SWarner Losh <parameter>*miblenp</parameter> integers, where 395*c43cad87SWarner Losh <parameter>*miblenp</parameter> is the lesser of the number of components 396*c43cad87SWarner Losh in <parameter>name</parameter> and the input value of 397*c43cad87SWarner Losh <parameter>*miblenp</parameter>. Thus it is possible to pass a 398*c43cad87SWarner Losh <parameter>*miblenp</parameter> that is smaller than the number of 399*c43cad87SWarner Losh period-separated name components, which results in a partial MIB that can 400*c43cad87SWarner Losh be used as the basis for constructing a complete MIB. For name 401*c43cad87SWarner Losh components that are integers (e.g. the 2 in 402*c43cad87SWarner Losh <link 403*c43cad87SWarner Losh linkend="arenas.bin.i.size"><mallctl>arenas.bin.2.size</mallctl></link>), 404*c43cad87SWarner Losh the corresponding MIB component will always be that integer. Therefore, 405*c43cad87SWarner Losh it is legitimate to construct code like the following: <programlisting 406*c43cad87SWarner Losh language="C"><![CDATA[ 407*c43cad87SWarner Loshunsigned nbins, i; 408*c43cad87SWarner Loshsize_t mib[4]; 409*c43cad87SWarner Loshsize_t len, miblen; 410*c43cad87SWarner Losh 411*c43cad87SWarner Loshlen = sizeof(nbins); 412*c43cad87SWarner Loshmallctl("arenas.nbins", &nbins, &len, NULL, 0); 413*c43cad87SWarner Losh 414*c43cad87SWarner Loshmiblen = 4; 415*c43cad87SWarner Loshmallctlnametomib("arenas.bin.0.size", mib, &miblen); 416*c43cad87SWarner Loshfor (i = 0; i < nbins; i++) { 417*c43cad87SWarner Losh size_t bin_size; 418*c43cad87SWarner Losh 419*c43cad87SWarner Losh mib[2] = i; 420*c43cad87SWarner Losh len = sizeof(bin_size); 421*c43cad87SWarner Losh mallctlbymib(mib, miblen, (void *)&bin_size, &len, NULL, 0); 422*c43cad87SWarner Losh /* Do something with bin_size... */ 423*c43cad87SWarner Losh}]]></programlisting></para> 424*c43cad87SWarner Losh 425*c43cad87SWarner Losh <varlistentry id="malloc_stats_print_opts"> 426*c43cad87SWarner Losh </varlistentry> 427*c43cad87SWarner Losh <para>The <function>malloc_stats_print()</function> function writes 428*c43cad87SWarner Losh summary statistics via the <parameter>write_cb</parameter> callback 429*c43cad87SWarner Losh function pointer and <parameter>cbopaque</parameter> data passed to 430*c43cad87SWarner Losh <parameter>write_cb</parameter>, or <function>malloc_message()</function> 431*c43cad87SWarner Losh if <parameter>write_cb</parameter> is <constant>NULL</constant>. The 432*c43cad87SWarner Losh statistics are presented in human-readable form unless <quote>J</quote> is 433*c43cad87SWarner Losh specified as a character within the <parameter>opts</parameter> string, in 434*c43cad87SWarner Losh which case the statistics are presented in <ulink 435*c43cad87SWarner Losh url="http://www.json.org/">JSON format</ulink>. This function can be 436*c43cad87SWarner Losh called repeatedly. General information that never changes during 437*c43cad87SWarner Losh execution can be omitted by specifying <quote>g</quote> as a character 438*c43cad87SWarner Losh within the <parameter>opts</parameter> string. Note that 439*c43cad87SWarner Losh <function>malloc_stats_print()</function> uses the 440*c43cad87SWarner Losh <function>mallctl*()</function> functions internally, so inconsistent 441*c43cad87SWarner Losh statistics can be reported if multiple threads use these functions 442*c43cad87SWarner Losh simultaneously. If <option>--enable-stats</option> is specified during 443*c43cad87SWarner Losh configuration, <quote>m</quote>, <quote>d</quote>, and <quote>a</quote> 444*c43cad87SWarner Losh can be specified to omit merged arena, destroyed merged arena, and per 445*c43cad87SWarner Losh arena statistics, respectively; <quote>b</quote> and <quote>l</quote> can 446*c43cad87SWarner Losh be specified to omit per size class statistics for bins and large objects, 447*c43cad87SWarner Losh respectively; <quote>x</quote> can be specified to omit all mutex 448*c43cad87SWarner Losh statistics; <quote>e</quote> can be used to omit extent statistics. 449*c43cad87SWarner Losh Unrecognized characters are silently ignored. Note that thread caching 450*c43cad87SWarner Losh may prevent some statistics from being completely up to date, since extra 451*c43cad87SWarner Losh locking would be required to merge counters that track thread cache 452*c43cad87SWarner Losh operations.</para> 453*c43cad87SWarner Losh 454*c43cad87SWarner Losh <para>The <function>malloc_usable_size()</function> function 455*c43cad87SWarner Losh returns the usable size of the allocation pointed to by 456*c43cad87SWarner Losh <parameter>ptr</parameter>. The return value may be larger than the size 457*c43cad87SWarner Losh that was requested during allocation. The 458*c43cad87SWarner Losh <function>malloc_usable_size()</function> function is not a 459*c43cad87SWarner Losh mechanism for in-place <function>realloc()</function>; rather 460*c43cad87SWarner Losh it is provided solely as a tool for introspection purposes. Any 461*c43cad87SWarner Losh discrepancy between the requested allocation size and the size reported 462*c43cad87SWarner Losh by <function>malloc_usable_size()</function> should not be 463*c43cad87SWarner Losh depended on, since such behavior is entirely implementation-dependent. 464*c43cad87SWarner Losh </para> 465*c43cad87SWarner Losh </refsect2> 466*c43cad87SWarner Losh </refsect1> 467*c43cad87SWarner Losh <refsect1 id="tuning"> 468*c43cad87SWarner Losh <title>TUNING</title> 469*c43cad87SWarner Losh <para>Once, when the first call is made to one of the memory allocation 470*c43cad87SWarner Losh routines, the allocator initializes its internals based in part on various 471*c43cad87SWarner Losh options that can be specified at compile- or run-time.</para> 472*c43cad87SWarner Losh 473*c43cad87SWarner Losh <para>The string specified via <option>--with-malloc-conf</option>, the 474*c43cad87SWarner Losh string pointed to by the global variable <varname>malloc_conf</varname>, the 475*c43cad87SWarner Losh <quote>name</quote> of the file referenced by the symbolic link named 476*c43cad87SWarner Losh <filename class="symlink">/etc/malloc.conf</filename>, and the value of the 477*c43cad87SWarner Losh environment variable <envar>MALLOC_CONF</envar>, will be interpreted, in 478*c43cad87SWarner Losh that order, from left to right as options. Note that 479*c43cad87SWarner Losh <varname>malloc_conf</varname> may be read before 480*c43cad87SWarner Losh <function>main()</function> is entered, so the declaration of 481*c43cad87SWarner Losh <varname>malloc_conf</varname> should specify an initializer that contains 482*c43cad87SWarner Losh the final value to be read by jemalloc. <option>--with-malloc-conf</option> 483*c43cad87SWarner Losh and <varname>malloc_conf</varname> are compile-time mechanisms, whereas 484*c43cad87SWarner Losh <filename class="symlink">/etc/malloc.conf</filename> and 485*c43cad87SWarner Losh <envar>MALLOC_CONF</envar> can be safely set any time prior to program 486*c43cad87SWarner Losh invocation.</para> 487*c43cad87SWarner Losh 488*c43cad87SWarner Losh <para>An options string is a comma-separated list of option:value pairs. 489*c43cad87SWarner Losh There is one key corresponding to each <link 490*c43cad87SWarner Losh linkend="opt.abort"><mallctl>opt.*</mallctl></link> mallctl (see the <xref 491*c43cad87SWarner Losh linkend="mallctl_namespace" xrefstyle="template:%t"/> section for options 492*c43cad87SWarner Losh documentation). For example, <literal>abort:true,narenas:1</literal> sets 493*c43cad87SWarner Losh the <link linkend="opt.abort"><mallctl>opt.abort</mallctl></link> and <link 494*c43cad87SWarner Losh linkend="opt.narenas"><mallctl>opt.narenas</mallctl></link> options. Some 495*c43cad87SWarner Losh options have boolean values (true/false), others have integer values (base 496*c43cad87SWarner Losh 8, 10, or 16, depending on prefix), and yet others have raw string 497*c43cad87SWarner Losh values.</para> 498*c43cad87SWarner Losh </refsect1> 499*c43cad87SWarner Losh <refsect1 id="implementation_notes"> 500*c43cad87SWarner Losh <title>IMPLEMENTATION NOTES</title> 501*c43cad87SWarner Losh <para>Traditionally, allocators have used 502*c43cad87SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 503*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> to obtain memory, which is 504*c43cad87SWarner Losh suboptimal for several reasons, including race conditions, increased 505*c43cad87SWarner Losh fragmentation, and artificial limitations on maximum usable memory. If 506*c43cad87SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 507*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> is supported by the operating 508*c43cad87SWarner Losh system, this allocator uses both 509*c43cad87SWarner Losh <citerefentry><refentrytitle>mmap</refentrytitle> 510*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> and 511*c43cad87SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 512*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>, in that order of preference; 513*c43cad87SWarner Losh otherwise only <citerefentry><refentrytitle>mmap</refentrytitle> 514*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> is used.</para> 515*c43cad87SWarner Losh 516*c43cad87SWarner Losh <para>This allocator uses multiple arenas in order to reduce lock 517*c43cad87SWarner Losh contention for threaded programs on multi-processor systems. This works 518*c43cad87SWarner Losh well with regard to threading scalability, but incurs some costs. There is 519*c43cad87SWarner Losh a small fixed per-arena overhead, and additionally, arenas manage memory 520*c43cad87SWarner Losh completely independently of each other, which means a small fixed increase 521*c43cad87SWarner Losh in overall memory fragmentation. These overheads are not generally an 522*c43cad87SWarner Losh issue, given the number of arenas normally used. Note that using 523*c43cad87SWarner Losh substantially more arenas than the default is not likely to improve 524*c43cad87SWarner Losh performance, mainly due to reduced cache performance. However, it may make 525*c43cad87SWarner Losh sense to reduce the number of arenas if an application does not make much 526*c43cad87SWarner Losh use of the allocation functions.</para> 527*c43cad87SWarner Losh 528*c43cad87SWarner Losh <para>In addition to multiple arenas, this allocator supports 529*c43cad87SWarner Losh thread-specific caching, in order to make it possible to completely avoid 530*c43cad87SWarner Losh synchronization for most allocation requests. Such caching allows very fast 531*c43cad87SWarner Losh allocation in the common case, but it increases memory usage and 532*c43cad87SWarner Losh fragmentation, since a bounded number of objects can remain allocated in 533*c43cad87SWarner Losh each thread cache.</para> 534*c43cad87SWarner Losh 535*c43cad87SWarner Losh <para>Memory is conceptually broken into extents. Extents are always 536*c43cad87SWarner Losh aligned to multiples of the page size. This alignment makes it possible to 537*c43cad87SWarner Losh find metadata for user objects quickly. User objects are broken into two 538*c43cad87SWarner Losh categories according to size: small and large. Contiguous small objects 539*c43cad87SWarner Losh comprise a slab, which resides within a single extent, whereas large objects 540*c43cad87SWarner Losh each have their own extents backing them.</para> 541*c43cad87SWarner Losh 542*c43cad87SWarner Losh <para>Small objects are managed in groups by slabs. Each slab maintains 543*c43cad87SWarner Losh a bitmap to track which regions are in use. Allocation requests that are no 544*c43cad87SWarner Losh more than half the quantum (8 or 16, depending on architecture) are rounded 545*c43cad87SWarner Losh up to the nearest power of two that is at least <code 546*c43cad87SWarner Losh language="C">sizeof(<type>double</type>)</code>. All other object size 547*c43cad87SWarner Losh classes are multiples of the quantum, spaced such that there are four size 548*c43cad87SWarner Losh classes for each doubling in size, which limits internal fragmentation to 549*c43cad87SWarner Losh approximately 20% for all but the smallest size classes. Small size classes 550*c43cad87SWarner Losh are smaller than four times the page size, and large size classes extend 551*c43cad87SWarner Losh from four times the page size up to the largest size class that does not 552*c43cad87SWarner Losh exceed <constant>PTRDIFF_MAX</constant>.</para> 553*c43cad87SWarner Losh 554*c43cad87SWarner Losh <para>Allocations are packed tightly together, which can be an issue for 555*c43cad87SWarner Losh multi-threaded applications. If you need to assure that allocations do not 556*c43cad87SWarner Losh suffer from cacheline sharing, round your allocation requests up to the 557*c43cad87SWarner Losh nearest multiple of the cacheline size, or specify cacheline alignment when 558*c43cad87SWarner Losh allocating.</para> 559*c43cad87SWarner Losh 560*c43cad87SWarner Losh <para>The <function>realloc()</function>, 561*c43cad87SWarner Losh <function>rallocx()</function>, and 562*c43cad87SWarner Losh <function>xallocx()</function> functions may resize allocations 563*c43cad87SWarner Losh without moving them under limited circumstances. Unlike the 564*c43cad87SWarner Losh <function>*allocx()</function> API, the standard API does not 565*c43cad87SWarner Losh officially round up the usable size of an allocation to the nearest size 566*c43cad87SWarner Losh class, so technically it is necessary to call 567*c43cad87SWarner Losh <function>realloc()</function> to grow e.g. a 9-byte allocation to 568*c43cad87SWarner Losh 16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage 569*c43cad87SWarner Losh trivially succeeds in place as long as the pre-size and post-size both round 570*c43cad87SWarner Losh up to the same size class. No other API guarantees are made regarding 571*c43cad87SWarner Losh in-place resizing, but the current implementation also tries to resize large 572*c43cad87SWarner Losh allocations in place, as long as the pre-size and post-size are both large. 573*c43cad87SWarner Losh For shrinkage to succeed, the extent allocator must support splitting (see 574*c43cad87SWarner Losh <link 575*c43cad87SWarner Losh linkend="arena.i.extent_hooks"><mallctl>arena.<i>.extent_hooks</mallctl></link>). 576*c43cad87SWarner Losh Growth only succeeds if the trailing memory is currently available, and the 577*c43cad87SWarner Losh extent allocator supports merging.</para> 578*c43cad87SWarner Losh 579*c43cad87SWarner Losh <para>Assuming 4 KiB pages and a 16-byte quantum on a 64-bit system, the 580*c43cad87SWarner Losh size classes in each category are as shown in <xref linkend="size_classes" 581*c43cad87SWarner Losh xrefstyle="template:Table %n"/>.</para> 582*c43cad87SWarner Losh 583*c43cad87SWarner Losh <table xml:id="size_classes" frame="all"> 584*c43cad87SWarner Losh <title>Size classes</title> 585*c43cad87SWarner Losh <tgroup cols="3" colsep="1" rowsep="1"> 586*c43cad87SWarner Losh <colspec colname="c1" align="left"/> 587*c43cad87SWarner Losh <colspec colname="c2" align="right"/> 588*c43cad87SWarner Losh <colspec colname="c3" align="left"/> 589*c43cad87SWarner Losh <thead> 590*c43cad87SWarner Losh <row> 591*c43cad87SWarner Losh <entry>Category</entry> 592*c43cad87SWarner Losh <entry>Spacing</entry> 593*c43cad87SWarner Losh <entry>Size</entry> 594*c43cad87SWarner Losh </row> 595*c43cad87SWarner Losh </thead> 596*c43cad87SWarner Losh <tbody> 597*c43cad87SWarner Losh <row> 598*c43cad87SWarner Losh <entry morerows="8">Small</entry> 599*c43cad87SWarner Losh <entry>lg</entry> 600*c43cad87SWarner Losh <entry>[8]</entry> 601*c43cad87SWarner Losh </row> 602*c43cad87SWarner Losh <row> 603*c43cad87SWarner Losh <entry>16</entry> 604*c43cad87SWarner Losh <entry>[16, 32, 48, 64, 80, 96, 112, 128]</entry> 605*c43cad87SWarner Losh </row> 606*c43cad87SWarner Losh <row> 607*c43cad87SWarner Losh <entry>32</entry> 608*c43cad87SWarner Losh <entry>[160, 192, 224, 256]</entry> 609*c43cad87SWarner Losh </row> 610*c43cad87SWarner Losh <row> 611*c43cad87SWarner Losh <entry>64</entry> 612*c43cad87SWarner Losh <entry>[320, 384, 448, 512]</entry> 613*c43cad87SWarner Losh </row> 614*c43cad87SWarner Losh <row> 615*c43cad87SWarner Losh <entry>128</entry> 616*c43cad87SWarner Losh <entry>[640, 768, 896, 1024]</entry> 617*c43cad87SWarner Losh </row> 618*c43cad87SWarner Losh <row> 619*c43cad87SWarner Losh <entry>256</entry> 620*c43cad87SWarner Losh <entry>[1280, 1536, 1792, 2048]</entry> 621*c43cad87SWarner Losh </row> 622*c43cad87SWarner Losh <row> 623*c43cad87SWarner Losh <entry>512</entry> 624*c43cad87SWarner Losh <entry>[2560, 3072, 3584, 4096]</entry> 625*c43cad87SWarner Losh </row> 626*c43cad87SWarner Losh <row> 627*c43cad87SWarner Losh <entry>1 KiB</entry> 628*c43cad87SWarner Losh <entry>[5 KiB, 6 KiB, 7 KiB, 8 KiB]</entry> 629*c43cad87SWarner Losh </row> 630*c43cad87SWarner Losh <row> 631*c43cad87SWarner Losh <entry>2 KiB</entry> 632*c43cad87SWarner Losh <entry>[10 KiB, 12 KiB, 14 KiB]</entry> 633*c43cad87SWarner Losh </row> 634*c43cad87SWarner Losh <row> 635*c43cad87SWarner Losh <entry morerows="15">Large</entry> 636*c43cad87SWarner Losh <entry>2 KiB</entry> 637*c43cad87SWarner Losh <entry>[16 KiB]</entry> 638*c43cad87SWarner Losh </row> 639*c43cad87SWarner Losh <row> 640*c43cad87SWarner Losh <entry>4 KiB</entry> 641*c43cad87SWarner Losh <entry>[20 KiB, 24 KiB, 28 KiB, 32 KiB]</entry> 642*c43cad87SWarner Losh </row> 643*c43cad87SWarner Losh <row> 644*c43cad87SWarner Losh <entry>8 KiB</entry> 645*c43cad87SWarner Losh <entry>[40 KiB, 48 KiB, 56 KiB, 64 KiB]</entry> 646*c43cad87SWarner Losh </row> 647*c43cad87SWarner Losh <row> 648*c43cad87SWarner Losh <entry>16 KiB</entry> 649*c43cad87SWarner Losh <entry>[80 KiB, 96 KiB, 112 KiB, 128 KiB]</entry> 650*c43cad87SWarner Losh </row> 651*c43cad87SWarner Losh <row> 652*c43cad87SWarner Losh <entry>32 KiB</entry> 653*c43cad87SWarner Losh <entry>[160 KiB, 192 KiB, 224 KiB, 256 KiB]</entry> 654*c43cad87SWarner Losh </row> 655*c43cad87SWarner Losh <row> 656*c43cad87SWarner Losh <entry>64 KiB</entry> 657*c43cad87SWarner Losh <entry>[320 KiB, 384 KiB, 448 KiB, 512 KiB]</entry> 658*c43cad87SWarner Losh </row> 659*c43cad87SWarner Losh <row> 660*c43cad87SWarner Losh <entry>128 KiB</entry> 661*c43cad87SWarner Losh <entry>[640 KiB, 768 KiB, 896 KiB, 1 MiB]</entry> 662*c43cad87SWarner Losh </row> 663*c43cad87SWarner Losh <row> 664*c43cad87SWarner Losh <entry>256 KiB</entry> 665*c43cad87SWarner Losh <entry>[1280 KiB, 1536 KiB, 1792 KiB, 2 MiB]</entry> 666*c43cad87SWarner Losh </row> 667*c43cad87SWarner Losh <row> 668*c43cad87SWarner Losh <entry>512 KiB</entry> 669*c43cad87SWarner Losh <entry>[2560 KiB, 3 MiB, 3584 KiB, 4 MiB]</entry> 670*c43cad87SWarner Losh </row> 671*c43cad87SWarner Losh <row> 672*c43cad87SWarner Losh <entry>1 MiB</entry> 673*c43cad87SWarner Losh <entry>[5 MiB, 6 MiB, 7 MiB, 8 MiB]</entry> 674*c43cad87SWarner Losh </row> 675*c43cad87SWarner Losh <row> 676*c43cad87SWarner Losh <entry>2 MiB</entry> 677*c43cad87SWarner Losh <entry>[10 MiB, 12 MiB, 14 MiB, 16 MiB]</entry> 678*c43cad87SWarner Losh </row> 679*c43cad87SWarner Losh <row> 680*c43cad87SWarner Losh <entry>4 MiB</entry> 681*c43cad87SWarner Losh <entry>[20 MiB, 24 MiB, 28 MiB, 32 MiB]</entry> 682*c43cad87SWarner Losh </row> 683*c43cad87SWarner Losh <row> 684*c43cad87SWarner Losh <entry>8 MiB</entry> 685*c43cad87SWarner Losh <entry>[40 MiB, 48 MiB, 56 MiB, 64 MiB]</entry> 686*c43cad87SWarner Losh </row> 687*c43cad87SWarner Losh <row> 688*c43cad87SWarner Losh <entry>...</entry> 689*c43cad87SWarner Losh <entry>...</entry> 690*c43cad87SWarner Losh </row> 691*c43cad87SWarner Losh <row> 692*c43cad87SWarner Losh <entry>512 PiB</entry> 693*c43cad87SWarner Losh <entry>[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]</entry> 694*c43cad87SWarner Losh </row> 695*c43cad87SWarner Losh <row> 696*c43cad87SWarner Losh <entry>1 EiB</entry> 697*c43cad87SWarner Losh <entry>[5 EiB, 6 EiB, 7 EiB]</entry> 698*c43cad87SWarner Losh </row> 699*c43cad87SWarner Losh </tbody> 700*c43cad87SWarner Losh </tgroup> 701*c43cad87SWarner Losh </table> 702*c43cad87SWarner Losh </refsect1> 703*c43cad87SWarner Losh <refsect1 id="mallctl_namespace"> 704*c43cad87SWarner Losh <title>MALLCTL NAMESPACE</title> 705*c43cad87SWarner Losh <para>The following names are defined in the namespace accessible via the 706*c43cad87SWarner Losh <function>mallctl*()</function> functions. Value types are specified in 707*c43cad87SWarner Losh parentheses, their readable/writable statuses are encoded as 708*c43cad87SWarner Losh <literal>rw</literal>, <literal>r-</literal>, <literal>-w</literal>, or 709*c43cad87SWarner Losh <literal>--</literal>, and required build configuration flags follow, if 710*c43cad87SWarner Losh any. A name element encoded as <literal><i></literal> or 711*c43cad87SWarner Losh <literal><j></literal> indicates an integer component, where the 712*c43cad87SWarner Losh integer varies from 0 to some upper value that must be determined via 713*c43cad87SWarner Losh introspection. In the case of <mallctl>stats.arenas.<i>.*</mallctl> 714*c43cad87SWarner Losh and <mallctl>arena.<i>.{initialized,purge,decay,dss}</mallctl>, 715*c43cad87SWarner Losh <literal><i></literal> equal to 716*c43cad87SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant> can be used to operate on all arenas 717*c43cad87SWarner Losh or access the summation of statistics from all arenas; similarly 718*c43cad87SWarner Losh <literal><i></literal> equal to 719*c43cad87SWarner Losh <constant>MALLCTL_ARENAS_DESTROYED</constant> can be used to access the 720*c43cad87SWarner Losh summation of statistics from all destroyed arenas. These constants can be 721*c43cad87SWarner Losh utilized either via <function>mallctlnametomib()</function> followed by 722*c43cad87SWarner Losh <function>mallctlbymib()</function>, or via code such as the following: 723*c43cad87SWarner Losh <programlisting language="C"><![CDATA[ 724*c43cad87SWarner Losh#define STRINGIFY_HELPER(x) #x 725*c43cad87SWarner Losh#define STRINGIFY(x) STRINGIFY_HELPER(x) 726*c43cad87SWarner Losh 727*c43cad87SWarner Loshmallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay", 728*c43cad87SWarner Losh NULL, NULL, NULL, 0);]]></programlisting> 729*c43cad87SWarner Losh Take special note of the <link 730*c43cad87SWarner Losh linkend="epoch"><mallctl>epoch</mallctl></link> mallctl, which controls 731*c43cad87SWarner Losh refreshing of cached dynamic statistics.</para> 732*c43cad87SWarner Losh 733*c43cad87SWarner Losh <variablelist> 734*c43cad87SWarner Losh <varlistentry id="version"> 735*c43cad87SWarner Losh <term> 736*c43cad87SWarner Losh <mallctl>version</mallctl> 737*c43cad87SWarner Losh (<type>const char *</type>) 738*c43cad87SWarner Losh <literal>r-</literal> 739*c43cad87SWarner Losh </term> 740*c43cad87SWarner Losh <listitem><para>Return the jemalloc version string.</para></listitem> 741*c43cad87SWarner Losh </varlistentry> 742*c43cad87SWarner Losh 743*c43cad87SWarner Losh <varlistentry id="epoch"> 744*c43cad87SWarner Losh <term> 745*c43cad87SWarner Losh <mallctl>epoch</mallctl> 746*c43cad87SWarner Losh (<type>uint64_t</type>) 747*c43cad87SWarner Losh <literal>rw</literal> 748*c43cad87SWarner Losh </term> 749*c43cad87SWarner Losh <listitem><para>If a value is passed in, refresh the data from which 750*c43cad87SWarner Losh the <function>mallctl*()</function> functions report values, 751*c43cad87SWarner Losh and increment the epoch. Return the current epoch. This is useful for 752*c43cad87SWarner Losh detecting whether another thread caused a refresh.</para></listitem> 753*c43cad87SWarner Losh </varlistentry> 754*c43cad87SWarner Losh 755*c43cad87SWarner Losh <varlistentry id="background_thread"> 756*c43cad87SWarner Losh <term> 757*c43cad87SWarner Losh <mallctl>background_thread</mallctl> 758*c43cad87SWarner Losh (<type>bool</type>) 759*c43cad87SWarner Losh <literal>rw</literal> 760*c43cad87SWarner Losh </term> 761*c43cad87SWarner Losh <listitem><para>Enable/disable internal background worker threads. When 762*c43cad87SWarner Losh set to true, background threads are created on demand (the number of 763*c43cad87SWarner Losh background threads will be no more than the number of CPUs or active 764*c43cad87SWarner Losh arenas). Threads run periodically, and handle <link 765*c43cad87SWarner Losh linkend="arena.i.decay">purging</link> asynchronously. When switching 766*c43cad87SWarner Losh off, background threads are terminated synchronously. Note that after 767*c43cad87SWarner Losh <citerefentry><refentrytitle>fork</refentrytitle><manvolnum>2</manvolnum></citerefentry> 768*c43cad87SWarner Losh function, the state in the child process will be disabled regardless 769*c43cad87SWarner Losh the state in parent process. See <link 770*c43cad87SWarner Losh linkend="stats.background_thread.num_threads"><mallctl>stats.background_thread</mallctl></link> 771*c43cad87SWarner Losh for related stats. <link 772*c43cad87SWarner Losh linkend="opt.background_thread"><mallctl>opt.background_thread</mallctl></link> 773*c43cad87SWarner Losh can be used to set the default option. This option is only available on 774*c43cad87SWarner Losh selected pthread-based platforms.</para></listitem> 775*c43cad87SWarner Losh </varlistentry> 776*c43cad87SWarner Losh 777*c43cad87SWarner Losh <varlistentry id="max_background_threads"> 778*c43cad87SWarner Losh <term> 779*c43cad87SWarner Losh <mallctl>max_background_threads</mallctl> 780*c43cad87SWarner Losh (<type>size_t</type>) 781*c43cad87SWarner Losh <literal>rw</literal> 782*c43cad87SWarner Losh </term> 783*c43cad87SWarner Losh <listitem><para>Maximum number of background worker threads that will 784*c43cad87SWarner Losh be created. This value is capped at <link 785*c43cad87SWarner Losh linkend="opt.max_background_threads"><mallctl>opt.max_background_threads</mallctl></link> at 786*c43cad87SWarner Losh startup.</para></listitem> 787*c43cad87SWarner Losh </varlistentry> 788*c43cad87SWarner Losh 789*c43cad87SWarner Losh <varlistentry id="config.cache_oblivious"> 790*c43cad87SWarner Losh <term> 791*c43cad87SWarner Losh <mallctl>config.cache_oblivious</mallctl> 792*c43cad87SWarner Losh (<type>bool</type>) 793*c43cad87SWarner Losh <literal>r-</literal> 794*c43cad87SWarner Losh </term> 795*c43cad87SWarner Losh <listitem><para><option>--enable-cache-oblivious</option> was specified 796*c43cad87SWarner Losh during build configuration.</para></listitem> 797*c43cad87SWarner Losh </varlistentry> 798*c43cad87SWarner Losh 799*c43cad87SWarner Losh <varlistentry id="config.debug"> 800*c43cad87SWarner Losh <term> 801*c43cad87SWarner Losh <mallctl>config.debug</mallctl> 802*c43cad87SWarner Losh (<type>bool</type>) 803*c43cad87SWarner Losh <literal>r-</literal> 804*c43cad87SWarner Losh </term> 805*c43cad87SWarner Losh <listitem><para><option>--enable-debug</option> was specified during 806*c43cad87SWarner Losh build configuration.</para></listitem> 807*c43cad87SWarner Losh </varlistentry> 808*c43cad87SWarner Losh 809*c43cad87SWarner Losh <varlistentry id="config.fill"> 810*c43cad87SWarner Losh <term> 811*c43cad87SWarner Losh <mallctl>config.fill</mallctl> 812*c43cad87SWarner Losh (<type>bool</type>) 813*c43cad87SWarner Losh <literal>r-</literal> 814*c43cad87SWarner Losh </term> 815*c43cad87SWarner Losh <listitem><para><option>--enable-fill</option> was specified during 816*c43cad87SWarner Losh build configuration.</para></listitem> 817*c43cad87SWarner Losh </varlistentry> 818*c43cad87SWarner Losh 819*c43cad87SWarner Losh <varlistentry id="config.lazy_lock"> 820*c43cad87SWarner Losh <term> 821*c43cad87SWarner Losh <mallctl>config.lazy_lock</mallctl> 822*c43cad87SWarner Losh (<type>bool</type>) 823*c43cad87SWarner Losh <literal>r-</literal> 824*c43cad87SWarner Losh </term> 825*c43cad87SWarner Losh <listitem><para><option>--enable-lazy-lock</option> was specified 826*c43cad87SWarner Losh during build configuration.</para></listitem> 827*c43cad87SWarner Losh </varlistentry> 828*c43cad87SWarner Losh 829*c43cad87SWarner Losh <varlistentry id="config.malloc_conf"> 830*c43cad87SWarner Losh <term> 831*c43cad87SWarner Losh <mallctl>config.malloc_conf</mallctl> 832*c43cad87SWarner Losh (<type>const char *</type>) 833*c43cad87SWarner Losh <literal>r-</literal> 834*c43cad87SWarner Losh </term> 835*c43cad87SWarner Losh <listitem><para>Embedded configure-time-specified run-time options 836*c43cad87SWarner Losh string, empty unless <option>--with-malloc-conf</option> was specified 837*c43cad87SWarner Losh during build configuration.</para></listitem> 838*c43cad87SWarner Losh </varlistentry> 839*c43cad87SWarner Losh 840*c43cad87SWarner Losh <varlistentry id="config.prof"> 841*c43cad87SWarner Losh <term> 842*c43cad87SWarner Losh <mallctl>config.prof</mallctl> 843*c43cad87SWarner Losh (<type>bool</type>) 844*c43cad87SWarner Losh <literal>r-</literal> 845*c43cad87SWarner Losh </term> 846*c43cad87SWarner Losh <listitem><para><option>--enable-prof</option> was specified during 847*c43cad87SWarner Losh build configuration.</para></listitem> 848*c43cad87SWarner Losh </varlistentry> 849*c43cad87SWarner Losh 850*c43cad87SWarner Losh <varlistentry id="config.prof_libgcc"> 851*c43cad87SWarner Losh <term> 852*c43cad87SWarner Losh <mallctl>config.prof_libgcc</mallctl> 853*c43cad87SWarner Losh (<type>bool</type>) 854*c43cad87SWarner Losh <literal>r-</literal> 855*c43cad87SWarner Losh </term> 856*c43cad87SWarner Losh <listitem><para><option>--disable-prof-libgcc</option> was not 857*c43cad87SWarner Losh specified during build configuration.</para></listitem> 858*c43cad87SWarner Losh </varlistentry> 859*c43cad87SWarner Losh 860*c43cad87SWarner Losh <varlistentry id="config.prof_libunwind"> 861*c43cad87SWarner Losh <term> 862*c43cad87SWarner Losh <mallctl>config.prof_libunwind</mallctl> 863*c43cad87SWarner Losh (<type>bool</type>) 864*c43cad87SWarner Losh <literal>r-</literal> 865*c43cad87SWarner Losh </term> 866*c43cad87SWarner Losh <listitem><para><option>--enable-prof-libunwind</option> was specified 867*c43cad87SWarner Losh during build configuration.</para></listitem> 868*c43cad87SWarner Losh </varlistentry> 869*c43cad87SWarner Losh 870*c43cad87SWarner Losh <varlistentry id="config.stats"> 871*c43cad87SWarner Losh <term> 872*c43cad87SWarner Losh <mallctl>config.stats</mallctl> 873*c43cad87SWarner Losh (<type>bool</type>) 874*c43cad87SWarner Losh <literal>r-</literal> 875*c43cad87SWarner Losh </term> 876*c43cad87SWarner Losh <listitem><para><option>--enable-stats</option> was specified during 877*c43cad87SWarner Losh build configuration.</para></listitem> 878*c43cad87SWarner Losh </varlistentry> 879*c43cad87SWarner Losh 880*c43cad87SWarner Losh 881*c43cad87SWarner Losh <varlistentry id="config.utrace"> 882*c43cad87SWarner Losh <term> 883*c43cad87SWarner Losh <mallctl>config.utrace</mallctl> 884*c43cad87SWarner Losh (<type>bool</type>) 885*c43cad87SWarner Losh <literal>r-</literal> 886*c43cad87SWarner Losh </term> 887*c43cad87SWarner Losh <listitem><para><option>--enable-utrace</option> was specified during 888*c43cad87SWarner Losh build configuration.</para></listitem> 889*c43cad87SWarner Losh </varlistentry> 890*c43cad87SWarner Losh 891*c43cad87SWarner Losh <varlistentry id="config.xmalloc"> 892*c43cad87SWarner Losh <term> 893*c43cad87SWarner Losh <mallctl>config.xmalloc</mallctl> 894*c43cad87SWarner Losh (<type>bool</type>) 895*c43cad87SWarner Losh <literal>r-</literal> 896*c43cad87SWarner Losh </term> 897*c43cad87SWarner Losh <listitem><para><option>--enable-xmalloc</option> was specified during 898*c43cad87SWarner Losh build configuration.</para></listitem> 899*c43cad87SWarner Losh </varlistentry> 900*c43cad87SWarner Losh 901*c43cad87SWarner Losh <varlistentry id="opt.abort"> 902*c43cad87SWarner Losh <term> 903*c43cad87SWarner Losh <mallctl>opt.abort</mallctl> 904*c43cad87SWarner Losh (<type>bool</type>) 905*c43cad87SWarner Losh <literal>r-</literal> 906*c43cad87SWarner Losh </term> 907*c43cad87SWarner Losh <listitem><para>Abort-on-warning enabled/disabled. If true, most 908*c43cad87SWarner Losh warnings are fatal. Note that runtime option warnings are not included 909*c43cad87SWarner Losh (see <link 910*c43cad87SWarner Losh linkend="opt.abort_conf"><mallctl>opt.abort_conf</mallctl></link> for 911*c43cad87SWarner Losh that). The process will call 912*c43cad87SWarner Losh <citerefentry><refentrytitle>abort</refentrytitle> 913*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry> in these cases. This option is 914*c43cad87SWarner Losh disabled by default unless <option>--enable-debug</option> is 915*c43cad87SWarner Losh specified during configuration, in which case it is enabled by default. 916*c43cad87SWarner Losh </para></listitem> 917*c43cad87SWarner Losh </varlistentry> 918*c43cad87SWarner Losh 919*c43cad87SWarner Losh <varlistentry id="opt.confirm_conf"> 920*c43cad87SWarner Losh <term> 921*c43cad87SWarner Losh <mallctl>opt.confirm_conf</mallctl> 922*c43cad87SWarner Losh (<type>bool</type>) 923*c43cad87SWarner Losh <literal>r-</literal> 924*c43cad87SWarner Losh </term> 925*c43cad87SWarner Losh <listitem><para>Confirm-runtime-options-when-program-starts 926*c43cad87SWarner Losh enabled/disabled. If true, the string specified via 927*c43cad87SWarner Losh <option>--with-malloc-conf</option>, the string pointed to by the 928*c43cad87SWarner Losh global variable <varname>malloc_conf</varname>, the <quote>name</quote> 929*c43cad87SWarner Losh of the file referenced by the symbolic link named 930*c43cad87SWarner Losh <filename class="symlink">/etc/malloc.conf</filename>, and the value of 931*c43cad87SWarner Losh the environment variable <envar>MALLOC_CONF</envar>, will be printed in 932*c43cad87SWarner Losh order. Then, each option being set will be individually printed. This 933*c43cad87SWarner Losh option is disabled by default.</para></listitem> 934*c43cad87SWarner Losh </varlistentry> 935*c43cad87SWarner Losh 936*c43cad87SWarner Losh <varlistentry id="opt.abort_conf"> 937*c43cad87SWarner Losh <term> 938*c43cad87SWarner Losh <mallctl>opt.abort_conf</mallctl> 939*c43cad87SWarner Losh (<type>bool</type>) 940*c43cad87SWarner Losh <literal>r-</literal> 941*c43cad87SWarner Losh </term> 942*c43cad87SWarner Losh <listitem><para>Abort-on-invalid-configuration enabled/disabled. If 943*c43cad87SWarner Losh true, invalid runtime options are fatal. The process will call 944*c43cad87SWarner Losh <citerefentry><refentrytitle>abort</refentrytitle> 945*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry> in these cases. This option is 946*c43cad87SWarner Losh disabled by default unless <option>--enable-debug</option> is 947*c43cad87SWarner Losh specified during configuration, in which case it is enabled by default. 948*c43cad87SWarner Losh </para></listitem> 949*c43cad87SWarner Losh </varlistentry> 950*c43cad87SWarner Losh 951*c43cad87SWarner Losh <varlistentry id="opt.cache_oblivious"> 952*c43cad87SWarner Losh <term> 953*c43cad87SWarner Losh <mallctl>opt.cache_oblivious</mallctl> 954*c43cad87SWarner Losh (<type>bool</type>) 955*c43cad87SWarner Losh <literal>r-</literal> 956*c43cad87SWarner Losh </term> 957*c43cad87SWarner Losh <listitem><para>Enable / Disable cache-oblivious large allocation 958*c43cad87SWarner Losh alignment, for large requests with no alignment constraints. If this 959*c43cad87SWarner Losh feature is disabled, all large allocations are page-aligned as an 960*c43cad87SWarner Losh implementation artifact, which can severely harm CPU cache utilization. 961*c43cad87SWarner Losh However, the cache-oblivious layout comes at the cost of one extra page 962*c43cad87SWarner Losh per large allocation, which in the most extreme case increases physical 963*c43cad87SWarner Losh memory usage for the 16 KiB size class to 20 KiB. This option is enabled 964*c43cad87SWarner Losh by default.</para></listitem> 965*c43cad87SWarner Losh </varlistentry> 966*c43cad87SWarner Losh 967*c43cad87SWarner Losh <varlistentry id="opt.metadata_thp"> 968*c43cad87SWarner Losh <term> 969*c43cad87SWarner Losh <mallctl>opt.metadata_thp</mallctl> 970*c43cad87SWarner Losh (<type>const char *</type>) 971*c43cad87SWarner Losh <literal>r-</literal> 972*c43cad87SWarner Losh </term> 973*c43cad87SWarner Losh <listitem><para>Controls whether to allow jemalloc to use transparent 974*c43cad87SWarner Losh huge page (THP) for internal metadata (see <link 975*c43cad87SWarner Losh linkend="stats.metadata">stats.metadata</link>). <quote>always</quote> 976*c43cad87SWarner Losh allows such usage. <quote>auto</quote> uses no THP initially, but may 977*c43cad87SWarner Losh begin to do so when metadata usage reaches certain level. The default 978*c43cad87SWarner Losh is <quote>disabled</quote>.</para></listitem> 979*c43cad87SWarner Losh </varlistentry> 980*c43cad87SWarner Losh 981*c43cad87SWarner Losh <varlistentry id="opt.trust_madvise"> 982*c43cad87SWarner Losh <term> 983*c43cad87SWarner Losh <mallctl>opt.trust_madvise</mallctl> 984*c43cad87SWarner Losh (<type>bool</type>) 985*c43cad87SWarner Losh <literal>r-</literal> 986*c43cad87SWarner Losh </term> 987*c43cad87SWarner Losh <listitem><para>If true, do not perform runtime check for MADV_DONTNEED, 988*c43cad87SWarner Losh to check that it actually zeros pages. The default is disabled on Linux 989*c43cad87SWarner Losh and enabled elsewhere.</para></listitem> 990*c43cad87SWarner Losh </varlistentry> 991*c43cad87SWarner Losh 992*c43cad87SWarner Losh <varlistentry id="opt.retain"> 993*c43cad87SWarner Losh <term> 994*c43cad87SWarner Losh <mallctl>opt.retain</mallctl> 995*c43cad87SWarner Losh (<type>bool</type>) 996*c43cad87SWarner Losh <literal>r-</literal> 997*c43cad87SWarner Losh </term> 998*c43cad87SWarner Losh <listitem><para>If true, retain unused virtual memory for later reuse 999*c43cad87SWarner Losh rather than discarding it by calling 1000*c43cad87SWarner Losh <citerefentry><refentrytitle>munmap</refentrytitle> 1001*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> or equivalent (see <link 1002*c43cad87SWarner Losh linkend="stats.retained">stats.retained</link> for related details). 1003*c43cad87SWarner Losh It also makes jemalloc use <citerefentry> 1004*c43cad87SWarner Losh <refentrytitle>mmap</refentrytitle><manvolnum>2</manvolnum> 1005*c43cad87SWarner Losh </citerefentry> or equivalent in a more greedy way, mapping larger 1006*c43cad87SWarner Losh chunks in one go. This option is disabled by default unless discarding 1007*c43cad87SWarner Losh virtual memory is known to trigger platform-specific performance 1008*c43cad87SWarner Losh problems, namely 1) for [64-bit] Linux, which has a quirk in its virtual 1009*c43cad87SWarner Losh memory allocation algorithm that causes semi-permanent VM map holes 1010*c43cad87SWarner Losh under normal jemalloc operation; and 2) for [64-bit] Windows, which 1011*c43cad87SWarner Losh disallows split / merged regions with 1012*c43cad87SWarner Losh <parameter><constant>MEM_RELEASE</constant></parameter>. Although the 1013*c43cad87SWarner Losh same issues may present on 32-bit platforms as well, retaining virtual 1014*c43cad87SWarner Losh memory for 32-bit Linux and Windows is disabled by default due to the 1015*c43cad87SWarner Losh practical possibility of address space exhaustion. </para></listitem> 1016*c43cad87SWarner Losh </varlistentry> 1017*c43cad87SWarner Losh 1018*c43cad87SWarner Losh <varlistentry id="opt.dss"> 1019*c43cad87SWarner Losh <term> 1020*c43cad87SWarner Losh <mallctl>opt.dss</mallctl> 1021*c43cad87SWarner Losh (<type>const char *</type>) 1022*c43cad87SWarner Losh <literal>r-</literal> 1023*c43cad87SWarner Losh </term> 1024*c43cad87SWarner Losh <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle> 1025*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>) allocation precedence as 1026*c43cad87SWarner Losh related to <citerefentry><refentrytitle>mmap</refentrytitle> 1027*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> allocation. The following 1028*c43cad87SWarner Losh settings are supported if 1029*c43cad87SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 1030*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> is supported by the operating 1031*c43cad87SWarner Losh system: <quote>disabled</quote>, <quote>primary</quote>, and 1032*c43cad87SWarner Losh <quote>secondary</quote>; otherwise only <quote>disabled</quote> is 1033*c43cad87SWarner Losh supported. The default is <quote>secondary</quote> if 1034*c43cad87SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 1035*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> is supported by the operating 1036*c43cad87SWarner Losh system; <quote>disabled</quote> otherwise. 1037*c43cad87SWarner Losh </para></listitem> 1038*c43cad87SWarner Losh </varlistentry> 1039*c43cad87SWarner Losh 1040*c43cad87SWarner Losh <varlistentry id="opt.narenas"> 1041*c43cad87SWarner Losh <term> 1042*c43cad87SWarner Losh <mallctl>opt.narenas</mallctl> 1043*c43cad87SWarner Losh (<type>unsigned</type>) 1044*c43cad87SWarner Losh <literal>r-</literal> 1045*c43cad87SWarner Losh </term> 1046*c43cad87SWarner Losh <listitem><para>Maximum number of arenas to use for automatic 1047*c43cad87SWarner Losh multiplexing of threads and arenas. The default is four times the 1048*c43cad87SWarner Losh number of CPUs, or one if there is a single CPU.</para></listitem> 1049*c43cad87SWarner Losh </varlistentry> 1050*c43cad87SWarner Losh 1051*c43cad87SWarner Losh <varlistentry id="opt.oversize_threshold"> 1052*c43cad87SWarner Losh <term> 1053*c43cad87SWarner Losh <mallctl>opt.oversize_threshold</mallctl> 1054*c43cad87SWarner Losh (<type>size_t</type>) 1055*c43cad87SWarner Losh <literal>r-</literal> 1056*c43cad87SWarner Losh </term> 1057*c43cad87SWarner Losh <listitem><para>The threshold in bytes of which requests are considered 1058*c43cad87SWarner Losh oversize. Allocation requests with greater sizes are fulfilled from a 1059*c43cad87SWarner Losh dedicated arena (automatically managed, however not within 1060*c43cad87SWarner Losh <literal>narenas</literal>), in order to reduce fragmentation by not 1061*c43cad87SWarner Losh mixing huge allocations with small ones. In addition, the decay API 1062*c43cad87SWarner Losh guarantees on the extents greater than the specified threshold may be 1063*c43cad87SWarner Losh overridden. Note that requests with arena index specified via 1064*c43cad87SWarner Losh <constant>MALLOCX_ARENA</constant>, or threads associated with explicit 1065*c43cad87SWarner Losh arenas will not be considered. The default threshold is 8MiB. Values 1066*c43cad87SWarner Losh not within large size classes disables this feature.</para></listitem> 1067*c43cad87SWarner Losh </varlistentry> 1068*c43cad87SWarner Losh 1069*c43cad87SWarner Losh <varlistentry id="opt.percpu_arena"> 1070*c43cad87SWarner Losh <term> 1071*c43cad87SWarner Losh <mallctl>opt.percpu_arena</mallctl> 1072*c43cad87SWarner Losh (<type>const char *</type>) 1073*c43cad87SWarner Losh <literal>r-</literal> 1074*c43cad87SWarner Losh </term> 1075*c43cad87SWarner Losh <listitem><para>Per CPU arena mode. Use the <quote>percpu</quote> 1076*c43cad87SWarner Losh setting to enable this feature, which uses number of CPUs to determine 1077*c43cad87SWarner Losh number of arenas, and bind threads to arenas dynamically based on the 1078*c43cad87SWarner Losh CPU the thread runs on currently. <quote>phycpu</quote> setting uses 1079*c43cad87SWarner Losh one arena per physical CPU, which means the two hyper threads on the 1080*c43cad87SWarner Losh same CPU share one arena. Note that no runtime checking regarding the 1081*c43cad87SWarner Losh availability of hyper threading is done at the moment. When set to 1082*c43cad87SWarner Losh <quote>disabled</quote>, narenas and thread to arena association will 1083*c43cad87SWarner Losh not be impacted by this option. The default is <quote>disabled</quote>. 1084*c43cad87SWarner Losh </para></listitem> 1085*c43cad87SWarner Losh </varlistentry> 1086*c43cad87SWarner Losh 1087*c43cad87SWarner Losh <varlistentry id="opt.background_thread"> 1088*c43cad87SWarner Losh <term> 1089*c43cad87SWarner Losh <mallctl>opt.background_thread</mallctl> 1090*c43cad87SWarner Losh (<type>bool</type>) 1091*c43cad87SWarner Losh <literal>r-</literal> 1092*c43cad87SWarner Losh </term> 1093*c43cad87SWarner Losh <listitem><para>Internal background worker threads enabled/disabled. 1094*c43cad87SWarner Losh Because of potential circular dependencies, enabling background thread 1095*c43cad87SWarner Losh using this option may cause crash or deadlock during initialization. For 1096*c43cad87SWarner Losh a reliable way to use this feature, see <link 1097*c43cad87SWarner Losh linkend="background_thread">background_thread</link> for dynamic control 1098*c43cad87SWarner Losh options and details. This option is disabled by 1099*c43cad87SWarner Losh default.</para></listitem> 1100*c43cad87SWarner Losh </varlistentry> 1101*c43cad87SWarner Losh 1102*c43cad87SWarner Losh <varlistentry id="opt.max_background_threads"> 1103*c43cad87SWarner Losh <term> 1104*c43cad87SWarner Losh <mallctl>opt.max_background_threads</mallctl> 1105*c43cad87SWarner Losh (<type>size_t</type>) 1106*c43cad87SWarner Losh <literal>r-</literal> 1107*c43cad87SWarner Losh </term> 1108*c43cad87SWarner Losh <listitem><para>Maximum number of background threads that will be created 1109*c43cad87SWarner Losh if <link linkend="background_thread">background_thread</link> is set. 1110*c43cad87SWarner Losh Defaults to number of cpus.</para></listitem> 1111*c43cad87SWarner Losh </varlistentry> 1112*c43cad87SWarner Losh 1113*c43cad87SWarner Losh <varlistentry id="opt.dirty_decay_ms"> 1114*c43cad87SWarner Losh <term> 1115*c43cad87SWarner Losh <mallctl>opt.dirty_decay_ms</mallctl> 1116*c43cad87SWarner Losh (<type>ssize_t</type>) 1117*c43cad87SWarner Losh <literal>r-</literal> 1118*c43cad87SWarner Losh </term> 1119*c43cad87SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 1120*c43cad87SWarner Losh set of unused dirty pages until an equivalent set of unused dirty pages 1121*c43cad87SWarner Losh is purged (i.e. converted to muzzy via e.g. 1122*c43cad87SWarner Losh <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function> 1123*c43cad87SWarner Losh if supported by the operating system, or converted to clean otherwise) 1124*c43cad87SWarner Losh and/or reused. Dirty pages are defined as previously having been 1125*c43cad87SWarner Losh potentially written to by the application, and therefore consuming 1126*c43cad87SWarner Losh physical memory, yet having no current use. The pages are incrementally 1127*c43cad87SWarner Losh purged according to a sigmoidal decay curve that starts and ends with 1128*c43cad87SWarner Losh zero purge rate. A decay time of 0 causes all unused dirty pages to be 1129*c43cad87SWarner Losh purged immediately upon creation. A decay time of -1 disables purging. 1130*c43cad87SWarner Losh The default decay time is 10 seconds. See <link 1131*c43cad87SWarner Losh linkend="arenas.dirty_decay_ms"><mallctl>arenas.dirty_decay_ms</mallctl></link> 1132*c43cad87SWarner Losh and <link 1133*c43cad87SWarner Losh linkend="arena.i.dirty_decay_ms"><mallctl>arena.<i>.dirty_decay_ms</mallctl></link> 1134*c43cad87SWarner Losh for related dynamic control options. See <link 1135*c43cad87SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 1136*c43cad87SWarner Losh for a description of muzzy pages.for a description of muzzy pages. Note 1137*c43cad87SWarner Losh that when the <link 1138*c43cad87SWarner Losh linkend="opt.oversize_threshold"><mallctl>oversize_threshold</mallctl></link> 1139*c43cad87SWarner Losh feature is enabled, the arenas reserved for oversize requests may have 1140*c43cad87SWarner Losh its own default decay settings.</para></listitem> 1141*c43cad87SWarner Losh </varlistentry> 1142*c43cad87SWarner Losh 1143*c43cad87SWarner Losh <varlistentry id="opt.muzzy_decay_ms"> 1144*c43cad87SWarner Losh <term> 1145*c43cad87SWarner Losh <mallctl>opt.muzzy_decay_ms</mallctl> 1146*c43cad87SWarner Losh (<type>ssize_t</type>) 1147*c43cad87SWarner Losh <literal>r-</literal> 1148*c43cad87SWarner Losh </term> 1149*c43cad87SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 1150*c43cad87SWarner Losh set of unused muzzy pages until an equivalent set of unused muzzy pages 1151*c43cad87SWarner Losh is purged (i.e. converted to clean) and/or reused. Muzzy pages are 1152*c43cad87SWarner Losh defined as previously having been unused dirty pages that were 1153*c43cad87SWarner Losh subsequently purged in a manner that left them subject to the 1154*c43cad87SWarner Losh reclamation whims of the operating system (e.g. 1155*c43cad87SWarner Losh <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>), 1156*c43cad87SWarner Losh and therefore in an indeterminate state. The pages are incrementally 1157*c43cad87SWarner Losh purged according to a sigmoidal decay curve that starts and ends with 1158*c43cad87SWarner Losh zero purge rate. A decay time of 0 causes all unused muzzy pages to be 1159*c43cad87SWarner Losh purged immediately upon creation. A decay time of -1 disables purging. 1160*c43cad87SWarner Losh The default decay time is 10 seconds. See <link 1161*c43cad87SWarner Losh linkend="arenas.muzzy_decay_ms"><mallctl>arenas.muzzy_decay_ms</mallctl></link> 1162*c43cad87SWarner Losh and <link 1163*c43cad87SWarner Losh linkend="arena.i.muzzy_decay_ms"><mallctl>arena.<i>.muzzy_decay_ms</mallctl></link> 1164*c43cad87SWarner Losh for related dynamic control options.</para></listitem> 1165*c43cad87SWarner Losh </varlistentry> 1166*c43cad87SWarner Losh 1167*c43cad87SWarner Losh <varlistentry id="opt.lg_extent_max_active_fit"> 1168*c43cad87SWarner Losh <term> 1169*c43cad87SWarner Losh <mallctl>opt.lg_extent_max_active_fit</mallctl> 1170*c43cad87SWarner Losh (<type>size_t</type>) 1171*c43cad87SWarner Losh <literal>r-</literal> 1172*c43cad87SWarner Losh </term> 1173*c43cad87SWarner Losh <listitem><para>When reusing dirty extents, this determines the (log 1174*c43cad87SWarner Losh base 2 of the) maximum ratio between the size of the active extent 1175*c43cad87SWarner Losh selected (to split off from) and the size of the requested allocation. 1176*c43cad87SWarner Losh This prevents the splitting of large active extents for smaller 1177*c43cad87SWarner Losh allocations, which can reduce fragmentation over the long run 1178*c43cad87SWarner Losh (especially for non-active extents). Lower value may reduce 1179*c43cad87SWarner Losh fragmentation, at the cost of extra active extents. The default value 1180*c43cad87SWarner Losh is 6, which gives a maximum ratio of 64 (2^6).</para></listitem> 1181*c43cad87SWarner Losh </varlistentry> 1182*c43cad87SWarner Losh 1183*c43cad87SWarner Losh <varlistentry id="opt.stats_print"> 1184*c43cad87SWarner Losh <term> 1185*c43cad87SWarner Losh <mallctl>opt.stats_print</mallctl> 1186*c43cad87SWarner Losh (<type>bool</type>) 1187*c43cad87SWarner Losh <literal>r-</literal> 1188*c43cad87SWarner Losh </term> 1189*c43cad87SWarner Losh <listitem><para>Enable/disable statistics printing at exit. If 1190*c43cad87SWarner Losh enabled, the <function>malloc_stats_print()</function> 1191*c43cad87SWarner Losh function is called at program exit via an 1192*c43cad87SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 1193*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry> function. <link 1194*c43cad87SWarner Losh linkend="opt.stats_print_opts"><mallctl>opt.stats_print_opts</mallctl></link> 1195*c43cad87SWarner Losh can be combined to specify output options. If 1196*c43cad87SWarner Losh <option>--enable-stats</option> is specified during configuration, this 1197*c43cad87SWarner Losh has the potential to cause deadlock for a multi-threaded process that 1198*c43cad87SWarner Losh exits while one or more threads are executing in the memory allocation 1199*c43cad87SWarner Losh functions. Furthermore, <function>atexit()</function> may 1200*c43cad87SWarner Losh allocate memory during application initialization and then deadlock 1201*c43cad87SWarner Losh internally when jemalloc in turn calls 1202*c43cad87SWarner Losh <function>atexit()</function>, so this option is not 1203*c43cad87SWarner Losh universally usable (though the application can register its own 1204*c43cad87SWarner Losh <function>atexit()</function> function with equivalent 1205*c43cad87SWarner Losh functionality). Therefore, this option should only be used with care; 1206*c43cad87SWarner Losh it is primarily intended as a performance tuning aid during application 1207*c43cad87SWarner Losh development. This option is disabled by default.</para></listitem> 1208*c43cad87SWarner Losh </varlistentry> 1209*c43cad87SWarner Losh 1210*c43cad87SWarner Losh <varlistentry id="opt.stats_print_opts"> 1211*c43cad87SWarner Losh <term> 1212*c43cad87SWarner Losh <mallctl>opt.stats_print_opts</mallctl> 1213*c43cad87SWarner Losh (<type>const char *</type>) 1214*c43cad87SWarner Losh <literal>r-</literal> 1215*c43cad87SWarner Losh </term> 1216*c43cad87SWarner Losh <listitem><para>Options (the <parameter>opts</parameter> string) to pass 1217*c43cad87SWarner Losh to the <function>malloc_stats_print()</function> at exit (enabled 1218*c43cad87SWarner Losh through <link 1219*c43cad87SWarner Losh linkend="opt.stats_print"><mallctl>opt.stats_print</mallctl></link>). See 1220*c43cad87SWarner Losh available options in <link 1221*c43cad87SWarner Losh linkend="malloc_stats_print_opts"><function>malloc_stats_print()</function></link>. 1222*c43cad87SWarner Losh Has no effect unless <link 1223*c43cad87SWarner Losh linkend="opt.stats_print"><mallctl>opt.stats_print</mallctl></link> is 1224*c43cad87SWarner Losh enabled. The default is <quote></quote>.</para></listitem> 1225*c43cad87SWarner Losh </varlistentry> 1226*c43cad87SWarner Losh 1227*c43cad87SWarner Losh <varlistentry id="opt.stats_interval"> 1228*c43cad87SWarner Losh <term> 1229*c43cad87SWarner Losh <mallctl>opt.stats_interval</mallctl> 1230*c43cad87SWarner Losh (<type>int64_t</type>) 1231*c43cad87SWarner Losh <literal>r-</literal> 1232*c43cad87SWarner Losh </term> 1233*c43cad87SWarner Losh <listitem><para>Average interval between statistics outputs, as measured 1234*c43cad87SWarner Losh in bytes of allocation activity. The actual interval may be sporadic 1235*c43cad87SWarner Losh because decentralized event counters are used to avoid synchronization 1236*c43cad87SWarner Losh bottlenecks. The output may be triggered on any thread, which then 1237*c43cad87SWarner Losh calls <function>malloc_stats_print()</function>. <link 1238*c43cad87SWarner Losh linkend="opt.stats_interval_opts"><mallctl>opt.stats_interval_opts</mallctl></link> 1239*c43cad87SWarner Losh can be combined to specify output options. By default, 1240*c43cad87SWarner Losh interval-triggered stats output is disabled (encoded as 1241*c43cad87SWarner Losh -1).</para></listitem> 1242*c43cad87SWarner Losh </varlistentry> 1243*c43cad87SWarner Losh 1244*c43cad87SWarner Losh <varlistentry id="opt.stats_interval_opts"> 1245*c43cad87SWarner Losh <term> 1246*c43cad87SWarner Losh <mallctl>opt.stats_interval_opts</mallctl> 1247*c43cad87SWarner Losh (<type>const char *</type>) 1248*c43cad87SWarner Losh <literal>r-</literal> 1249*c43cad87SWarner Losh </term> 1250*c43cad87SWarner Losh <listitem><para>Options (the <parameter>opts</parameter> string) to pass 1251*c43cad87SWarner Losh to the <function>malloc_stats_print()</function> for interval based 1252*c43cad87SWarner Losh statistics printing (enabled 1253*c43cad87SWarner Losh through <link 1254*c43cad87SWarner Losh linkend="opt.stats_interval"><mallctl>opt.stats_interval</mallctl></link>). See 1255*c43cad87SWarner Losh available options in <link 1256*c43cad87SWarner Losh linkend="malloc_stats_print_opts"><function>malloc_stats_print()</function></link>. 1257*c43cad87SWarner Losh Has no effect unless <link 1258*c43cad87SWarner Losh linkend="opt.stats_interval"><mallctl>opt.stats_interval</mallctl></link> is 1259*c43cad87SWarner Losh enabled. The default is <quote></quote>.</para></listitem> 1260*c43cad87SWarner Losh </varlistentry> 1261*c43cad87SWarner Losh 1262*c43cad87SWarner Losh <varlistentry id="opt.junk"> 1263*c43cad87SWarner Losh <term> 1264*c43cad87SWarner Losh <mallctl>opt.junk</mallctl> 1265*c43cad87SWarner Losh (<type>const char *</type>) 1266*c43cad87SWarner Losh <literal>r-</literal> 1267*c43cad87SWarner Losh [<option>--enable-fill</option>] 1268*c43cad87SWarner Losh </term> 1269*c43cad87SWarner Losh <listitem><para>Junk filling. If set to <quote>alloc</quote>, each byte 1270*c43cad87SWarner Losh of uninitialized allocated memory will be initialized to 1271*c43cad87SWarner Losh <literal>0xa5</literal>. If set to <quote>free</quote>, all deallocated 1272*c43cad87SWarner Losh memory will be initialized to <literal>0x5a</literal>. If set to 1273*c43cad87SWarner Losh <quote>true</quote>, both allocated and deallocated memory will be 1274*c43cad87SWarner Losh initialized, and if set to <quote>false</quote>, junk filling be 1275*c43cad87SWarner Losh disabled entirely. This is intended for debugging and will impact 1276*c43cad87SWarner Losh performance negatively. This option is <quote>false</quote> by default 1277*c43cad87SWarner Losh unless <option>--enable-debug</option> is specified during 1278*c43cad87SWarner Losh configuration, in which case it is <quote>true</quote> by 1279*c43cad87SWarner Losh default.</para></listitem> 1280*c43cad87SWarner Losh </varlistentry> 1281*c43cad87SWarner Losh 1282*c43cad87SWarner Losh <varlistentry id="opt.zero"> 1283*c43cad87SWarner Losh <term> 1284*c43cad87SWarner Losh <mallctl>opt.zero</mallctl> 1285*c43cad87SWarner Losh (<type>bool</type>) 1286*c43cad87SWarner Losh <literal>r-</literal> 1287*c43cad87SWarner Losh [<option>--enable-fill</option>] 1288*c43cad87SWarner Losh </term> 1289*c43cad87SWarner Losh <listitem><para>Zero filling enabled/disabled. If enabled, each byte 1290*c43cad87SWarner Losh of uninitialized allocated memory will be initialized to 0. Note that 1291*c43cad87SWarner Losh this initialization only happens once for each byte, so 1292*c43cad87SWarner Losh <function>realloc()</function> and 1293*c43cad87SWarner Losh <function>rallocx()</function> calls do not zero memory that 1294*c43cad87SWarner Losh was previously allocated. This is intended for debugging and will 1295*c43cad87SWarner Losh impact performance negatively. This option is disabled by default. 1296*c43cad87SWarner Losh </para></listitem> 1297*c43cad87SWarner Losh </varlistentry> 1298*c43cad87SWarner Losh 1299*c43cad87SWarner Losh <varlistentry id="opt.utrace"> 1300*c43cad87SWarner Losh <term> 1301*c43cad87SWarner Losh <mallctl>opt.utrace</mallctl> 1302*c43cad87SWarner Losh (<type>bool</type>) 1303*c43cad87SWarner Losh <literal>r-</literal> 1304*c43cad87SWarner Losh [<option>--enable-utrace</option>] 1305*c43cad87SWarner Losh </term> 1306*c43cad87SWarner Losh <listitem><para>Allocation tracing based on 1307*c43cad87SWarner Losh <citerefentry><refentrytitle>utrace</refentrytitle> 1308*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> enabled/disabled. This option 1309*c43cad87SWarner Losh is disabled by default.</para></listitem> 1310*c43cad87SWarner Losh </varlistentry> 1311*c43cad87SWarner Losh 1312*c43cad87SWarner Losh <varlistentry id="opt.xmalloc"> 1313*c43cad87SWarner Losh <term> 1314*c43cad87SWarner Losh <mallctl>opt.xmalloc</mallctl> 1315*c43cad87SWarner Losh (<type>bool</type>) 1316*c43cad87SWarner Losh <literal>r-</literal> 1317*c43cad87SWarner Losh [<option>--enable-xmalloc</option>] 1318*c43cad87SWarner Losh </term> 1319*c43cad87SWarner Losh <listitem><para>Abort-on-out-of-memory enabled/disabled. If enabled, 1320*c43cad87SWarner Losh rather than returning failure for any allocation function, display a 1321*c43cad87SWarner Losh diagnostic message on <constant>STDERR_FILENO</constant> and cause the 1322*c43cad87SWarner Losh program to drop core (using 1323*c43cad87SWarner Losh <citerefentry><refentrytitle>abort</refentrytitle> 1324*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry>). If an application is 1325*c43cad87SWarner Losh designed to depend on this behavior, set the option at compile time by 1326*c43cad87SWarner Losh including the following in the source code: 1327*c43cad87SWarner Losh <programlisting language="C"><![CDATA[ 1328*c43cad87SWarner Loshmalloc_conf = "xmalloc:true";]]></programlisting> 1329*c43cad87SWarner Losh This option is disabled by default.</para></listitem> 1330*c43cad87SWarner Losh </varlistentry> 1331*c43cad87SWarner Losh 1332*c43cad87SWarner Losh <varlistentry id="opt.tcache"> 1333*c43cad87SWarner Losh <term> 1334*c43cad87SWarner Losh <mallctl>opt.tcache</mallctl> 1335*c43cad87SWarner Losh (<type>bool</type>) 1336*c43cad87SWarner Losh <literal>r-</literal> 1337*c43cad87SWarner Losh </term> 1338*c43cad87SWarner Losh <listitem><para>Thread-specific caching (tcache) enabled/disabled. When 1339*c43cad87SWarner Losh there are multiple threads, each thread uses a tcache for objects up to 1340*c43cad87SWarner Losh a certain size. Thread-specific caching allows many allocations to be 1341*c43cad87SWarner Losh satisfied without performing any thread synchronization, at the cost of 1342*c43cad87SWarner Losh increased memory use. See the <link 1343*c43cad87SWarner Losh linkend="opt.tcache_max"><mallctl>opt.tcache_max</mallctl></link> 1344*c43cad87SWarner Losh option for related tuning information. This option is enabled by 1345*c43cad87SWarner Losh default.</para></listitem> 1346*c43cad87SWarner Losh </varlistentry> 1347*c43cad87SWarner Losh 1348*c43cad87SWarner Losh <varlistentry id="opt.tcache_max"> 1349*c43cad87SWarner Losh <term> 1350*c43cad87SWarner Losh <mallctl>opt.tcache_max</mallctl> 1351*c43cad87SWarner Losh (<type>size_t</type>) 1352*c43cad87SWarner Losh <literal>r-</literal> 1353*c43cad87SWarner Losh </term> 1354*c43cad87SWarner Losh <listitem><para>Maximum size class to cache in the thread-specific cache 1355*c43cad87SWarner Losh (tcache). At a minimum, the first size class is cached; and at a 1356*c43cad87SWarner Losh maximum, size classes up to 8 MiB can be cached. The default maximum is 1357*c43cad87SWarner Losh 32 KiB (2^15). As a convenience, this may also be set by specifying 1358*c43cad87SWarner Losh lg_tcache_max, which will be taken to be the base-2 logarithm of the 1359*c43cad87SWarner Losh setting of tcache_max.</para></listitem> 1360*c43cad87SWarner Losh </varlistentry> 1361*c43cad87SWarner Losh 1362*c43cad87SWarner Losh <varlistentry id="opt.thp"> 1363*c43cad87SWarner Losh <term> 1364*c43cad87SWarner Losh <mallctl>opt.thp</mallctl> 1365*c43cad87SWarner Losh (<type>const char *</type>) 1366*c43cad87SWarner Losh <literal>r-</literal> 1367*c43cad87SWarner Losh </term> 1368*c43cad87SWarner Losh <listitem><para>Transparent hugepage (THP) mode. Settings "always", 1369*c43cad87SWarner Losh "never" and "default" are available if THP is supported by the operating 1370*c43cad87SWarner Losh system. The "always" setting enables transparent hugepage for all user 1371*c43cad87SWarner Losh memory mappings with 1372*c43cad87SWarner Losh <parameter><constant>MADV_HUGEPAGE</constant></parameter>; "never" 1373*c43cad87SWarner Losh ensures no transparent hugepage with 1374*c43cad87SWarner Losh <parameter><constant>MADV_NOHUGEPAGE</constant></parameter>; the default 1375*c43cad87SWarner Losh setting "default" makes no changes. Note that: this option does not 1376*c43cad87SWarner Losh affect THP for jemalloc internal metadata (see <link 1377*c43cad87SWarner Losh linkend="opt.metadata_thp"><mallctl>opt.metadata_thp</mallctl></link>); 1378*c43cad87SWarner Losh in addition, for arenas with customized <link 1379*c43cad87SWarner Losh linkend="arena.i.extent_hooks"><mallctl>extent_hooks</mallctl></link>, 1380*c43cad87SWarner Losh this option is bypassed as it is implemented as part of the default 1381*c43cad87SWarner Losh extent hooks.</para></listitem> 1382*c43cad87SWarner Losh </varlistentry> 1383*c43cad87SWarner Losh 1384*c43cad87SWarner Losh <varlistentry id="opt.prof"> 1385*c43cad87SWarner Losh <term> 1386*c43cad87SWarner Losh <mallctl>opt.prof</mallctl> 1387*c43cad87SWarner Losh (<type>bool</type>) 1388*c43cad87SWarner Losh <literal>r-</literal> 1389*c43cad87SWarner Losh [<option>--enable-prof</option>] 1390*c43cad87SWarner Losh </term> 1391*c43cad87SWarner Losh <listitem><para>Memory profiling enabled/disabled. If enabled, profile 1392*c43cad87SWarner Losh memory allocation activity. See the <link 1393*c43cad87SWarner Losh linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link> 1394*c43cad87SWarner Losh option for on-the-fly activation/deactivation. See the <link 1395*c43cad87SWarner Losh linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link> 1396*c43cad87SWarner Losh option for probabilistic sampling control. See the <link 1397*c43cad87SWarner Losh linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link> 1398*c43cad87SWarner Losh option for control of cumulative sample reporting. See the <link 1399*c43cad87SWarner Losh linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link> 1400*c43cad87SWarner Losh option for information on interval-triggered profile dumping, the <link 1401*c43cad87SWarner Losh linkend="opt.prof_gdump"><mallctl>opt.prof_gdump</mallctl></link> 1402*c43cad87SWarner Losh option for information on high-water-triggered profile dumping, and the 1403*c43cad87SWarner Losh <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl></link> 1404*c43cad87SWarner Losh option for final profile dumping. Profile output is compatible with 1405*c43cad87SWarner Losh the <command>jeprof</command> command, which is based on the 1406*c43cad87SWarner Losh <command>pprof</command> that is developed as part of the <ulink 1407*c43cad87SWarner Losh url="http://code.google.com/p/gperftools/">gperftools 1408*c43cad87SWarner Losh package</ulink>. See <link linkend="heap_profile_format">HEAP PROFILE 1409*c43cad87SWarner Losh FORMAT</link> for heap profile format documentation.</para></listitem> 1410*c43cad87SWarner Losh </varlistentry> 1411*c43cad87SWarner Losh 1412*c43cad87SWarner Losh <varlistentry id="opt.prof_prefix"> 1413*c43cad87SWarner Losh <term> 1414*c43cad87SWarner Losh <mallctl>opt.prof_prefix</mallctl> 1415*c43cad87SWarner Losh (<type>const char *</type>) 1416*c43cad87SWarner Losh <literal>r-</literal> 1417*c43cad87SWarner Losh [<option>--enable-prof</option>] 1418*c43cad87SWarner Losh </term> 1419*c43cad87SWarner Losh <listitem><para>Filename prefix for profile dumps. If the prefix is 1420*c43cad87SWarner Losh set to the empty string, no automatic dumps will occur; this is 1421*c43cad87SWarner Losh primarily useful for disabling the automatic final heap dump (which 1422*c43cad87SWarner Losh also disables leak reporting, if enabled). The default prefix is 1423*c43cad87SWarner Losh <filename>jeprof</filename>. This prefix value can be overridden by 1424*c43cad87SWarner Losh <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link>. 1425*c43cad87SWarner Losh </para></listitem> 1426*c43cad87SWarner Losh </varlistentry> 1427*c43cad87SWarner Losh 1428*c43cad87SWarner Losh <varlistentry id="opt.prof_active"> 1429*c43cad87SWarner Losh <term> 1430*c43cad87SWarner Losh <mallctl>opt.prof_active</mallctl> 1431*c43cad87SWarner Losh (<type>bool</type>) 1432*c43cad87SWarner Losh <literal>r-</literal> 1433*c43cad87SWarner Losh [<option>--enable-prof</option>] 1434*c43cad87SWarner Losh </term> 1435*c43cad87SWarner Losh <listitem><para>Profiling activated/deactivated. This is a secondary 1436*c43cad87SWarner Losh control mechanism that makes it possible to start the application with 1437*c43cad87SWarner Losh profiling enabled (see the <link 1438*c43cad87SWarner Losh linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option) but 1439*c43cad87SWarner Losh inactive, then toggle profiling at any time during program execution 1440*c43cad87SWarner Losh with the <link 1441*c43cad87SWarner Losh linkend="prof.active"><mallctl>prof.active</mallctl></link> mallctl. 1442*c43cad87SWarner Losh This option is enabled by default.</para></listitem> 1443*c43cad87SWarner Losh </varlistentry> 1444*c43cad87SWarner Losh 1445*c43cad87SWarner Losh <varlistentry id="opt.prof_thread_active_init"> 1446*c43cad87SWarner Losh <term> 1447*c43cad87SWarner Losh <mallctl>opt.prof_thread_active_init</mallctl> 1448*c43cad87SWarner Losh (<type>bool</type>) 1449*c43cad87SWarner Losh <literal>r-</literal> 1450*c43cad87SWarner Losh [<option>--enable-prof</option>] 1451*c43cad87SWarner Losh </term> 1452*c43cad87SWarner Losh <listitem><para>Initial setting for <link 1453*c43cad87SWarner Losh linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link> 1454*c43cad87SWarner Losh in newly created threads. The initial setting for newly created threads 1455*c43cad87SWarner Losh can also be changed during execution via the <link 1456*c43cad87SWarner Losh linkend="prof.thread_active_init"><mallctl>prof.thread_active_init</mallctl></link> 1457*c43cad87SWarner Losh mallctl. This option is enabled by default.</para></listitem> 1458*c43cad87SWarner Losh </varlistentry> 1459*c43cad87SWarner Losh 1460*c43cad87SWarner Losh <varlistentry id="opt.lg_prof_sample"> 1461*c43cad87SWarner Losh <term> 1462*c43cad87SWarner Losh <mallctl>opt.lg_prof_sample</mallctl> 1463*c43cad87SWarner Losh (<type>size_t</type>) 1464*c43cad87SWarner Losh <literal>r-</literal> 1465*c43cad87SWarner Losh [<option>--enable-prof</option>] 1466*c43cad87SWarner Losh </term> 1467*c43cad87SWarner Losh <listitem><para>Average interval (log base 2) between allocation 1468*c43cad87SWarner Losh samples, as measured in bytes of allocation activity. Increasing the 1469*c43cad87SWarner Losh sampling interval decreases profile fidelity, but also decreases the 1470*c43cad87SWarner Losh computational overhead. The default sample interval is 512 KiB (2^19 1471*c43cad87SWarner Losh B).</para></listitem> 1472*c43cad87SWarner Losh </varlistentry> 1473*c43cad87SWarner Losh 1474*c43cad87SWarner Losh <varlistentry id="opt.prof_accum"> 1475*c43cad87SWarner Losh <term> 1476*c43cad87SWarner Losh <mallctl>opt.prof_accum</mallctl> 1477*c43cad87SWarner Losh (<type>bool</type>) 1478*c43cad87SWarner Losh <literal>r-</literal> 1479*c43cad87SWarner Losh [<option>--enable-prof</option>] 1480*c43cad87SWarner Losh </term> 1481*c43cad87SWarner Losh <listitem><para>Reporting of cumulative object/byte counts in profile 1482*c43cad87SWarner Losh dumps enabled/disabled. If this option is enabled, every unique 1483*c43cad87SWarner Losh backtrace must be stored for the duration of execution. Depending on 1484*c43cad87SWarner Losh the application, this can impose a large memory overhead, and the 1485*c43cad87SWarner Losh cumulative counts are not always of interest. This option is disabled 1486*c43cad87SWarner Losh by default.</para></listitem> 1487*c43cad87SWarner Losh </varlistentry> 1488*c43cad87SWarner Losh 1489*c43cad87SWarner Losh <varlistentry id="opt.lg_prof_interval"> 1490*c43cad87SWarner Losh <term> 1491*c43cad87SWarner Losh <mallctl>opt.lg_prof_interval</mallctl> 1492*c43cad87SWarner Losh (<type>ssize_t</type>) 1493*c43cad87SWarner Losh <literal>r-</literal> 1494*c43cad87SWarner Losh [<option>--enable-prof</option>] 1495*c43cad87SWarner Losh </term> 1496*c43cad87SWarner Losh <listitem><para>Average interval (log base 2) between memory profile 1497*c43cad87SWarner Losh dumps, as measured in bytes of allocation activity. The actual 1498*c43cad87SWarner Losh interval between dumps may be sporadic because decentralized allocation 1499*c43cad87SWarner Losh counters are used to avoid synchronization bottlenecks. Profiles are 1500*c43cad87SWarner Losh dumped to files named according to the pattern 1501*c43cad87SWarner Losh <filename><prefix>.<pid>.<seq>.i<iseq>.heap</filename>, 1502*c43cad87SWarner Losh where <literal><prefix></literal> is controlled by the 1503*c43cad87SWarner Losh <link 1504*c43cad87SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> and 1505*c43cad87SWarner Losh <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link> 1506*c43cad87SWarner Losh options. By default, interval-triggered profile dumping is disabled 1507*c43cad87SWarner Losh (encoded as -1). 1508*c43cad87SWarner Losh </para></listitem> 1509*c43cad87SWarner Losh </varlistentry> 1510*c43cad87SWarner Losh 1511*c43cad87SWarner Losh <varlistentry id="opt.prof_gdump"> 1512*c43cad87SWarner Losh <term> 1513*c43cad87SWarner Losh <mallctl>opt.prof_gdump</mallctl> 1514*c43cad87SWarner Losh (<type>bool</type>) 1515*c43cad87SWarner Losh <literal>r-</literal> 1516*c43cad87SWarner Losh [<option>--enable-prof</option>] 1517*c43cad87SWarner Losh </term> 1518*c43cad87SWarner Losh <listitem><para>Set the initial state of <link 1519*c43cad87SWarner Losh linkend="prof.gdump"><mallctl>prof.gdump</mallctl></link>, which when 1520*c43cad87SWarner Losh enabled triggers a memory profile dump every time the total virtual 1521*c43cad87SWarner Losh memory exceeds the previous maximum. This option is disabled by 1522*c43cad87SWarner Losh default.</para></listitem> 1523*c43cad87SWarner Losh </varlistentry> 1524*c43cad87SWarner Losh 1525*c43cad87SWarner Losh <varlistentry id="opt.prof_final"> 1526*c43cad87SWarner Losh <term> 1527*c43cad87SWarner Losh <mallctl>opt.prof_final</mallctl> 1528*c43cad87SWarner Losh (<type>bool</type>) 1529*c43cad87SWarner Losh <literal>r-</literal> 1530*c43cad87SWarner Losh [<option>--enable-prof</option>] 1531*c43cad87SWarner Losh </term> 1532*c43cad87SWarner Losh <listitem><para>Use an 1533*c43cad87SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 1534*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry> function to dump final memory 1535*c43cad87SWarner Losh usage to a file named according to the pattern 1536*c43cad87SWarner Losh <filename><prefix>.<pid>.<seq>.f.heap</filename>, 1537*c43cad87SWarner Losh where <literal><prefix></literal> is controlled by the <link 1538*c43cad87SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> and 1539*c43cad87SWarner Losh <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link> 1540*c43cad87SWarner Losh options. Note that <function>atexit()</function> may allocate 1541*c43cad87SWarner Losh memory during application initialization and then deadlock internally 1542*c43cad87SWarner Losh when jemalloc in turn calls <function>atexit()</function>, so 1543*c43cad87SWarner Losh this option is not universally usable (though the application can 1544*c43cad87SWarner Losh register its own <function>atexit()</function> function with 1545*c43cad87SWarner Losh equivalent functionality). This option is disabled by 1546*c43cad87SWarner Losh default.</para></listitem> 1547*c43cad87SWarner Losh </varlistentry> 1548*c43cad87SWarner Losh 1549*c43cad87SWarner Losh <varlistentry id="opt.prof_leak"> 1550*c43cad87SWarner Losh <term> 1551*c43cad87SWarner Losh <mallctl>opt.prof_leak</mallctl> 1552*c43cad87SWarner Losh (<type>bool</type>) 1553*c43cad87SWarner Losh <literal>r-</literal> 1554*c43cad87SWarner Losh [<option>--enable-prof</option>] 1555*c43cad87SWarner Losh </term> 1556*c43cad87SWarner Losh <listitem><para>Leak reporting enabled/disabled. If enabled, use an 1557*c43cad87SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 1558*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry> function to report memory leaks 1559*c43cad87SWarner Losh detected by allocation sampling. See the 1560*c43cad87SWarner Losh <link linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option for 1561*c43cad87SWarner Losh information on analyzing heap profile output. Works only when combined 1562*c43cad87SWarner Losh with <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl> 1563*c43cad87SWarner Losh </link>, otherwise does nothing. This option is disabled by default. 1564*c43cad87SWarner Losh </para></listitem> 1565*c43cad87SWarner Losh </varlistentry> 1566*c43cad87SWarner Losh 1567*c43cad87SWarner Losh <varlistentry id="opt.prof_leak_error"> 1568*c43cad87SWarner Losh <term> 1569*c43cad87SWarner Losh <mallctl>opt.prof_leak_error</mallctl> 1570*c43cad87SWarner Losh (<type>bool</type>) 1571*c43cad87SWarner Losh <literal>r-</literal> 1572*c43cad87SWarner Losh [<option>--enable-prof</option>] 1573*c43cad87SWarner Losh </term> 1574*c43cad87SWarner Losh <listitem><para>Similar to <link linkend="opt.prof_leak"><mallctl> 1575*c43cad87SWarner Losh opt.prof_leak</mallctl></link>, but makes the process exit with error 1576*c43cad87SWarner Losh code 1 if a memory leak is detected. This option supersedes 1577*c43cad87SWarner Losh <link linkend="opt.prof_leak"><mallctl>opt.prof_leak</mallctl></link>, 1578*c43cad87SWarner Losh meaning that if both are specified, this option takes precedence. When 1579*c43cad87SWarner Losh enabled, also enables <link linkend="opt.prof_leak"><mallctl> 1580*c43cad87SWarner Losh opt.prof_leak</mallctl></link>. Works only when combined with 1581*c43cad87SWarner Losh <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl></link>, 1582*c43cad87SWarner Losh otherwise does nothing. This option is disabled by default. 1583*c43cad87SWarner Losh </para></listitem> 1584*c43cad87SWarner Losh </varlistentry> 1585*c43cad87SWarner Losh 1586*c43cad87SWarner Losh <varlistentry id="opt.zero_realloc"> 1587*c43cad87SWarner Losh <term> 1588*c43cad87SWarner Losh <mallctl>opt.zero_realloc</mallctl> 1589*c43cad87SWarner Losh (<type>const char *</type>) 1590*c43cad87SWarner Losh <literal>r-</literal> 1591*c43cad87SWarner Losh </term> 1592*c43cad87SWarner Losh <listitem><para> Determines the behavior of 1593*c43cad87SWarner Losh <function>realloc()</function> when passed a value of zero for the new 1594*c43cad87SWarner Losh size. <quote>alloc</quote> treats this as an allocation of size zero 1595*c43cad87SWarner Losh (and returns a non-null result except in case of resource exhaustion). 1596*c43cad87SWarner Losh <quote>free</quote> treats this as a deallocation of the pointer, and 1597*c43cad87SWarner Losh returns <constant>NULL</constant> without setting 1598*c43cad87SWarner Losh <varname>errno</varname>. <quote>abort</quote> aborts the process if 1599*c43cad87SWarner Losh zero is passed. The default is <quote>free</quote> on Linux and 1600*c43cad87SWarner Losh Windows, and <quote>alloc</quote> elsewhere.</para> 1601*c43cad87SWarner Losh 1602*c43cad87SWarner Losh <para>There is considerable divergence of behaviors across 1603*c43cad87SWarner Losh implementations in handling this case. Many have the behavior of 1604*c43cad87SWarner Losh <quote>free</quote>. This can introduce security vulnerabilities, since 1605*c43cad87SWarner Losh a <constant>NULL</constant> return value indicates failure, and the 1606*c43cad87SWarner Losh continued validity of the passed-in pointer (per POSIX and C11). 1607*c43cad87SWarner Losh <quote>alloc</quote> is safe, but can cause leaks in programs that 1608*c43cad87SWarner Losh expect the common behavior. Programs intended to be portable and 1609*c43cad87SWarner Losh leak-free cannot assume either behavior, and must therefore never call 1610*c43cad87SWarner Losh realloc with a size of 0. The <quote>abort</quote> option enables these 1611*c43cad87SWarner Losh testing this behavior.</para></listitem> 1612*c43cad87SWarner Losh </varlistentry> 1613*c43cad87SWarner Losh 1614*c43cad87SWarner Losh <varlistentry id="thread.arena"> 1615*c43cad87SWarner Losh <term> 1616*c43cad87SWarner Losh <mallctl>thread.arena</mallctl> 1617*c43cad87SWarner Losh (<type>unsigned</type>) 1618*c43cad87SWarner Losh <literal>rw</literal> 1619*c43cad87SWarner Losh </term> 1620*c43cad87SWarner Losh <listitem><para>Get or set the arena associated with the calling 1621*c43cad87SWarner Losh thread. If the specified arena was not initialized beforehand (see the 1622*c43cad87SWarner Losh <link 1623*c43cad87SWarner Losh linkend="arena.i.initialized"><mallctl>arena.i.initialized</mallctl></link> 1624*c43cad87SWarner Losh mallctl), it will be automatically initialized as a side effect of 1625*c43cad87SWarner Losh calling this interface.</para></listitem> 1626*c43cad87SWarner Losh </varlistentry> 1627*c43cad87SWarner Losh 1628*c43cad87SWarner Losh <varlistentry id="thread.allocated"> 1629*c43cad87SWarner Losh <term> 1630*c43cad87SWarner Losh <mallctl>thread.allocated</mallctl> 1631*c43cad87SWarner Losh (<type>uint64_t</type>) 1632*c43cad87SWarner Losh <literal>r-</literal> 1633*c43cad87SWarner Losh [<option>--enable-stats</option>] 1634*c43cad87SWarner Losh </term> 1635*c43cad87SWarner Losh <listitem><para>Get the total number of bytes ever allocated by the 1636*c43cad87SWarner Losh calling thread. This counter has the potential to wrap around; it is 1637*c43cad87SWarner Losh up to the application to appropriately interpret the counter in such 1638*c43cad87SWarner Losh cases.</para></listitem> 1639*c43cad87SWarner Losh </varlistentry> 1640*c43cad87SWarner Losh 1641*c43cad87SWarner Losh <varlistentry id="thread.allocatedp"> 1642*c43cad87SWarner Losh <term> 1643*c43cad87SWarner Losh <mallctl>thread.allocatedp</mallctl> 1644*c43cad87SWarner Losh (<type>uint64_t *</type>) 1645*c43cad87SWarner Losh <literal>r-</literal> 1646*c43cad87SWarner Losh [<option>--enable-stats</option>] 1647*c43cad87SWarner Losh </term> 1648*c43cad87SWarner Losh <listitem><para>Get a pointer to the the value that is returned by the 1649*c43cad87SWarner Losh <link 1650*c43cad87SWarner Losh linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link> 1651*c43cad87SWarner Losh mallctl. This is useful for avoiding the overhead of repeated 1652*c43cad87SWarner Losh <function>mallctl*()</function> calls. Note that the underlying counter 1653*c43cad87SWarner Losh should not be modified by the application.</para></listitem> 1654*c43cad87SWarner Losh </varlistentry> 1655*c43cad87SWarner Losh 1656*c43cad87SWarner Losh <varlistentry id="thread.deallocated"> 1657*c43cad87SWarner Losh <term> 1658*c43cad87SWarner Losh <mallctl>thread.deallocated</mallctl> 1659*c43cad87SWarner Losh (<type>uint64_t</type>) 1660*c43cad87SWarner Losh <literal>r-</literal> 1661*c43cad87SWarner Losh [<option>--enable-stats</option>] 1662*c43cad87SWarner Losh </term> 1663*c43cad87SWarner Losh <listitem><para>Get the total number of bytes ever deallocated by the 1664*c43cad87SWarner Losh calling thread. This counter has the potential to wrap around; it is 1665*c43cad87SWarner Losh up to the application to appropriately interpret the counter in such 1666*c43cad87SWarner Losh cases.</para></listitem> 1667*c43cad87SWarner Losh </varlistentry> 1668*c43cad87SWarner Losh 1669*c43cad87SWarner Losh <varlistentry id="thread.deallocatedp"> 1670*c43cad87SWarner Losh <term> 1671*c43cad87SWarner Losh <mallctl>thread.deallocatedp</mallctl> 1672*c43cad87SWarner Losh (<type>uint64_t *</type>) 1673*c43cad87SWarner Losh <literal>r-</literal> 1674*c43cad87SWarner Losh [<option>--enable-stats</option>] 1675*c43cad87SWarner Losh </term> 1676*c43cad87SWarner Losh <listitem><para>Get a pointer to the the value that is returned by the 1677*c43cad87SWarner Losh <link 1678*c43cad87SWarner Losh linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link> 1679*c43cad87SWarner Losh mallctl. This is useful for avoiding the overhead of repeated 1680*c43cad87SWarner Losh <function>mallctl*()</function> calls. Note that the underlying counter 1681*c43cad87SWarner Losh should not be modified by the application.</para></listitem> 1682*c43cad87SWarner Losh </varlistentry> 1683*c43cad87SWarner Losh 1684*c43cad87SWarner Losh <varlistentry id="thread.peak.read"> 1685*c43cad87SWarner Losh <term> 1686*c43cad87SWarner Losh <mallctl>thread.peak.read</mallctl> 1687*c43cad87SWarner Losh (<type>uint64_t</type>) 1688*c43cad87SWarner Losh <literal>r-</literal> 1689*c43cad87SWarner Losh [<option>--enable-stats</option>] 1690*c43cad87SWarner Losh </term> 1691*c43cad87SWarner Losh <listitem><para>Get an approximation of the maximum value of the 1692*c43cad87SWarner Losh difference between the number of bytes allocated and the number of bytes 1693*c43cad87SWarner Losh deallocated by the calling thread since the last call to <link 1694*c43cad87SWarner Losh linkend="thread.peak.reset"><mallctl>thread.peak.reset</mallctl></link>, 1695*c43cad87SWarner Losh or since the thread's creation if it has not called <link 1696*c43cad87SWarner Losh linkend="thread.peak.reset"><mallctl>thread.peak.reset</mallctl></link>. 1697*c43cad87SWarner Losh No guarantees are made about the quality of the approximation, but 1698*c43cad87SWarner Losh jemalloc currently endeavors to maintain accuracy to within one hundred 1699*c43cad87SWarner Losh kilobytes. 1700*c43cad87SWarner Losh </para></listitem> 1701*c43cad87SWarner Losh </varlistentry> 1702*c43cad87SWarner Losh 1703*c43cad87SWarner Losh <varlistentry id="thread.peak.reset"> 1704*c43cad87SWarner Losh <term> 1705*c43cad87SWarner Losh <mallctl>thread.peak.reset</mallctl> 1706*c43cad87SWarner Losh (<type>void</type>) 1707*c43cad87SWarner Losh <literal>--</literal> 1708*c43cad87SWarner Losh [<option>--enable-stats</option>] 1709*c43cad87SWarner Losh </term> 1710*c43cad87SWarner Losh <listitem><para>Resets the counter for net bytes allocated in the calling 1711*c43cad87SWarner Losh thread to zero. This affects subsequent calls to <link 1712*c43cad87SWarner Losh linkend="thread.peak.read"><mallctl>thread.peak.read</mallctl></link>, 1713*c43cad87SWarner Losh but not the values returned by <link 1714*c43cad87SWarner Losh linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link> 1715*c43cad87SWarner Losh or <link 1716*c43cad87SWarner Losh linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link>. 1717*c43cad87SWarner Losh </para></listitem> 1718*c43cad87SWarner Losh </varlistentry> 1719*c43cad87SWarner Losh 1720*c43cad87SWarner Losh <varlistentry id="thread.tcache.enabled"> 1721*c43cad87SWarner Losh <term> 1722*c43cad87SWarner Losh <mallctl>thread.tcache.enabled</mallctl> 1723*c43cad87SWarner Losh (<type>bool</type>) 1724*c43cad87SWarner Losh <literal>rw</literal> 1725*c43cad87SWarner Losh </term> 1726*c43cad87SWarner Losh <listitem><para>Enable/disable calling thread's tcache. The tcache is 1727*c43cad87SWarner Losh implicitly flushed as a side effect of becoming 1728*c43cad87SWarner Losh disabled (see <link 1729*c43cad87SWarner Losh linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>). 1730*c43cad87SWarner Losh </para></listitem> 1731*c43cad87SWarner Losh </varlistentry> 1732*c43cad87SWarner Losh 1733*c43cad87SWarner Losh <varlistentry id="thread.tcache.flush"> 1734*c43cad87SWarner Losh <term> 1735*c43cad87SWarner Losh <mallctl>thread.tcache.flush</mallctl> 1736*c43cad87SWarner Losh (<type>void</type>) 1737*c43cad87SWarner Losh <literal>--</literal> 1738*c43cad87SWarner Losh </term> 1739*c43cad87SWarner Losh <listitem><para>Flush calling thread's thread-specific cache (tcache). 1740*c43cad87SWarner Losh This interface releases all cached objects and internal data structures 1741*c43cad87SWarner Losh associated with the calling thread's tcache. Ordinarily, this interface 1742*c43cad87SWarner Losh need not be called, since automatic periodic incremental garbage 1743*c43cad87SWarner Losh collection occurs, and the thread cache is automatically discarded when 1744*c43cad87SWarner Losh a thread exits. However, garbage collection is triggered by allocation 1745*c43cad87SWarner Losh activity, so it is possible for a thread that stops 1746*c43cad87SWarner Losh allocating/deallocating to retain its cache indefinitely, in which case 1747*c43cad87SWarner Losh the developer may find manual flushing useful.</para></listitem> 1748*c43cad87SWarner Losh </varlistentry> 1749*c43cad87SWarner Losh 1750*c43cad87SWarner Losh <varlistentry id="thread.prof.name"> 1751*c43cad87SWarner Losh <term> 1752*c43cad87SWarner Losh <mallctl>thread.prof.name</mallctl> 1753*c43cad87SWarner Losh (<type>const char *</type>) 1754*c43cad87SWarner Losh <literal>r-</literal> or 1755*c43cad87SWarner Losh <literal>-w</literal> 1756*c43cad87SWarner Losh [<option>--enable-prof</option>] 1757*c43cad87SWarner Losh </term> 1758*c43cad87SWarner Losh <listitem><para>Get/set the descriptive name associated with the calling 1759*c43cad87SWarner Losh thread in memory profile dumps. An internal copy of the name string is 1760*c43cad87SWarner Losh created, so the input string need not be maintained after this interface 1761*c43cad87SWarner Losh completes execution. The output string of this interface should be 1762*c43cad87SWarner Losh copied for non-ephemeral uses, because multiple implementation details 1763*c43cad87SWarner Losh can cause asynchronous string deallocation. Furthermore, each 1764*c43cad87SWarner Losh invocation of this interface can only read or write; simultaneous 1765*c43cad87SWarner Losh read/write is not supported due to string lifetime limitations. The 1766*c43cad87SWarner Losh name string must be nil-terminated and comprised only of characters in 1767*c43cad87SWarner Losh the sets recognized 1768*c43cad87SWarner Losh by <citerefentry><refentrytitle>isgraph</refentrytitle> 1769*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry> and 1770*c43cad87SWarner Losh <citerefentry><refentrytitle>isblank</refentrytitle> 1771*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry>.</para></listitem> 1772*c43cad87SWarner Losh </varlistentry> 1773*c43cad87SWarner Losh 1774*c43cad87SWarner Losh <varlistentry id="thread.prof.active"> 1775*c43cad87SWarner Losh <term> 1776*c43cad87SWarner Losh <mallctl>thread.prof.active</mallctl> 1777*c43cad87SWarner Losh (<type>bool</type>) 1778*c43cad87SWarner Losh <literal>rw</literal> 1779*c43cad87SWarner Losh [<option>--enable-prof</option>] 1780*c43cad87SWarner Losh </term> 1781*c43cad87SWarner Losh <listitem><para>Control whether sampling is currently active for the 1782*c43cad87SWarner Losh calling thread. This is an activation mechanism in addition to <link 1783*c43cad87SWarner Losh linkend="prof.active"><mallctl>prof.active</mallctl></link>; both must 1784*c43cad87SWarner Losh be active for the calling thread to sample. This flag is enabled by 1785*c43cad87SWarner Losh default.</para></listitem> 1786*c43cad87SWarner Losh </varlistentry> 1787*c43cad87SWarner Losh 1788*c43cad87SWarner Losh <varlistentry id="thread.idle"> 1789*c43cad87SWarner Losh <term> 1790*c43cad87SWarner Losh <mallctl>thread.idle</mallctl> 1791*c43cad87SWarner Losh (<type>void</type>) 1792*c43cad87SWarner Losh <literal>--</literal> 1793*c43cad87SWarner Losh </term> 1794*c43cad87SWarner Losh <listitem><para>Hints to jemalloc that the calling thread will be idle 1795*c43cad87SWarner Losh for some nontrivial period of time (say, on the order of seconds), and 1796*c43cad87SWarner Losh that doing some cleanup operations may be beneficial. There are no 1797*c43cad87SWarner Losh guarantees as to what specific operations will be performed; currently 1798*c43cad87SWarner Losh this flushes the caller's tcache and may (according to some heuristic) 1799*c43cad87SWarner Losh purge its associated arena.</para> 1800*c43cad87SWarner Losh <para>This is not intended to be a general-purpose background activity 1801*c43cad87SWarner Losh mechanism, and threads should not wake up multiple times solely to call 1802*c43cad87SWarner Losh it. Rather, a thread waiting for a task should do a timed wait first, 1803*c43cad87SWarner Losh call <link linkend="thread.idle"><mallctl>thread.idle</mallctl></link> 1804*c43cad87SWarner Losh if no task appears in the timeout interval, and then do an untimed wait. 1805*c43cad87SWarner Losh For such a background activity mechanism, see 1806*c43cad87SWarner Losh <link linkend="background_thread"><mallctl>background_thread</mallctl></link>. 1807*c43cad87SWarner Losh </para></listitem> 1808*c43cad87SWarner Losh </varlistentry> 1809*c43cad87SWarner Losh 1810*c43cad87SWarner Losh <varlistentry id="tcache.create"> 1811*c43cad87SWarner Losh <term> 1812*c43cad87SWarner Losh <mallctl>tcache.create</mallctl> 1813*c43cad87SWarner Losh (<type>unsigned</type>) 1814*c43cad87SWarner Losh <literal>r-</literal> 1815*c43cad87SWarner Losh </term> 1816*c43cad87SWarner Losh <listitem><para>Create an explicit thread-specific cache (tcache) and 1817*c43cad87SWarner Losh return an identifier that can be passed to the <link 1818*c43cad87SWarner Losh linkend="MALLOCX_TCACHE"><constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant></link> 1819*c43cad87SWarner Losh macro to explicitly use the specified cache rather than the 1820*c43cad87SWarner Losh automatically managed one that is used by default. Each explicit cache 1821*c43cad87SWarner Losh can be used by only one thread at a time; the application must assure 1822*c43cad87SWarner Losh that this constraint holds. 1823*c43cad87SWarner Losh </para> 1824*c43cad87SWarner Losh 1825*c43cad87SWarner Losh <para>If the amount of space supplied for storing the thread-specific 1826*c43cad87SWarner Losh cache identifier does not equal 1827*c43cad87SWarner Losh <code language="C">sizeof(<type>unsigned</type>)</code>, no 1828*c43cad87SWarner Losh thread-specific cache will be created, no data will be written to the 1829*c43cad87SWarner Losh space pointed by <parameter>oldp</parameter>, and 1830*c43cad87SWarner Losh <parameter>*oldlenp</parameter> will be set to 0. 1831*c43cad87SWarner Losh </para></listitem> 1832*c43cad87SWarner Losh 1833*c43cad87SWarner Losh </varlistentry> 1834*c43cad87SWarner Losh 1835*c43cad87SWarner Losh <varlistentry id="tcache.flush"> 1836*c43cad87SWarner Losh <term> 1837*c43cad87SWarner Losh <mallctl>tcache.flush</mallctl> 1838*c43cad87SWarner Losh (<type>unsigned</type>) 1839*c43cad87SWarner Losh <literal>-w</literal> 1840*c43cad87SWarner Losh </term> 1841*c43cad87SWarner Losh <listitem><para>Flush the specified thread-specific cache (tcache). The 1842*c43cad87SWarner Losh same considerations apply to this interface as to <link 1843*c43cad87SWarner Losh linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>, 1844*c43cad87SWarner Losh except that the tcache will never be automatically discarded. 1845*c43cad87SWarner Losh </para></listitem> 1846*c43cad87SWarner Losh </varlistentry> 1847*c43cad87SWarner Losh 1848*c43cad87SWarner Losh <varlistentry id="tcache.destroy"> 1849*c43cad87SWarner Losh <term> 1850*c43cad87SWarner Losh <mallctl>tcache.destroy</mallctl> 1851*c43cad87SWarner Losh (<type>unsigned</type>) 1852*c43cad87SWarner Losh <literal>-w</literal> 1853*c43cad87SWarner Losh </term> 1854*c43cad87SWarner Losh <listitem><para>Flush the specified thread-specific cache (tcache) and 1855*c43cad87SWarner Losh make the identifier available for use during a future tcache creation. 1856*c43cad87SWarner Losh </para></listitem> 1857*c43cad87SWarner Losh </varlistentry> 1858*c43cad87SWarner Losh 1859*c43cad87SWarner Losh <varlistentry id="arena.i.initialized"> 1860*c43cad87SWarner Losh <term> 1861*c43cad87SWarner Losh <mallctl>arena.<i>.initialized</mallctl> 1862*c43cad87SWarner Losh (<type>bool</type>) 1863*c43cad87SWarner Losh <literal>r-</literal> 1864*c43cad87SWarner Losh </term> 1865*c43cad87SWarner Losh <listitem><para>Get whether the specified arena's statistics are 1866*c43cad87SWarner Losh initialized (i.e. the arena was initialized prior to the current epoch). 1867*c43cad87SWarner Losh This interface can also be nominally used to query whether the merged 1868*c43cad87SWarner Losh statistics corresponding to <constant>MALLCTL_ARENAS_ALL</constant> are 1869*c43cad87SWarner Losh initialized (always true).</para></listitem> 1870*c43cad87SWarner Losh </varlistentry> 1871*c43cad87SWarner Losh 1872*c43cad87SWarner Losh <varlistentry id="arena.i.decay"> 1873*c43cad87SWarner Losh <term> 1874*c43cad87SWarner Losh <mallctl>arena.<i>.decay</mallctl> 1875*c43cad87SWarner Losh (<type>void</type>) 1876*c43cad87SWarner Losh <literal>--</literal> 1877*c43cad87SWarner Losh </term> 1878*c43cad87SWarner Losh <listitem><para>Trigger decay-based purging of unused dirty/muzzy pages 1879*c43cad87SWarner Losh for arena <i>, or for all arenas if <i> equals 1880*c43cad87SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant>. The proportion of unused 1881*c43cad87SWarner Losh dirty/muzzy pages to be purged depends on the current time; see <link 1882*c43cad87SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 1883*c43cad87SWarner Losh and <link 1884*c43cad87SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzy_decay_ms</mallctl></link> 1885*c43cad87SWarner Losh for details.</para></listitem> 1886*c43cad87SWarner Losh </varlistentry> 1887*c43cad87SWarner Losh 1888*c43cad87SWarner Losh <varlistentry id="arena.i.purge"> 1889*c43cad87SWarner Losh <term> 1890*c43cad87SWarner Losh <mallctl>arena.<i>.purge</mallctl> 1891*c43cad87SWarner Losh (<type>void</type>) 1892*c43cad87SWarner Losh <literal>--</literal> 1893*c43cad87SWarner Losh </term> 1894*c43cad87SWarner Losh <listitem><para>Purge all unused dirty pages for arena <i>, or for 1895*c43cad87SWarner Losh all arenas if <i> equals <constant>MALLCTL_ARENAS_ALL</constant>. 1896*c43cad87SWarner Losh </para></listitem> 1897*c43cad87SWarner Losh </varlistentry> 1898*c43cad87SWarner Losh 1899*c43cad87SWarner Losh <varlistentry id="arena.i.reset"> 1900*c43cad87SWarner Losh <term> 1901*c43cad87SWarner Losh <mallctl>arena.<i>.reset</mallctl> 1902*c43cad87SWarner Losh (<type>void</type>) 1903*c43cad87SWarner Losh <literal>--</literal> 1904*c43cad87SWarner Losh </term> 1905*c43cad87SWarner Losh <listitem><para>Discard all of the arena's extant allocations. This 1906*c43cad87SWarner Losh interface can only be used with arenas explicitly created via <link 1907*c43cad87SWarner Losh linkend="arenas.create"><mallctl>arenas.create</mallctl></link>. None 1908*c43cad87SWarner Losh of the arena's discarded/cached allocations may accessed afterward. As 1909*c43cad87SWarner Losh part of this requirement, all thread caches which were used to 1910*c43cad87SWarner Losh allocate/deallocate in conjunction with the arena must be flushed 1911*c43cad87SWarner Losh beforehand.</para></listitem> 1912*c43cad87SWarner Losh </varlistentry> 1913*c43cad87SWarner Losh 1914*c43cad87SWarner Losh <varlistentry id="arena.i.destroy"> 1915*c43cad87SWarner Losh <term> 1916*c43cad87SWarner Losh <mallctl>arena.<i>.destroy</mallctl> 1917*c43cad87SWarner Losh (<type>void</type>) 1918*c43cad87SWarner Losh <literal>--</literal> 1919*c43cad87SWarner Losh </term> 1920*c43cad87SWarner Losh <listitem><para>Destroy the arena. Discard all of the arena's extant 1921*c43cad87SWarner Losh allocations using the same mechanism as for <link 1922*c43cad87SWarner Losh linkend="arena.i.reset"><mallctl>arena.<i>.reset</mallctl></link> 1923*c43cad87SWarner Losh (with all the same constraints and side effects), merge the arena stats 1924*c43cad87SWarner Losh into those accessible at arena index 1925*c43cad87SWarner Losh <constant>MALLCTL_ARENAS_DESTROYED</constant>, and then completely 1926*c43cad87SWarner Losh discard all metadata associated with the arena. Future calls to <link 1927*c43cad87SWarner Losh linkend="arenas.create"><mallctl>arenas.create</mallctl></link> may 1928*c43cad87SWarner Losh recycle the arena index. Destruction will fail if any threads are 1929*c43cad87SWarner Losh currently associated with the arena as a result of calls to <link 1930*c43cad87SWarner Losh linkend="thread.arena"><mallctl>thread.arena</mallctl></link>.</para></listitem> 1931*c43cad87SWarner Losh </varlistentry> 1932*c43cad87SWarner Losh 1933*c43cad87SWarner Losh <varlistentry id="arena.i.dss"> 1934*c43cad87SWarner Losh <term> 1935*c43cad87SWarner Losh <mallctl>arena.<i>.dss</mallctl> 1936*c43cad87SWarner Losh (<type>const char *</type>) 1937*c43cad87SWarner Losh <literal>rw</literal> 1938*c43cad87SWarner Losh </term> 1939*c43cad87SWarner Losh <listitem><para>Set the precedence of dss allocation as related to mmap 1940*c43cad87SWarner Losh allocation for arena <i>, or for all arenas if <i> equals 1941*c43cad87SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant>. See <link 1942*c43cad87SWarner Losh linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for supported 1943*c43cad87SWarner Losh settings.</para></listitem> 1944*c43cad87SWarner Losh </varlistentry> 1945*c43cad87SWarner Losh 1946*c43cad87SWarner Losh <varlistentry id="arena.i.dirty_decay_ms"> 1947*c43cad87SWarner Losh <term> 1948*c43cad87SWarner Losh <mallctl>arena.<i>.dirty_decay_ms</mallctl> 1949*c43cad87SWarner Losh (<type>ssize_t</type>) 1950*c43cad87SWarner Losh <literal>rw</literal> 1951*c43cad87SWarner Losh </term> 1952*c43cad87SWarner Losh <listitem><para>Current per-arena approximate time in milliseconds from 1953*c43cad87SWarner Losh the creation of a set of unused dirty pages until an equivalent set of 1954*c43cad87SWarner Losh unused dirty pages is purged and/or reused. Each time this interface is 1955*c43cad87SWarner Losh set, all currently unused dirty pages are considered to have fully 1956*c43cad87SWarner Losh decayed, which causes immediate purging of all unused dirty pages unless 1957*c43cad87SWarner Losh the decay time is set to -1 (i.e. purging disabled). See <link 1958*c43cad87SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 1959*c43cad87SWarner Losh for additional information.</para></listitem> 1960*c43cad87SWarner Losh </varlistentry> 1961*c43cad87SWarner Losh 1962*c43cad87SWarner Losh <varlistentry id="arena.i.muzzy_decay_ms"> 1963*c43cad87SWarner Losh <term> 1964*c43cad87SWarner Losh <mallctl>arena.<i>.muzzy_decay_ms</mallctl> 1965*c43cad87SWarner Losh (<type>ssize_t</type>) 1966*c43cad87SWarner Losh <literal>rw</literal> 1967*c43cad87SWarner Losh </term> 1968*c43cad87SWarner Losh <listitem><para>Current per-arena approximate time in milliseconds from 1969*c43cad87SWarner Losh the creation of a set of unused muzzy pages until an equivalent set of 1970*c43cad87SWarner Losh unused muzzy pages is purged and/or reused. Each time this interface is 1971*c43cad87SWarner Losh set, all currently unused muzzy pages are considered to have fully 1972*c43cad87SWarner Losh decayed, which causes immediate purging of all unused muzzy pages unless 1973*c43cad87SWarner Losh the decay time is set to -1 (i.e. purging disabled). See <link 1974*c43cad87SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 1975*c43cad87SWarner Losh for additional information.</para></listitem> 1976*c43cad87SWarner Losh </varlistentry> 1977*c43cad87SWarner Losh 1978*c43cad87SWarner Losh <varlistentry id="arena.i.retain_grow_limit"> 1979*c43cad87SWarner Losh <term> 1980*c43cad87SWarner Losh <mallctl>arena.<i>.retain_grow_limit</mallctl> 1981*c43cad87SWarner Losh (<type>size_t</type>) 1982*c43cad87SWarner Losh <literal>rw</literal> 1983*c43cad87SWarner Losh </term> 1984*c43cad87SWarner Losh <listitem><para>Maximum size to grow retained region (only relevant when 1985*c43cad87SWarner Losh <link linkend="opt.retain"><mallctl>opt.retain</mallctl></link> is 1986*c43cad87SWarner Losh enabled). This controls the maximum increment to expand virtual memory, 1987*c43cad87SWarner Losh or allocation through <link 1988*c43cad87SWarner Losh linkend="arena.i.extent_hooks"><mallctl>arena.<i>extent_hooks</mallctl></link>. 1989*c43cad87SWarner Losh In particular, if customized extent hooks reserve physical memory 1990*c43cad87SWarner Losh (e.g. 1G huge pages), this is useful to control the allocation hook's 1991*c43cad87SWarner Losh input size. The default is no limit.</para></listitem> 1992*c43cad87SWarner Losh </varlistentry> 1993*c43cad87SWarner Losh 1994*c43cad87SWarner Losh <varlistentry id="arena.i.extent_hooks"> 1995*c43cad87SWarner Losh <term> 1996*c43cad87SWarner Losh <mallctl>arena.<i>.extent_hooks</mallctl> 1997*c43cad87SWarner Losh (<type>extent_hooks_t *</type>) 1998*c43cad87SWarner Losh <literal>rw</literal> 1999*c43cad87SWarner Losh </term> 2000*c43cad87SWarner Losh <listitem><para>Get or set the extent management hook functions for 2001*c43cad87SWarner Losh arena <i>. The functions must be capable of operating on all 2002*c43cad87SWarner Losh extant extents associated with arena <i>, usually by passing 2003*c43cad87SWarner Losh unknown extents to the replaced functions. In practice, it is feasible 2004*c43cad87SWarner Losh to control allocation for arenas explicitly created via <link 2005*c43cad87SWarner Losh linkend="arenas.create"><mallctl>arenas.create</mallctl></link> such 2006*c43cad87SWarner Losh that all extents originate from an application-supplied extent allocator 2007*c43cad87SWarner Losh (by specifying the custom extent hook functions during arena creation). 2008*c43cad87SWarner Losh However, the API guarantees for the automatically created arenas may be 2009*c43cad87SWarner Losh relaxed -- hooks set there may be called in a "best effort" fashion; in 2010*c43cad87SWarner Losh addition there may be extents created prior to the application having an 2011*c43cad87SWarner Losh opportunity to take over extent allocation.</para> 2012*c43cad87SWarner Losh 2013*c43cad87SWarner Losh <programlisting language="C"><![CDATA[ 2014*c43cad87SWarner Loshtypedef extent_hooks_s extent_hooks_t; 2015*c43cad87SWarner Loshstruct extent_hooks_s { 2016*c43cad87SWarner Losh extent_alloc_t *alloc; 2017*c43cad87SWarner Losh extent_dalloc_t *dalloc; 2018*c43cad87SWarner Losh extent_destroy_t *destroy; 2019*c43cad87SWarner Losh extent_commit_t *commit; 2020*c43cad87SWarner Losh extent_decommit_t *decommit; 2021*c43cad87SWarner Losh extent_purge_t *purge_lazy; 2022*c43cad87SWarner Losh extent_purge_t *purge_forced; 2023*c43cad87SWarner Losh extent_split_t *split; 2024*c43cad87SWarner Losh extent_merge_t *merge; 2025*c43cad87SWarner Losh};]]></programlisting> 2026*c43cad87SWarner Losh <para>The <type>extent_hooks_t</type> structure comprises function 2027*c43cad87SWarner Losh pointers which are described individually below. jemalloc uses these 2028*c43cad87SWarner Losh functions to manage extent lifetime, which starts off with allocation of 2029*c43cad87SWarner Losh mapped committed memory, in the simplest case followed by deallocation. 2030*c43cad87SWarner Losh However, there are performance and platform reasons to retain extents 2031*c43cad87SWarner Losh for later reuse. Cleanup attempts cascade from deallocation to decommit 2032*c43cad87SWarner Losh to forced purging to lazy purging, which gives the extent management 2033*c43cad87SWarner Losh functions opportunities to reject the most permanent cleanup operations 2034*c43cad87SWarner Losh in favor of less permanent (and often less costly) operations. All 2035*c43cad87SWarner Losh operations except allocation can be universally opted out of by setting 2036*c43cad87SWarner Losh the hook pointers to <constant>NULL</constant>, or selectively opted out 2037*c43cad87SWarner Losh of by returning failure. Note that once the extent hook is set, the 2038*c43cad87SWarner Losh structure is accessed directly by the associated arenas, so it must 2039*c43cad87SWarner Losh remain valid for the entire lifetime of the arenas.</para> 2040*c43cad87SWarner Losh 2041*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2042*c43cad87SWarner Losh <funcdef>typedef void *<function>(extent_alloc_t)</function></funcdef> 2043*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2044*c43cad87SWarner Losh <paramdef>void *<parameter>new_addr</parameter></paramdef> 2045*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2046*c43cad87SWarner Losh <paramdef>size_t <parameter>alignment</parameter></paramdef> 2047*c43cad87SWarner Losh <paramdef>bool *<parameter>zero</parameter></paramdef> 2048*c43cad87SWarner Losh <paramdef>bool *<parameter>commit</parameter></paramdef> 2049*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2050*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2051*c43cad87SWarner Losh <literallayout></literallayout> 2052*c43cad87SWarner Losh <para>An extent allocation function conforms to the 2053*c43cad87SWarner Losh <type>extent_alloc_t</type> type and upon success returns a pointer to 2054*c43cad87SWarner Losh <parameter>size</parameter> bytes of mapped memory on behalf of arena 2055*c43cad87SWarner Losh <parameter>arena_ind</parameter> such that the extent's base address is 2056*c43cad87SWarner Losh a multiple of <parameter>alignment</parameter>, as well as setting 2057*c43cad87SWarner Losh <parameter>*zero</parameter> to indicate whether the extent is zeroed 2058*c43cad87SWarner Losh and <parameter>*commit</parameter> to indicate whether the extent is 2059*c43cad87SWarner Losh committed. Upon error the function returns <constant>NULL</constant> 2060*c43cad87SWarner Losh and leaves <parameter>*zero</parameter> and 2061*c43cad87SWarner Losh <parameter>*commit</parameter> unmodified. The 2062*c43cad87SWarner Losh <parameter>size</parameter> parameter is always a multiple of the page 2063*c43cad87SWarner Losh size. The <parameter>alignment</parameter> parameter is always a power 2064*c43cad87SWarner Losh of two at least as large as the page size. Zeroing is mandatory if 2065*c43cad87SWarner Losh <parameter>*zero</parameter> is true upon function entry. Committing is 2066*c43cad87SWarner Losh mandatory if <parameter>*commit</parameter> is true upon function entry. 2067*c43cad87SWarner Losh If <parameter>new_addr</parameter> is not <constant>NULL</constant>, the 2068*c43cad87SWarner Losh returned pointer must be <parameter>new_addr</parameter> on success or 2069*c43cad87SWarner Losh <constant>NULL</constant> on error. Committed memory may be committed 2070*c43cad87SWarner Losh in absolute terms as on a system that does not overcommit, or in 2071*c43cad87SWarner Losh implicit terms as on a system that overcommits and satisfies physical 2072*c43cad87SWarner Losh memory needs on demand via soft page faults. Note that replacing the 2073*c43cad87SWarner Losh default extent allocation function makes the arena's <link 2074*c43cad87SWarner Losh linkend="arena.i.dss"><mallctl>arena.<i>.dss</mallctl></link> 2075*c43cad87SWarner Losh setting irrelevant.</para> 2076*c43cad87SWarner Losh 2077*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2078*c43cad87SWarner Losh <funcdef>typedef bool <function>(extent_dalloc_t)</function></funcdef> 2079*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2080*c43cad87SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 2081*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2082*c43cad87SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 2083*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2084*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2085*c43cad87SWarner Losh <literallayout></literallayout> 2086*c43cad87SWarner Losh <para> 2087*c43cad87SWarner Losh An extent deallocation function conforms to the 2088*c43cad87SWarner Losh <type>extent_dalloc_t</type> type and deallocates an extent at given 2089*c43cad87SWarner Losh <parameter>addr</parameter> and <parameter>size</parameter> with 2090*c43cad87SWarner Losh <parameter>committed</parameter>/decommited memory as indicated, on 2091*c43cad87SWarner Losh behalf of arena <parameter>arena_ind</parameter>, returning false upon 2092*c43cad87SWarner Losh success. If the function returns true, this indicates opt-out from 2093*c43cad87SWarner Losh deallocation; the virtual memory mapping associated with the extent 2094*c43cad87SWarner Losh remains mapped, in the same commit state, and available for future use, 2095*c43cad87SWarner Losh in which case it will be automatically retained for later reuse.</para> 2096*c43cad87SWarner Losh 2097*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2098*c43cad87SWarner Losh <funcdef>typedef void <function>(extent_destroy_t)</function></funcdef> 2099*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2100*c43cad87SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 2101*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2102*c43cad87SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 2103*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2104*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2105*c43cad87SWarner Losh <literallayout></literallayout> 2106*c43cad87SWarner Losh <para> 2107*c43cad87SWarner Losh An extent destruction function conforms to the 2108*c43cad87SWarner Losh <type>extent_destroy_t</type> type and unconditionally destroys an 2109*c43cad87SWarner Losh extent at given <parameter>addr</parameter> and 2110*c43cad87SWarner Losh <parameter>size</parameter> with 2111*c43cad87SWarner Losh <parameter>committed</parameter>/decommited memory as indicated, on 2112*c43cad87SWarner Losh behalf of arena <parameter>arena_ind</parameter>. This function may be 2113*c43cad87SWarner Losh called to destroy retained extents during arena destruction (see <link 2114*c43cad87SWarner Losh linkend="arena.i.destroy"><mallctl>arena.<i>.destroy</mallctl></link>).</para> 2115*c43cad87SWarner Losh 2116*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2117*c43cad87SWarner Losh <funcdef>typedef bool <function>(extent_commit_t)</function></funcdef> 2118*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2119*c43cad87SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 2120*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2121*c43cad87SWarner Losh <paramdef>size_t <parameter>offset</parameter></paramdef> 2122*c43cad87SWarner Losh <paramdef>size_t <parameter>length</parameter></paramdef> 2123*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2124*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2125*c43cad87SWarner Losh <literallayout></literallayout> 2126*c43cad87SWarner Losh <para>An extent commit function conforms to the 2127*c43cad87SWarner Losh <type>extent_commit_t</type> type and commits zeroed physical memory to 2128*c43cad87SWarner Losh back pages within an extent at given <parameter>addr</parameter> and 2129*c43cad87SWarner Losh <parameter>size</parameter> at <parameter>offset</parameter> bytes, 2130*c43cad87SWarner Losh extending for <parameter>length</parameter> on behalf of arena 2131*c43cad87SWarner Losh <parameter>arena_ind</parameter>, returning false upon success. 2132*c43cad87SWarner Losh Committed memory may be committed in absolute terms as on a system that 2133*c43cad87SWarner Losh does not overcommit, or in implicit terms as on a system that 2134*c43cad87SWarner Losh overcommits and satisfies physical memory needs on demand via soft page 2135*c43cad87SWarner Losh faults. If the function returns true, this indicates insufficient 2136*c43cad87SWarner Losh physical memory to satisfy the request.</para> 2137*c43cad87SWarner Losh 2138*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2139*c43cad87SWarner Losh <funcdef>typedef bool <function>(extent_decommit_t)</function></funcdef> 2140*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2141*c43cad87SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 2142*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2143*c43cad87SWarner Losh <paramdef>size_t <parameter>offset</parameter></paramdef> 2144*c43cad87SWarner Losh <paramdef>size_t <parameter>length</parameter></paramdef> 2145*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2146*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2147*c43cad87SWarner Losh <literallayout></literallayout> 2148*c43cad87SWarner Losh <para>An extent decommit function conforms to the 2149*c43cad87SWarner Losh <type>extent_decommit_t</type> type and decommits any physical memory 2150*c43cad87SWarner Losh that is backing pages within an extent at given 2151*c43cad87SWarner Losh <parameter>addr</parameter> and <parameter>size</parameter> at 2152*c43cad87SWarner Losh <parameter>offset</parameter> bytes, extending for 2153*c43cad87SWarner Losh <parameter>length</parameter> on behalf of arena 2154*c43cad87SWarner Losh <parameter>arena_ind</parameter>, returning false upon success, in which 2155*c43cad87SWarner Losh case the pages will be committed via the extent commit function before 2156*c43cad87SWarner Losh being reused. If the function returns true, this indicates opt-out from 2157*c43cad87SWarner Losh decommit; the memory remains committed and available for future use, in 2158*c43cad87SWarner Losh which case it will be automatically retained for later reuse.</para> 2159*c43cad87SWarner Losh 2160*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2161*c43cad87SWarner Losh <funcdef>typedef bool <function>(extent_purge_t)</function></funcdef> 2162*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2163*c43cad87SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 2164*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2165*c43cad87SWarner Losh <paramdef>size_t <parameter>offset</parameter></paramdef> 2166*c43cad87SWarner Losh <paramdef>size_t <parameter>length</parameter></paramdef> 2167*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2168*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2169*c43cad87SWarner Losh <literallayout></literallayout> 2170*c43cad87SWarner Losh <para>An extent purge function conforms to the 2171*c43cad87SWarner Losh <type>extent_purge_t</type> type and discards physical pages 2172*c43cad87SWarner Losh within the virtual memory mapping associated with an extent at given 2173*c43cad87SWarner Losh <parameter>addr</parameter> and <parameter>size</parameter> at 2174*c43cad87SWarner Losh <parameter>offset</parameter> bytes, extending for 2175*c43cad87SWarner Losh <parameter>length</parameter> on behalf of arena 2176*c43cad87SWarner Losh <parameter>arena_ind</parameter>. A lazy extent purge function (e.g. 2177*c43cad87SWarner Losh implemented via 2178*c43cad87SWarner Losh <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>) 2179*c43cad87SWarner Losh can delay purging indefinitely and leave the pages within the purged 2180*c43cad87SWarner Losh virtual memory range in an indeterminite state, whereas a forced extent 2181*c43cad87SWarner Losh purge function immediately purges, and the pages within the virtual 2182*c43cad87SWarner Losh memory range will be zero-filled the next time they are accessed. If 2183*c43cad87SWarner Losh the function returns true, this indicates failure to purge.</para> 2184*c43cad87SWarner Losh 2185*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2186*c43cad87SWarner Losh <funcdef>typedef bool <function>(extent_split_t)</function></funcdef> 2187*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2188*c43cad87SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 2189*c43cad87SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 2190*c43cad87SWarner Losh <paramdef>size_t <parameter>size_a</parameter></paramdef> 2191*c43cad87SWarner Losh <paramdef>size_t <parameter>size_b</parameter></paramdef> 2192*c43cad87SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 2193*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2194*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2195*c43cad87SWarner Losh <literallayout></literallayout> 2196*c43cad87SWarner Losh <para>An extent split function conforms to the 2197*c43cad87SWarner Losh <type>extent_split_t</type> type and optionally splits an extent at 2198*c43cad87SWarner Losh given <parameter>addr</parameter> and <parameter>size</parameter> into 2199*c43cad87SWarner Losh two adjacent extents, the first of <parameter>size_a</parameter> bytes, 2200*c43cad87SWarner Losh and the second of <parameter>size_b</parameter> bytes, operating on 2201*c43cad87SWarner Losh <parameter>committed</parameter>/decommitted memory as indicated, on 2202*c43cad87SWarner Losh behalf of arena <parameter>arena_ind</parameter>, returning false upon 2203*c43cad87SWarner Losh success. If the function returns true, this indicates that the extent 2204*c43cad87SWarner Losh remains unsplit and therefore should continue to be operated on as a 2205*c43cad87SWarner Losh whole.</para> 2206*c43cad87SWarner Losh 2207*c43cad87SWarner Losh <funcsynopsis><funcprototype> 2208*c43cad87SWarner Losh <funcdef>typedef bool <function>(extent_merge_t)</function></funcdef> 2209*c43cad87SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 2210*c43cad87SWarner Losh <paramdef>void *<parameter>addr_a</parameter></paramdef> 2211*c43cad87SWarner Losh <paramdef>size_t <parameter>size_a</parameter></paramdef> 2212*c43cad87SWarner Losh <paramdef>void *<parameter>addr_b</parameter></paramdef> 2213*c43cad87SWarner Losh <paramdef>size_t <parameter>size_b</parameter></paramdef> 2214*c43cad87SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 2215*c43cad87SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 2216*c43cad87SWarner Losh </funcprototype></funcsynopsis> 2217*c43cad87SWarner Losh <literallayout></literallayout> 2218*c43cad87SWarner Losh <para>An extent merge function conforms to the 2219*c43cad87SWarner Losh <type>extent_merge_t</type> type and optionally merges adjacent extents, 2220*c43cad87SWarner Losh at given <parameter>addr_a</parameter> and <parameter>size_a</parameter> 2221*c43cad87SWarner Losh with given <parameter>addr_b</parameter> and 2222*c43cad87SWarner Losh <parameter>size_b</parameter> into one contiguous extent, operating on 2223*c43cad87SWarner Losh <parameter>committed</parameter>/decommitted memory as indicated, on 2224*c43cad87SWarner Losh behalf of arena <parameter>arena_ind</parameter>, returning false upon 2225*c43cad87SWarner Losh success. If the function returns true, this indicates that the extents 2226*c43cad87SWarner Losh remain distinct mappings and therefore should continue to be operated on 2227*c43cad87SWarner Losh independently.</para> 2228*c43cad87SWarner Losh </listitem> 2229*c43cad87SWarner Losh </varlistentry> 2230*c43cad87SWarner Losh 2231*c43cad87SWarner Losh <varlistentry id="arenas.narenas"> 2232*c43cad87SWarner Losh <term> 2233*c43cad87SWarner Losh <mallctl>arenas.narenas</mallctl> 2234*c43cad87SWarner Losh (<type>unsigned</type>) 2235*c43cad87SWarner Losh <literal>r-</literal> 2236*c43cad87SWarner Losh </term> 2237*c43cad87SWarner Losh <listitem><para>Current limit on number of arenas.</para></listitem> 2238*c43cad87SWarner Losh </varlistentry> 2239*c43cad87SWarner Losh 2240*c43cad87SWarner Losh <varlistentry id="arenas.dirty_decay_ms"> 2241*c43cad87SWarner Losh <term> 2242*c43cad87SWarner Losh <mallctl>arenas.dirty_decay_ms</mallctl> 2243*c43cad87SWarner Losh (<type>ssize_t</type>) 2244*c43cad87SWarner Losh <literal>rw</literal> 2245*c43cad87SWarner Losh </term> 2246*c43cad87SWarner Losh <listitem><para>Current default per-arena approximate time in 2247*c43cad87SWarner Losh milliseconds from the creation of a set of unused dirty pages until an 2248*c43cad87SWarner Losh equivalent set of unused dirty pages is purged and/or reused, used to 2249*c43cad87SWarner Losh initialize <link 2250*c43cad87SWarner Losh linkend="arena.i.dirty_decay_ms"><mallctl>arena.<i>.dirty_decay_ms</mallctl></link> 2251*c43cad87SWarner Losh during arena creation. See <link 2252*c43cad87SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 2253*c43cad87SWarner Losh for additional information.</para></listitem> 2254*c43cad87SWarner Losh </varlistentry> 2255*c43cad87SWarner Losh 2256*c43cad87SWarner Losh <varlistentry id="arenas.muzzy_decay_ms"> 2257*c43cad87SWarner Losh <term> 2258*c43cad87SWarner Losh <mallctl>arenas.muzzy_decay_ms</mallctl> 2259*c43cad87SWarner Losh (<type>ssize_t</type>) 2260*c43cad87SWarner Losh <literal>rw</literal> 2261*c43cad87SWarner Losh </term> 2262*c43cad87SWarner Losh <listitem><para>Current default per-arena approximate time in 2263*c43cad87SWarner Losh milliseconds from the creation of a set of unused muzzy pages until an 2264*c43cad87SWarner Losh equivalent set of unused muzzy pages is purged and/or reused, used to 2265*c43cad87SWarner Losh initialize <link 2266*c43cad87SWarner Losh linkend="arena.i.muzzy_decay_ms"><mallctl>arena.<i>.muzzy_decay_ms</mallctl></link> 2267*c43cad87SWarner Losh during arena creation. See <link 2268*c43cad87SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 2269*c43cad87SWarner Losh for additional information.</para></listitem> 2270*c43cad87SWarner Losh </varlistentry> 2271*c43cad87SWarner Losh 2272*c43cad87SWarner Losh <varlistentry id="arenas.quantum"> 2273*c43cad87SWarner Losh <term> 2274*c43cad87SWarner Losh <mallctl>arenas.quantum</mallctl> 2275*c43cad87SWarner Losh (<type>size_t</type>) 2276*c43cad87SWarner Losh <literal>r-</literal> 2277*c43cad87SWarner Losh </term> 2278*c43cad87SWarner Losh <listitem><para>Quantum size.</para></listitem> 2279*c43cad87SWarner Losh </varlistentry> 2280*c43cad87SWarner Losh 2281*c43cad87SWarner Losh <varlistentry id="arenas.page"> 2282*c43cad87SWarner Losh <term> 2283*c43cad87SWarner Losh <mallctl>arenas.page</mallctl> 2284*c43cad87SWarner Losh (<type>size_t</type>) 2285*c43cad87SWarner Losh <literal>r-</literal> 2286*c43cad87SWarner Losh </term> 2287*c43cad87SWarner Losh <listitem><para>Page size.</para></listitem> 2288*c43cad87SWarner Losh </varlistentry> 2289*c43cad87SWarner Losh 2290*c43cad87SWarner Losh <varlistentry id="arenas.tcache_max"> 2291*c43cad87SWarner Losh <term> 2292*c43cad87SWarner Losh <mallctl>arenas.tcache_max</mallctl> 2293*c43cad87SWarner Losh (<type>size_t</type>) 2294*c43cad87SWarner Losh <literal>r-</literal> 2295*c43cad87SWarner Losh </term> 2296*c43cad87SWarner Losh <listitem><para>Maximum thread-cached size class.</para></listitem> 2297*c43cad87SWarner Losh </varlistentry> 2298*c43cad87SWarner Losh 2299*c43cad87SWarner Losh <varlistentry id="arenas.nbins"> 2300*c43cad87SWarner Losh <term> 2301*c43cad87SWarner Losh <mallctl>arenas.nbins</mallctl> 2302*c43cad87SWarner Losh (<type>unsigned</type>) 2303*c43cad87SWarner Losh <literal>r-</literal> 2304*c43cad87SWarner Losh </term> 2305*c43cad87SWarner Losh <listitem><para>Number of bin size classes.</para></listitem> 2306*c43cad87SWarner Losh </varlistentry> 2307*c43cad87SWarner Losh 2308*c43cad87SWarner Losh <varlistentry id="arenas.nhbins"> 2309*c43cad87SWarner Losh <term> 2310*c43cad87SWarner Losh <mallctl>arenas.nhbins</mallctl> 2311*c43cad87SWarner Losh (<type>unsigned</type>) 2312*c43cad87SWarner Losh <literal>r-</literal> 2313*c43cad87SWarner Losh </term> 2314*c43cad87SWarner Losh <listitem><para>Total number of thread cache bin size 2315*c43cad87SWarner Losh classes.</para></listitem> 2316*c43cad87SWarner Losh </varlistentry> 2317*c43cad87SWarner Losh 2318*c43cad87SWarner Losh <varlistentry id="arenas.bin.i.size"> 2319*c43cad87SWarner Losh <term> 2320*c43cad87SWarner Losh <mallctl>arenas.bin.<i>.size</mallctl> 2321*c43cad87SWarner Losh (<type>size_t</type>) 2322*c43cad87SWarner Losh <literal>r-</literal> 2323*c43cad87SWarner Losh </term> 2324*c43cad87SWarner Losh <listitem><para>Maximum size supported by size class.</para></listitem> 2325*c43cad87SWarner Losh </varlistentry> 2326*c43cad87SWarner Losh 2327*c43cad87SWarner Losh <varlistentry id="arenas.bin.i.nregs"> 2328*c43cad87SWarner Losh <term> 2329*c43cad87SWarner Losh <mallctl>arenas.bin.<i>.nregs</mallctl> 2330*c43cad87SWarner Losh (<type>uint32_t</type>) 2331*c43cad87SWarner Losh <literal>r-</literal> 2332*c43cad87SWarner Losh </term> 2333*c43cad87SWarner Losh <listitem><para>Number of regions per slab.</para></listitem> 2334*c43cad87SWarner Losh </varlistentry> 2335*c43cad87SWarner Losh 2336*c43cad87SWarner Losh <varlistentry id="arenas.bin.i.slab_size"> 2337*c43cad87SWarner Losh <term> 2338*c43cad87SWarner Losh <mallctl>arenas.bin.<i>.slab_size</mallctl> 2339*c43cad87SWarner Losh (<type>size_t</type>) 2340*c43cad87SWarner Losh <literal>r-</literal> 2341*c43cad87SWarner Losh </term> 2342*c43cad87SWarner Losh <listitem><para>Number of bytes per slab.</para></listitem> 2343*c43cad87SWarner Losh </varlistentry> 2344*c43cad87SWarner Losh 2345*c43cad87SWarner Losh <varlistentry id="arenas.nlextents"> 2346*c43cad87SWarner Losh <term> 2347*c43cad87SWarner Losh <mallctl>arenas.nlextents</mallctl> 2348*c43cad87SWarner Losh (<type>unsigned</type>) 2349*c43cad87SWarner Losh <literal>r-</literal> 2350*c43cad87SWarner Losh </term> 2351*c43cad87SWarner Losh <listitem><para>Total number of large size classes.</para></listitem> 2352*c43cad87SWarner Losh </varlistentry> 2353*c43cad87SWarner Losh 2354*c43cad87SWarner Losh <varlistentry id="arenas.lextent.i.size"> 2355*c43cad87SWarner Losh <term> 2356*c43cad87SWarner Losh <mallctl>arenas.lextent.<i>.size</mallctl> 2357*c43cad87SWarner Losh (<type>size_t</type>) 2358*c43cad87SWarner Losh <literal>r-</literal> 2359*c43cad87SWarner Losh </term> 2360*c43cad87SWarner Losh <listitem><para>Maximum size supported by this large size 2361*c43cad87SWarner Losh class.</para></listitem> 2362*c43cad87SWarner Losh </varlistentry> 2363*c43cad87SWarner Losh 2364*c43cad87SWarner Losh <varlistentry id="arenas.create"> 2365*c43cad87SWarner Losh <term> 2366*c43cad87SWarner Losh <mallctl>arenas.create</mallctl> 2367*c43cad87SWarner Losh (<type>unsigned</type>, <type>extent_hooks_t *</type>) 2368*c43cad87SWarner Losh <literal>rw</literal> 2369*c43cad87SWarner Losh </term> 2370*c43cad87SWarner Losh <listitem><para>Explicitly create a new arena outside the range of 2371*c43cad87SWarner Losh automatically managed arenas, with optionally specified extent hooks, 2372*c43cad87SWarner Losh and return the new arena index.</para> 2373*c43cad87SWarner Losh 2374*c43cad87SWarner Losh <para>If the amount of space supplied for storing the arena index does 2375*c43cad87SWarner Losh not equal <code language="C">sizeof(<type>unsigned</type>)</code>, no 2376*c43cad87SWarner Losh arena will be created, no data will be written to the space pointed by 2377*c43cad87SWarner Losh <parameter>oldp</parameter>, and <parameter>*oldlenp</parameter> will 2378*c43cad87SWarner Losh be set to 0. 2379*c43cad87SWarner Losh </para></listitem> 2380*c43cad87SWarner Losh </varlistentry> 2381*c43cad87SWarner Losh 2382*c43cad87SWarner Losh <varlistentry id="arenas.lookup"> 2383*c43cad87SWarner Losh <term> 2384*c43cad87SWarner Losh <mallctl>arenas.lookup</mallctl> 2385*c43cad87SWarner Losh (<type>unsigned</type>, <type>void*</type>) 2386*c43cad87SWarner Losh <literal>rw</literal> 2387*c43cad87SWarner Losh </term> 2388*c43cad87SWarner Losh <listitem><para>Index of the arena to which an allocation belongs to.</para></listitem> 2389*c43cad87SWarner Losh </varlistentry> 2390*c43cad87SWarner Losh 2391*c43cad87SWarner Losh <varlistentry id="prof.thread_active_init"> 2392*c43cad87SWarner Losh <term> 2393*c43cad87SWarner Losh <mallctl>prof.thread_active_init</mallctl> 2394*c43cad87SWarner Losh (<type>bool</type>) 2395*c43cad87SWarner Losh <literal>rw</literal> 2396*c43cad87SWarner Losh [<option>--enable-prof</option>] 2397*c43cad87SWarner Losh </term> 2398*c43cad87SWarner Losh <listitem><para>Control the initial setting for <link 2399*c43cad87SWarner Losh linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link> 2400*c43cad87SWarner Losh in newly created threads. See the <link 2401*c43cad87SWarner Losh linkend="opt.prof_thread_active_init"><mallctl>opt.prof_thread_active_init</mallctl></link> 2402*c43cad87SWarner Losh option for additional information.</para></listitem> 2403*c43cad87SWarner Losh </varlistentry> 2404*c43cad87SWarner Losh 2405*c43cad87SWarner Losh <varlistentry id="prof.active"> 2406*c43cad87SWarner Losh <term> 2407*c43cad87SWarner Losh <mallctl>prof.active</mallctl> 2408*c43cad87SWarner Losh (<type>bool</type>) 2409*c43cad87SWarner Losh <literal>rw</literal> 2410*c43cad87SWarner Losh [<option>--enable-prof</option>] 2411*c43cad87SWarner Losh </term> 2412*c43cad87SWarner Losh <listitem><para>Control whether sampling is currently active. See the 2413*c43cad87SWarner Losh <link 2414*c43cad87SWarner Losh linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link> 2415*c43cad87SWarner Losh option for additional information, as well as the interrelated <link 2416*c43cad87SWarner Losh linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link> 2417*c43cad87SWarner Losh mallctl.</para></listitem> 2418*c43cad87SWarner Losh </varlistentry> 2419*c43cad87SWarner Losh 2420*c43cad87SWarner Losh <varlistentry id="prof.dump"> 2421*c43cad87SWarner Losh <term> 2422*c43cad87SWarner Losh <mallctl>prof.dump</mallctl> 2423*c43cad87SWarner Losh (<type>const char *</type>) 2424*c43cad87SWarner Losh <literal>-w</literal> 2425*c43cad87SWarner Losh [<option>--enable-prof</option>] 2426*c43cad87SWarner Losh </term> 2427*c43cad87SWarner Losh <listitem><para>Dump a memory profile to the specified file, or if NULL 2428*c43cad87SWarner Losh is specified, to a file according to the pattern 2429*c43cad87SWarner Losh <filename><prefix>.<pid>.<seq>.m<mseq>.heap</filename>, 2430*c43cad87SWarner Losh where <literal><prefix></literal> is controlled by the 2431*c43cad87SWarner Losh <link linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> 2432*c43cad87SWarner Losh and <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link> 2433*c43cad87SWarner Losh options.</para></listitem> 2434*c43cad87SWarner Losh </varlistentry> 2435*c43cad87SWarner Losh 2436*c43cad87SWarner Losh <varlistentry id="prof.prefix"> 2437*c43cad87SWarner Losh <term> 2438*c43cad87SWarner Losh <mallctl>prof.prefix</mallctl> 2439*c43cad87SWarner Losh (<type>const char *</type>) 2440*c43cad87SWarner Losh <literal>-w</literal> 2441*c43cad87SWarner Losh [<option>--enable-prof</option>] 2442*c43cad87SWarner Losh </term> 2443*c43cad87SWarner Losh <listitem><para>Set the filename prefix for profile dumps. See 2444*c43cad87SWarner Losh <link 2445*c43cad87SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> 2446*c43cad87SWarner Losh for the default setting. This can be useful to differentiate profile 2447*c43cad87SWarner Losh dumps such as from forked processes. 2448*c43cad87SWarner Losh </para></listitem> 2449*c43cad87SWarner Losh </varlistentry> 2450*c43cad87SWarner Losh 2451*c43cad87SWarner Losh <varlistentry id="prof.gdump"> 2452*c43cad87SWarner Losh <term> 2453*c43cad87SWarner Losh <mallctl>prof.gdump</mallctl> 2454*c43cad87SWarner Losh (<type>bool</type>) 2455*c43cad87SWarner Losh <literal>rw</literal> 2456*c43cad87SWarner Losh [<option>--enable-prof</option>] 2457*c43cad87SWarner Losh </term> 2458*c43cad87SWarner Losh <listitem><para>When enabled, trigger a memory profile dump every time 2459*c43cad87SWarner Losh the total virtual memory exceeds the previous maximum. Profiles are 2460*c43cad87SWarner Losh dumped to files named according to the pattern 2461*c43cad87SWarner Losh <filename><prefix>.<pid>.<seq>.u<useq>.heap</filename>, 2462*c43cad87SWarner Losh where <literal><prefix></literal> is controlled by the <link 2463*c43cad87SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> and 2464*c43cad87SWarner Losh <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link> 2465*c43cad87SWarner Losh options.</para></listitem> 2466*c43cad87SWarner Losh </varlistentry> 2467*c43cad87SWarner Losh 2468*c43cad87SWarner Losh <varlistentry id="prof.reset"> 2469*c43cad87SWarner Losh <term> 2470*c43cad87SWarner Losh <mallctl>prof.reset</mallctl> 2471*c43cad87SWarner Losh (<type>size_t</type>) 2472*c43cad87SWarner Losh <literal>-w</literal> 2473*c43cad87SWarner Losh [<option>--enable-prof</option>] 2474*c43cad87SWarner Losh </term> 2475*c43cad87SWarner Losh <listitem><para>Reset all memory profile statistics, and optionally 2476*c43cad87SWarner Losh update the sample rate (see <link 2477*c43cad87SWarner Losh linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link> 2478*c43cad87SWarner Losh and <link 2479*c43cad87SWarner Losh linkend="prof.lg_sample"><mallctl>prof.lg_sample</mallctl></link>). 2480*c43cad87SWarner Losh </para></listitem> 2481*c43cad87SWarner Losh </varlistentry> 2482*c43cad87SWarner Losh 2483*c43cad87SWarner Losh <varlistentry id="prof.lg_sample"> 2484*c43cad87SWarner Losh <term> 2485*c43cad87SWarner Losh <mallctl>prof.lg_sample</mallctl> 2486*c43cad87SWarner Losh (<type>size_t</type>) 2487*c43cad87SWarner Losh <literal>r-</literal> 2488*c43cad87SWarner Losh [<option>--enable-prof</option>] 2489*c43cad87SWarner Losh </term> 2490*c43cad87SWarner Losh <listitem><para>Get the current sample rate (see <link 2491*c43cad87SWarner Losh linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>). 2492*c43cad87SWarner Losh </para></listitem> 2493*c43cad87SWarner Losh </varlistentry> 2494*c43cad87SWarner Losh 2495*c43cad87SWarner Losh <varlistentry id="prof.interval"> 2496*c43cad87SWarner Losh <term> 2497*c43cad87SWarner Losh <mallctl>prof.interval</mallctl> 2498*c43cad87SWarner Losh (<type>uint64_t</type>) 2499*c43cad87SWarner Losh <literal>r-</literal> 2500*c43cad87SWarner Losh [<option>--enable-prof</option>] 2501*c43cad87SWarner Losh </term> 2502*c43cad87SWarner Losh <listitem><para>Average number of bytes allocated between 2503*c43cad87SWarner Losh interval-based profile dumps. See the 2504*c43cad87SWarner Losh <link 2505*c43cad87SWarner Losh linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link> 2506*c43cad87SWarner Losh option for additional information.</para></listitem> 2507*c43cad87SWarner Losh </varlistentry> 2508*c43cad87SWarner Losh 2509*c43cad87SWarner Losh <varlistentry id="stats.allocated"> 2510*c43cad87SWarner Losh <term> 2511*c43cad87SWarner Losh <mallctl>stats.allocated</mallctl> 2512*c43cad87SWarner Losh (<type>size_t</type>) 2513*c43cad87SWarner Losh <literal>r-</literal> 2514*c43cad87SWarner Losh [<option>--enable-stats</option>] 2515*c43cad87SWarner Losh </term> 2516*c43cad87SWarner Losh <listitem><para>Total number of bytes allocated by the 2517*c43cad87SWarner Losh application.</para></listitem> 2518*c43cad87SWarner Losh </varlistentry> 2519*c43cad87SWarner Losh 2520*c43cad87SWarner Losh <varlistentry id="stats.active"> 2521*c43cad87SWarner Losh <term> 2522*c43cad87SWarner Losh <mallctl>stats.active</mallctl> 2523*c43cad87SWarner Losh (<type>size_t</type>) 2524*c43cad87SWarner Losh <literal>r-</literal> 2525*c43cad87SWarner Losh [<option>--enable-stats</option>] 2526*c43cad87SWarner Losh </term> 2527*c43cad87SWarner Losh <listitem><para>Total number of bytes in active pages allocated by the 2528*c43cad87SWarner Losh application. This is a multiple of the page size, and greater than or 2529*c43cad87SWarner Losh equal to <link 2530*c43cad87SWarner Losh linkend="stats.allocated"><mallctl>stats.allocated</mallctl></link>. 2531*c43cad87SWarner Losh This does not include <link linkend="stats.arenas.i.pdirty"> 2532*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.pdirty</mallctl></link>, 2533*c43cad87SWarner Losh <link linkend="stats.arenas.i.pmuzzy"> 2534*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.pmuzzy</mallctl></link>, nor pages 2535*c43cad87SWarner Losh entirely devoted to allocator metadata.</para></listitem> 2536*c43cad87SWarner Losh </varlistentry> 2537*c43cad87SWarner Losh 2538*c43cad87SWarner Losh <varlistentry id="stats.metadata"> 2539*c43cad87SWarner Losh <term> 2540*c43cad87SWarner Losh <mallctl>stats.metadata</mallctl> 2541*c43cad87SWarner Losh (<type>size_t</type>) 2542*c43cad87SWarner Losh <literal>r-</literal> 2543*c43cad87SWarner Losh [<option>--enable-stats</option>] 2544*c43cad87SWarner Losh </term> 2545*c43cad87SWarner Losh <listitem><para>Total number of bytes dedicated to metadata, which 2546*c43cad87SWarner Losh comprise base allocations used for bootstrap-sensitive allocator 2547*c43cad87SWarner Losh metadata structures (see <link 2548*c43cad87SWarner Losh linkend="stats.arenas.i.base"><mallctl>stats.arenas.<i>.base</mallctl></link>) 2549*c43cad87SWarner Losh and internal allocations (see <link 2550*c43cad87SWarner Losh linkend="stats.arenas.i.internal"><mallctl>stats.arenas.<i>.internal</mallctl></link>). 2551*c43cad87SWarner Losh Transparent huge page (enabled with <link 2552*c43cad87SWarner Losh linkend="opt.metadata_thp">opt.metadata_thp</link>) usage is not 2553*c43cad87SWarner Losh considered.</para></listitem> 2554*c43cad87SWarner Losh </varlistentry> 2555*c43cad87SWarner Losh 2556*c43cad87SWarner Losh <varlistentry id="stats.metadata_thp"> 2557*c43cad87SWarner Losh <term> 2558*c43cad87SWarner Losh <mallctl>stats.metadata_thp</mallctl> 2559*c43cad87SWarner Losh (<type>size_t</type>) 2560*c43cad87SWarner Losh <literal>r-</literal> 2561*c43cad87SWarner Losh [<option>--enable-stats</option>] 2562*c43cad87SWarner Losh </term> 2563*c43cad87SWarner Losh <listitem><para>Number of transparent huge pages (THP) used for 2564*c43cad87SWarner Losh metadata. See <link 2565*c43cad87SWarner Losh linkend="stats.metadata"><mallctl>stats.metadata</mallctl></link> and 2566*c43cad87SWarner Losh <link linkend="opt.metadata_thp">opt.metadata_thp</link>) for 2567*c43cad87SWarner Losh details.</para></listitem> 2568*c43cad87SWarner Losh </varlistentry> 2569*c43cad87SWarner Losh 2570*c43cad87SWarner Losh <varlistentry id="stats.resident"> 2571*c43cad87SWarner Losh <term> 2572*c43cad87SWarner Losh <mallctl>stats.resident</mallctl> 2573*c43cad87SWarner Losh (<type>size_t</type>) 2574*c43cad87SWarner Losh <literal>r-</literal> 2575*c43cad87SWarner Losh [<option>--enable-stats</option>] 2576*c43cad87SWarner Losh </term> 2577*c43cad87SWarner Losh <listitem><para>Maximum number of bytes in physically resident data 2578*c43cad87SWarner Losh pages mapped by the allocator, comprising all pages dedicated to 2579*c43cad87SWarner Losh allocator metadata, pages backing active allocations, and unused dirty 2580*c43cad87SWarner Losh pages. This is a maximum rather than precise because pages may not 2581*c43cad87SWarner Losh actually be physically resident if they correspond to demand-zeroed 2582*c43cad87SWarner Losh virtual memory that has not yet been touched. This is a multiple of the 2583*c43cad87SWarner Losh page size, and is larger than <link 2584*c43cad87SWarner Losh linkend="stats.active"><mallctl>stats.active</mallctl></link>.</para></listitem> 2585*c43cad87SWarner Losh </varlistentry> 2586*c43cad87SWarner Losh 2587*c43cad87SWarner Losh <varlistentry id="stats.mapped"> 2588*c43cad87SWarner Losh <term> 2589*c43cad87SWarner Losh <mallctl>stats.mapped</mallctl> 2590*c43cad87SWarner Losh (<type>size_t</type>) 2591*c43cad87SWarner Losh <literal>r-</literal> 2592*c43cad87SWarner Losh [<option>--enable-stats</option>] 2593*c43cad87SWarner Losh </term> 2594*c43cad87SWarner Losh <listitem><para>Total number of bytes in active extents mapped by the 2595*c43cad87SWarner Losh allocator. This is larger than <link 2596*c43cad87SWarner Losh linkend="stats.active"><mallctl>stats.active</mallctl></link>. This 2597*c43cad87SWarner Losh does not include inactive extents, even those that contain unused dirty 2598*c43cad87SWarner Losh pages, which means that there is no strict ordering between this and 2599*c43cad87SWarner Losh <link 2600*c43cad87SWarner Losh linkend="stats.resident"><mallctl>stats.resident</mallctl></link>.</para></listitem> 2601*c43cad87SWarner Losh </varlistentry> 2602*c43cad87SWarner Losh 2603*c43cad87SWarner Losh <varlistentry id="stats.retained"> 2604*c43cad87SWarner Losh <term> 2605*c43cad87SWarner Losh <mallctl>stats.retained</mallctl> 2606*c43cad87SWarner Losh (<type>size_t</type>) 2607*c43cad87SWarner Losh <literal>r-</literal> 2608*c43cad87SWarner Losh [<option>--enable-stats</option>] 2609*c43cad87SWarner Losh </term> 2610*c43cad87SWarner Losh <listitem><para>Total number of bytes in virtual memory mappings that 2611*c43cad87SWarner Losh were retained rather than being returned to the operating system via 2612*c43cad87SWarner Losh e.g. <citerefentry><refentrytitle>munmap</refentrytitle> 2613*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> or similar. Retained virtual 2614*c43cad87SWarner Losh memory is typically untouched, decommitted, or purged, so it has no 2615*c43cad87SWarner Losh strongly associated physical memory (see <link 2616*c43cad87SWarner Losh linkend="arena.i.extent_hooks">extent hooks</link> for details). 2617*c43cad87SWarner Losh Retained memory is excluded from mapped memory statistics, e.g. <link 2618*c43cad87SWarner Losh linkend="stats.mapped"><mallctl>stats.mapped</mallctl></link>. 2619*c43cad87SWarner Losh </para></listitem> 2620*c43cad87SWarner Losh </varlistentry> 2621*c43cad87SWarner Losh 2622*c43cad87SWarner Losh <varlistentry id="stats.zero_reallocs"> 2623*c43cad87SWarner Losh <term> 2624*c43cad87SWarner Losh <mallctl>stats.zero_reallocs</mallctl> 2625*c43cad87SWarner Losh (<type>size_t</type>) 2626*c43cad87SWarner Losh <literal>r-</literal> 2627*c43cad87SWarner Losh [<option>--enable-stats</option>] 2628*c43cad87SWarner Losh </term> 2629*c43cad87SWarner Losh <listitem><para>Number of times that the <function>realloc()</function> 2630*c43cad87SWarner Losh was called with a non-<constant>NULL</constant> pointer argument and a 2631*c43cad87SWarner Losh <constant>0</constant> size argument. This is a fundamentally unsafe 2632*c43cad87SWarner Losh pattern in portable programs; see <link linkend="opt.zero_realloc"> 2633*c43cad87SWarner Losh <mallctl>opt.zero_realloc</mallctl></link> for details. 2634*c43cad87SWarner Losh </para></listitem> 2635*c43cad87SWarner Losh </varlistentry> 2636*c43cad87SWarner Losh 2637*c43cad87SWarner Losh <varlistentry id="stats.background_thread.num_threads"> 2638*c43cad87SWarner Losh <term> 2639*c43cad87SWarner Losh <mallctl>stats.background_thread.num_threads</mallctl> 2640*c43cad87SWarner Losh (<type>size_t</type>) 2641*c43cad87SWarner Losh <literal>r-</literal> 2642*c43cad87SWarner Losh [<option>--enable-stats</option>] 2643*c43cad87SWarner Losh </term> 2644*c43cad87SWarner Losh <listitem><para> Number of <link linkend="background_thread">background 2645*c43cad87SWarner Losh threads</link> running currently.</para></listitem> 2646*c43cad87SWarner Losh </varlistentry> 2647*c43cad87SWarner Losh 2648*c43cad87SWarner Losh <varlistentry id="stats.background_thread.num_runs"> 2649*c43cad87SWarner Losh <term> 2650*c43cad87SWarner Losh <mallctl>stats.background_thread.num_runs</mallctl> 2651*c43cad87SWarner Losh (<type>uint64_t</type>) 2652*c43cad87SWarner Losh <literal>r-</literal> 2653*c43cad87SWarner Losh [<option>--enable-stats</option>] 2654*c43cad87SWarner Losh </term> 2655*c43cad87SWarner Losh <listitem><para> Total number of runs from all <link 2656*c43cad87SWarner Losh linkend="background_thread">background threads</link>.</para></listitem> 2657*c43cad87SWarner Losh </varlistentry> 2658*c43cad87SWarner Losh 2659*c43cad87SWarner Losh <varlistentry id="stats.background_thread.run_interval"> 2660*c43cad87SWarner Losh <term> 2661*c43cad87SWarner Losh <mallctl>stats.background_thread.run_interval</mallctl> 2662*c43cad87SWarner Losh (<type>uint64_t</type>) 2663*c43cad87SWarner Losh <literal>r-</literal> 2664*c43cad87SWarner Losh [<option>--enable-stats</option>] 2665*c43cad87SWarner Losh </term> 2666*c43cad87SWarner Losh <listitem><para> Average run interval in nanoseconds of <link 2667*c43cad87SWarner Losh linkend="background_thread">background threads</link>.</para></listitem> 2668*c43cad87SWarner Losh </varlistentry> 2669*c43cad87SWarner Losh 2670*c43cad87SWarner Losh <varlistentry id="stats.mutexes.ctl"> 2671*c43cad87SWarner Losh <term> 2672*c43cad87SWarner Losh <mallctl>stats.mutexes.ctl.{counter};</mallctl> 2673*c43cad87SWarner Losh (<type>counter specific type</type>) 2674*c43cad87SWarner Losh <literal>r-</literal> 2675*c43cad87SWarner Losh [<option>--enable-stats</option>] 2676*c43cad87SWarner Losh </term> 2677*c43cad87SWarner Losh <listitem><para>Statistics on <varname>ctl</varname> mutex (global 2678*c43cad87SWarner Losh scope; mallctl related). <mallctl>{counter}</mallctl> is one of the 2679*c43cad87SWarner Losh counters below:</para> 2680*c43cad87SWarner Losh <varlistentry id="mutex_counters"> 2681*c43cad87SWarner Losh <listitem><para><varname>num_ops</varname> (<type>uint64_t</type>): 2682*c43cad87SWarner Losh Total number of lock acquisition operations on this mutex.</para> 2683*c43cad87SWarner Losh 2684*c43cad87SWarner Losh <para><varname>num_spin_acq</varname> (<type>uint64_t</type>): Number 2685*c43cad87SWarner Losh of times the mutex was spin-acquired. When the mutex is currently 2686*c43cad87SWarner Losh locked and cannot be acquired immediately, a short period of 2687*c43cad87SWarner Losh spin-retry within jemalloc will be performed. Acquired through spin 2688*c43cad87SWarner Losh generally means the contention was lightweight and not causing context 2689*c43cad87SWarner Losh switches.</para> 2690*c43cad87SWarner Losh 2691*c43cad87SWarner Losh <para><varname>num_wait</varname> (<type>uint64_t</type>): Number of 2692*c43cad87SWarner Losh times the mutex was wait-acquired, which means the mutex contention 2693*c43cad87SWarner Losh was not solved by spin-retry, and blocking operation was likely 2694*c43cad87SWarner Losh involved in order to acquire the mutex. This event generally implies 2695*c43cad87SWarner Losh higher cost / longer delay, and should be investigated if it happens 2696*c43cad87SWarner Losh often.</para> 2697*c43cad87SWarner Losh 2698*c43cad87SWarner Losh <para><varname>max_wait_time</varname> (<type>uint64_t</type>): 2699*c43cad87SWarner Losh Maximum length of time in nanoseconds spent on a single wait-acquired 2700*c43cad87SWarner Losh lock operation. Note that to avoid profiling overhead on the common 2701*c43cad87SWarner Losh path, this does not consider spin-acquired cases.</para> 2702*c43cad87SWarner Losh 2703*c43cad87SWarner Losh <para><varname>total_wait_time</varname> (<type>uint64_t</type>): 2704*c43cad87SWarner Losh Cumulative time in nanoseconds spent on wait-acquired lock operations. 2705*c43cad87SWarner Losh Similarly, spin-acquired cases are not considered.</para> 2706*c43cad87SWarner Losh 2707*c43cad87SWarner Losh <para><varname>max_num_thds</varname> (<type>uint32_t</type>): Maximum 2708*c43cad87SWarner Losh number of threads waiting on this mutex simultaneously. Similarly, 2709*c43cad87SWarner Losh spin-acquired cases are not considered.</para> 2710*c43cad87SWarner Losh 2711*c43cad87SWarner Losh <para><varname>num_owner_switch</varname> (<type>uint64_t</type>): 2712*c43cad87SWarner Losh Number of times the current mutex owner is different from the previous 2713*c43cad87SWarner Losh one. This event does not generally imply an issue; rather it is an 2714*c43cad87SWarner Losh indicator of how often the protected data are accessed by different 2715*c43cad87SWarner Losh threads. 2716*c43cad87SWarner Losh </para> 2717*c43cad87SWarner Losh </listitem> 2718*c43cad87SWarner Losh </varlistentry> 2719*c43cad87SWarner Losh </listitem> 2720*c43cad87SWarner Losh </varlistentry> 2721*c43cad87SWarner Losh 2722*c43cad87SWarner Losh <varlistentry id="stats.mutexes.background_thread"> 2723*c43cad87SWarner Losh <term> 2724*c43cad87SWarner Losh <mallctl>stats.mutexes.background_thread.{counter}</mallctl> 2725*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 2726*c43cad87SWarner Losh [<option>--enable-stats</option>] 2727*c43cad87SWarner Losh </term> 2728*c43cad87SWarner Losh <listitem><para>Statistics on <varname>background_thread</varname> mutex 2729*c43cad87SWarner Losh (global scope; <link 2730*c43cad87SWarner Losh linkend="background_thread"><mallctl>background_thread</mallctl></link> 2731*c43cad87SWarner Losh related). <mallctl>{counter}</mallctl> is one of the counters in <link 2732*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 2733*c43cad87SWarner Losh counters</link>.</para></listitem> 2734*c43cad87SWarner Losh </varlistentry> 2735*c43cad87SWarner Losh 2736*c43cad87SWarner Losh <varlistentry id="stats.mutexes.prof"> 2737*c43cad87SWarner Losh <term> 2738*c43cad87SWarner Losh <mallctl>stats.mutexes.prof.{counter}</mallctl> 2739*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 2740*c43cad87SWarner Losh [<option>--enable-stats</option>] 2741*c43cad87SWarner Losh </term> 2742*c43cad87SWarner Losh <listitem><para>Statistics on <varname>prof</varname> mutex (global 2743*c43cad87SWarner Losh scope; profiling related). <mallctl>{counter}</mallctl> is one of the 2744*c43cad87SWarner Losh counters in <link linkend="mutex_counters">mutex profiling 2745*c43cad87SWarner Losh counters</link>.</para></listitem> 2746*c43cad87SWarner Losh </varlistentry> 2747*c43cad87SWarner Losh 2748*c43cad87SWarner Losh <varlistentry id="stats.mutexes.prof_thds_data"> 2749*c43cad87SWarner Losh <term> 2750*c43cad87SWarner Losh <mallctl>stats.mutexes.prof_thds_data.{counter}</mallctl> 2751*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 2752*c43cad87SWarner Losh [<option>--enable-stats</option>] 2753*c43cad87SWarner Losh </term> 2754*c43cad87SWarner Losh <listitem><para>Statistics on <varname>prof</varname> threads data mutex 2755*c43cad87SWarner Losh (global scope; profiling related). <mallctl>{counter}</mallctl> is one 2756*c43cad87SWarner Losh of the counters in <link linkend="mutex_counters">mutex profiling 2757*c43cad87SWarner Losh counters</link>.</para></listitem> 2758*c43cad87SWarner Losh </varlistentry> 2759*c43cad87SWarner Losh 2760*c43cad87SWarner Losh <varlistentry id="stats.mutexes.prof_dump"> 2761*c43cad87SWarner Losh <term> 2762*c43cad87SWarner Losh <mallctl>stats.mutexes.prof_dump.{counter}</mallctl> 2763*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 2764*c43cad87SWarner Losh [<option>--enable-stats</option>] 2765*c43cad87SWarner Losh </term> 2766*c43cad87SWarner Losh <listitem><para>Statistics on <varname>prof</varname> dumping mutex 2767*c43cad87SWarner Losh (global scope; profiling related). <mallctl>{counter}</mallctl> is one 2768*c43cad87SWarner Losh of the counters in <link linkend="mutex_counters">mutex profiling 2769*c43cad87SWarner Losh counters</link>.</para></listitem> 2770*c43cad87SWarner Losh </varlistentry> 2771*c43cad87SWarner Losh 2772*c43cad87SWarner Losh <varlistentry id="stats.mutexes.reset"> 2773*c43cad87SWarner Losh <term> 2774*c43cad87SWarner Losh <mallctl>stats.mutexes.reset</mallctl> 2775*c43cad87SWarner Losh (<type>void</type>) <literal>--</literal> 2776*c43cad87SWarner Losh [<option>--enable-stats</option>] 2777*c43cad87SWarner Losh </term> 2778*c43cad87SWarner Losh <listitem><para>Reset all mutex profile statistics, including global 2779*c43cad87SWarner Losh mutexes, arena mutexes and bin mutexes.</para></listitem> 2780*c43cad87SWarner Losh </varlistentry> 2781*c43cad87SWarner Losh 2782*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.dss"> 2783*c43cad87SWarner Losh <term> 2784*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.dss</mallctl> 2785*c43cad87SWarner Losh (<type>const char *</type>) 2786*c43cad87SWarner Losh <literal>r-</literal> 2787*c43cad87SWarner Losh </term> 2788*c43cad87SWarner Losh <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle> 2789*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>) allocation precedence as 2790*c43cad87SWarner Losh related to <citerefentry><refentrytitle>mmap</refentrytitle> 2791*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry> allocation. See <link 2792*c43cad87SWarner Losh linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for details. 2793*c43cad87SWarner Losh </para></listitem> 2794*c43cad87SWarner Losh </varlistentry> 2795*c43cad87SWarner Losh 2796*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.dirty_decay_ms"> 2797*c43cad87SWarner Losh <term> 2798*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.dirty_decay_ms</mallctl> 2799*c43cad87SWarner Losh (<type>ssize_t</type>) 2800*c43cad87SWarner Losh <literal>r-</literal> 2801*c43cad87SWarner Losh </term> 2802*c43cad87SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 2803*c43cad87SWarner Losh set of unused dirty pages until an equivalent set of unused dirty pages 2804*c43cad87SWarner Losh is purged and/or reused. See <link 2805*c43cad87SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 2806*c43cad87SWarner Losh for details.</para></listitem> 2807*c43cad87SWarner Losh </varlistentry> 2808*c43cad87SWarner Losh 2809*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.muzzy_decay_ms"> 2810*c43cad87SWarner Losh <term> 2811*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.muzzy_decay_ms</mallctl> 2812*c43cad87SWarner Losh (<type>ssize_t</type>) 2813*c43cad87SWarner Losh <literal>r-</literal> 2814*c43cad87SWarner Losh </term> 2815*c43cad87SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 2816*c43cad87SWarner Losh set of unused muzzy pages until an equivalent set of unused muzzy pages 2817*c43cad87SWarner Losh is purged and/or reused. See <link 2818*c43cad87SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 2819*c43cad87SWarner Losh for details.</para></listitem> 2820*c43cad87SWarner Losh </varlistentry> 2821*c43cad87SWarner Losh 2822*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.nthreads"> 2823*c43cad87SWarner Losh <term> 2824*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.nthreads</mallctl> 2825*c43cad87SWarner Losh (<type>unsigned</type>) 2826*c43cad87SWarner Losh <literal>r-</literal> 2827*c43cad87SWarner Losh </term> 2828*c43cad87SWarner Losh <listitem><para>Number of threads currently assigned to 2829*c43cad87SWarner Losh arena.</para></listitem> 2830*c43cad87SWarner Losh </varlistentry> 2831*c43cad87SWarner Losh 2832*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.uptime"> 2833*c43cad87SWarner Losh <term> 2834*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.uptime</mallctl> 2835*c43cad87SWarner Losh (<type>uint64_t</type>) 2836*c43cad87SWarner Losh <literal>r-</literal> 2837*c43cad87SWarner Losh </term> 2838*c43cad87SWarner Losh <listitem><para>Time elapsed (in nanoseconds) since the arena was 2839*c43cad87SWarner Losh created. If <i> equals <constant>0</constant> or 2840*c43cad87SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant>, this is the uptime since malloc 2841*c43cad87SWarner Losh initialization.</para></listitem> 2842*c43cad87SWarner Losh </varlistentry> 2843*c43cad87SWarner Losh 2844*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.pactive"> 2845*c43cad87SWarner Losh <term> 2846*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.pactive</mallctl> 2847*c43cad87SWarner Losh (<type>size_t</type>) 2848*c43cad87SWarner Losh <literal>r-</literal> 2849*c43cad87SWarner Losh </term> 2850*c43cad87SWarner Losh <listitem><para>Number of pages in active extents.</para></listitem> 2851*c43cad87SWarner Losh </varlistentry> 2852*c43cad87SWarner Losh 2853*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.pdirty"> 2854*c43cad87SWarner Losh <term> 2855*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.pdirty</mallctl> 2856*c43cad87SWarner Losh (<type>size_t</type>) 2857*c43cad87SWarner Losh <literal>r-</literal> 2858*c43cad87SWarner Losh </term> 2859*c43cad87SWarner Losh <listitem><para>Number of pages within unused extents that are 2860*c43cad87SWarner Losh potentially dirty, and for which <function>madvise()</function> or 2861*c43cad87SWarner Losh similar has not been called. See <link 2862*c43cad87SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 2863*c43cad87SWarner Losh for a description of dirty pages.</para></listitem> 2864*c43cad87SWarner Losh </varlistentry> 2865*c43cad87SWarner Losh 2866*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.pmuzzy"> 2867*c43cad87SWarner Losh <term> 2868*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.pmuzzy</mallctl> 2869*c43cad87SWarner Losh (<type>size_t</type>) 2870*c43cad87SWarner Losh <literal>r-</literal> 2871*c43cad87SWarner Losh </term> 2872*c43cad87SWarner Losh <listitem><para>Number of pages within unused extents that are muzzy. 2873*c43cad87SWarner Losh See <link 2874*c43cad87SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 2875*c43cad87SWarner Losh for a description of muzzy pages.</para></listitem> 2876*c43cad87SWarner Losh </varlistentry> 2877*c43cad87SWarner Losh 2878*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mapped"> 2879*c43cad87SWarner Losh <term> 2880*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mapped</mallctl> 2881*c43cad87SWarner Losh (<type>size_t</type>) 2882*c43cad87SWarner Losh <literal>r-</literal> 2883*c43cad87SWarner Losh [<option>--enable-stats</option>] 2884*c43cad87SWarner Losh </term> 2885*c43cad87SWarner Losh <listitem><para>Number of mapped bytes.</para></listitem> 2886*c43cad87SWarner Losh </varlistentry> 2887*c43cad87SWarner Losh 2888*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.retained"> 2889*c43cad87SWarner Losh <term> 2890*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.retained</mallctl> 2891*c43cad87SWarner Losh (<type>size_t</type>) 2892*c43cad87SWarner Losh <literal>r-</literal> 2893*c43cad87SWarner Losh [<option>--enable-stats</option>] 2894*c43cad87SWarner Losh </term> 2895*c43cad87SWarner Losh <listitem><para>Number of retained bytes. See <link 2896*c43cad87SWarner Losh linkend="stats.retained"><mallctl>stats.retained</mallctl></link> for 2897*c43cad87SWarner Losh details.</para></listitem> 2898*c43cad87SWarner Losh </varlistentry> 2899*c43cad87SWarner Losh 2900*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.extent_avail"> 2901*c43cad87SWarner Losh <term> 2902*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.extent_avail</mallctl> 2903*c43cad87SWarner Losh (<type>size_t</type>) 2904*c43cad87SWarner Losh <literal>r-</literal> 2905*c43cad87SWarner Losh [<option>--enable-stats</option>] 2906*c43cad87SWarner Losh </term> 2907*c43cad87SWarner Losh <listitem><para>Number of allocated (but unused) extent structs in this 2908*c43cad87SWarner Losh arena.</para></listitem> 2909*c43cad87SWarner Losh </varlistentry> 2910*c43cad87SWarner Losh 2911*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.base"> 2912*c43cad87SWarner Losh <term> 2913*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.base</mallctl> 2914*c43cad87SWarner Losh (<type>size_t</type>) 2915*c43cad87SWarner Losh <literal>r-</literal> 2916*c43cad87SWarner Losh [<option>--enable-stats</option>] 2917*c43cad87SWarner Losh </term> 2918*c43cad87SWarner Losh <listitem><para> 2919*c43cad87SWarner Losh Number of bytes dedicated to bootstrap-sensitive allocator metadata 2920*c43cad87SWarner Losh structures.</para></listitem> 2921*c43cad87SWarner Losh </varlistentry> 2922*c43cad87SWarner Losh 2923*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.internal"> 2924*c43cad87SWarner Losh <term> 2925*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.internal</mallctl> 2926*c43cad87SWarner Losh (<type>size_t</type>) 2927*c43cad87SWarner Losh <literal>r-</literal> 2928*c43cad87SWarner Losh [<option>--enable-stats</option>] 2929*c43cad87SWarner Losh </term> 2930*c43cad87SWarner Losh <listitem><para>Number of bytes dedicated to internal allocations. 2931*c43cad87SWarner Losh Internal allocations differ from application-originated allocations in 2932*c43cad87SWarner Losh that they are for internal use, and that they are omitted from heap 2933*c43cad87SWarner Losh profiles.</para></listitem> 2934*c43cad87SWarner Losh </varlistentry> 2935*c43cad87SWarner Losh 2936*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.metadata_thp"> 2937*c43cad87SWarner Losh <term> 2938*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.metadata_thp</mallctl> 2939*c43cad87SWarner Losh (<type>size_t</type>) 2940*c43cad87SWarner Losh <literal>r-</literal> 2941*c43cad87SWarner Losh [<option>--enable-stats</option>] 2942*c43cad87SWarner Losh </term> 2943*c43cad87SWarner Losh <listitem><para>Number of transparent huge pages (THP) used for 2944*c43cad87SWarner Losh metadata. See <link linkend="opt.metadata_thp">opt.metadata_thp</link> 2945*c43cad87SWarner Losh for details.</para></listitem> 2946*c43cad87SWarner Losh </varlistentry> 2947*c43cad87SWarner Losh 2948*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.resident"> 2949*c43cad87SWarner Losh <term> 2950*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.resident</mallctl> 2951*c43cad87SWarner Losh (<type>size_t</type>) 2952*c43cad87SWarner Losh <literal>r-</literal> 2953*c43cad87SWarner Losh [<option>--enable-stats</option>] 2954*c43cad87SWarner Losh </term> 2955*c43cad87SWarner Losh <listitem><para>Maximum number of bytes in physically resident data 2956*c43cad87SWarner Losh pages mapped by the arena, comprising all pages dedicated to allocator 2957*c43cad87SWarner Losh metadata, pages backing active allocations, and unused dirty pages. 2958*c43cad87SWarner Losh This is a maximum rather than precise because pages may not actually be 2959*c43cad87SWarner Losh physically resident if they correspond to demand-zeroed virtual memory 2960*c43cad87SWarner Losh that has not yet been touched. This is a multiple of the page 2961*c43cad87SWarner Losh size.</para></listitem> 2962*c43cad87SWarner Losh </varlistentry> 2963*c43cad87SWarner Losh 2964*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.dirty_npurge"> 2965*c43cad87SWarner Losh <term> 2966*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.dirty_npurge</mallctl> 2967*c43cad87SWarner Losh (<type>uint64_t</type>) 2968*c43cad87SWarner Losh <literal>r-</literal> 2969*c43cad87SWarner Losh [<option>--enable-stats</option>] 2970*c43cad87SWarner Losh </term> 2971*c43cad87SWarner Losh <listitem><para>Number of dirty page purge sweeps performed. 2972*c43cad87SWarner Losh </para></listitem> 2973*c43cad87SWarner Losh </varlistentry> 2974*c43cad87SWarner Losh 2975*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.dirty_nmadvise"> 2976*c43cad87SWarner Losh <term> 2977*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.dirty_nmadvise</mallctl> 2978*c43cad87SWarner Losh (<type>uint64_t</type>) 2979*c43cad87SWarner Losh <literal>r-</literal> 2980*c43cad87SWarner Losh [<option>--enable-stats</option>] 2981*c43cad87SWarner Losh </term> 2982*c43cad87SWarner Losh <listitem><para>Number of <function>madvise()</function> or similar 2983*c43cad87SWarner Losh calls made to purge dirty pages.</para></listitem> 2984*c43cad87SWarner Losh </varlistentry> 2985*c43cad87SWarner Losh 2986*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.dirty_purged"> 2987*c43cad87SWarner Losh <term> 2988*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.dirty_purged</mallctl> 2989*c43cad87SWarner Losh (<type>uint64_t</type>) 2990*c43cad87SWarner Losh <literal>r-</literal> 2991*c43cad87SWarner Losh [<option>--enable-stats</option>] 2992*c43cad87SWarner Losh </term> 2993*c43cad87SWarner Losh <listitem><para>Number of dirty pages purged.</para></listitem> 2994*c43cad87SWarner Losh </varlistentry> 2995*c43cad87SWarner Losh 2996*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.muzzy_npurge"> 2997*c43cad87SWarner Losh <term> 2998*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.muzzy_npurge</mallctl> 2999*c43cad87SWarner Losh (<type>uint64_t</type>) 3000*c43cad87SWarner Losh <literal>r-</literal> 3001*c43cad87SWarner Losh [<option>--enable-stats</option>] 3002*c43cad87SWarner Losh </term> 3003*c43cad87SWarner Losh <listitem><para>Number of muzzy page purge sweeps performed. 3004*c43cad87SWarner Losh </para></listitem> 3005*c43cad87SWarner Losh </varlistentry> 3006*c43cad87SWarner Losh 3007*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.muzzy_nmadvise"> 3008*c43cad87SWarner Losh <term> 3009*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.muzzy_nmadvise</mallctl> 3010*c43cad87SWarner Losh (<type>uint64_t</type>) 3011*c43cad87SWarner Losh <literal>r-</literal> 3012*c43cad87SWarner Losh [<option>--enable-stats</option>] 3013*c43cad87SWarner Losh </term> 3014*c43cad87SWarner Losh <listitem><para>Number of <function>madvise()</function> or similar 3015*c43cad87SWarner Losh calls made to purge muzzy pages.</para></listitem> 3016*c43cad87SWarner Losh </varlistentry> 3017*c43cad87SWarner Losh 3018*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.muzzy_purged"> 3019*c43cad87SWarner Losh <term> 3020*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.muzzy_purged</mallctl> 3021*c43cad87SWarner Losh (<type>uint64_t</type>) 3022*c43cad87SWarner Losh <literal>r-</literal> 3023*c43cad87SWarner Losh [<option>--enable-stats</option>] 3024*c43cad87SWarner Losh </term> 3025*c43cad87SWarner Losh <listitem><para>Number of muzzy pages purged.</para></listitem> 3026*c43cad87SWarner Losh </varlistentry> 3027*c43cad87SWarner Losh 3028*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.small.allocated"> 3029*c43cad87SWarner Losh <term> 3030*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.small.allocated</mallctl> 3031*c43cad87SWarner Losh (<type>size_t</type>) 3032*c43cad87SWarner Losh <literal>r-</literal> 3033*c43cad87SWarner Losh [<option>--enable-stats</option>] 3034*c43cad87SWarner Losh </term> 3035*c43cad87SWarner Losh <listitem><para>Number of bytes currently allocated by small objects. 3036*c43cad87SWarner Losh </para></listitem> 3037*c43cad87SWarner Losh </varlistentry> 3038*c43cad87SWarner Losh 3039*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.small.nmalloc"> 3040*c43cad87SWarner Losh <term> 3041*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.small.nmalloc</mallctl> 3042*c43cad87SWarner Losh (<type>uint64_t</type>) 3043*c43cad87SWarner Losh <literal>r-</literal> 3044*c43cad87SWarner Losh [<option>--enable-stats</option>] 3045*c43cad87SWarner Losh </term> 3046*c43cad87SWarner Losh <listitem><para>Cumulative number of times a small allocation was 3047*c43cad87SWarner Losh requested from the arena's bins, whether to fill the relevant tcache if 3048*c43cad87SWarner Losh <link linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is 3049*c43cad87SWarner Losh enabled, or to directly satisfy an allocation request 3050*c43cad87SWarner Losh otherwise.</para></listitem> 3051*c43cad87SWarner Losh </varlistentry> 3052*c43cad87SWarner Losh 3053*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.small.ndalloc"> 3054*c43cad87SWarner Losh <term> 3055*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.small.ndalloc</mallctl> 3056*c43cad87SWarner Losh (<type>uint64_t</type>) 3057*c43cad87SWarner Losh <literal>r-</literal> 3058*c43cad87SWarner Losh [<option>--enable-stats</option>] 3059*c43cad87SWarner Losh </term> 3060*c43cad87SWarner Losh <listitem><para>Cumulative number of times a small allocation was 3061*c43cad87SWarner Losh returned to the arena's bins, whether to flush the relevant tcache if 3062*c43cad87SWarner Losh <link linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is 3063*c43cad87SWarner Losh enabled, or to directly deallocate an allocation 3064*c43cad87SWarner Losh otherwise.</para></listitem> 3065*c43cad87SWarner Losh </varlistentry> 3066*c43cad87SWarner Losh 3067*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.small.nrequests"> 3068*c43cad87SWarner Losh <term> 3069*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.small.nrequests</mallctl> 3070*c43cad87SWarner Losh (<type>uint64_t</type>) 3071*c43cad87SWarner Losh <literal>r-</literal> 3072*c43cad87SWarner Losh [<option>--enable-stats</option>] 3073*c43cad87SWarner Losh </term> 3074*c43cad87SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 3075*c43cad87SWarner Losh all bin size classes.</para></listitem> 3076*c43cad87SWarner Losh </varlistentry> 3077*c43cad87SWarner Losh 3078*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.small.nfills"> 3079*c43cad87SWarner Losh <term> 3080*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.small.nfills</mallctl> 3081*c43cad87SWarner Losh (<type>uint64_t</type>) 3082*c43cad87SWarner Losh <literal>r-</literal> 3083*c43cad87SWarner Losh [<option>--enable-stats</option>] 3084*c43cad87SWarner Losh </term> 3085*c43cad87SWarner Losh <listitem><para>Cumulative number of tcache fills by all small size 3086*c43cad87SWarner Losh classes.</para></listitem> 3087*c43cad87SWarner Losh </varlistentry> 3088*c43cad87SWarner Losh 3089*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.small.nflushes"> 3090*c43cad87SWarner Losh <term> 3091*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.small.nflushes</mallctl> 3092*c43cad87SWarner Losh (<type>uint64_t</type>) 3093*c43cad87SWarner Losh <literal>r-</literal> 3094*c43cad87SWarner Losh [<option>--enable-stats</option>] 3095*c43cad87SWarner Losh </term> 3096*c43cad87SWarner Losh <listitem><para>Cumulative number of tcache flushes by all small size 3097*c43cad87SWarner Losh classes.</para></listitem> 3098*c43cad87SWarner Losh </varlistentry> 3099*c43cad87SWarner Losh 3100*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.large.allocated"> 3101*c43cad87SWarner Losh <term> 3102*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.large.allocated</mallctl> 3103*c43cad87SWarner Losh (<type>size_t</type>) 3104*c43cad87SWarner Losh <literal>r-</literal> 3105*c43cad87SWarner Losh [<option>--enable-stats</option>] 3106*c43cad87SWarner Losh </term> 3107*c43cad87SWarner Losh <listitem><para>Number of bytes currently allocated by large objects. 3108*c43cad87SWarner Losh </para></listitem> 3109*c43cad87SWarner Losh </varlistentry> 3110*c43cad87SWarner Losh 3111*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.large.nmalloc"> 3112*c43cad87SWarner Losh <term> 3113*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.large.nmalloc</mallctl> 3114*c43cad87SWarner Losh (<type>uint64_t</type>) 3115*c43cad87SWarner Losh <literal>r-</literal> 3116*c43cad87SWarner Losh [<option>--enable-stats</option>] 3117*c43cad87SWarner Losh </term> 3118*c43cad87SWarner Losh <listitem><para>Cumulative number of times a large extent was allocated 3119*c43cad87SWarner Losh from the arena, whether to fill the relevant tcache if <link 3120*c43cad87SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 3121*c43cad87SWarner Losh the size class is within the range being cached, or to directly satisfy 3122*c43cad87SWarner Losh an allocation request otherwise.</para></listitem> 3123*c43cad87SWarner Losh </varlistentry> 3124*c43cad87SWarner Losh 3125*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.large.ndalloc"> 3126*c43cad87SWarner Losh <term> 3127*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.large.ndalloc</mallctl> 3128*c43cad87SWarner Losh (<type>uint64_t</type>) 3129*c43cad87SWarner Losh <literal>r-</literal> 3130*c43cad87SWarner Losh [<option>--enable-stats</option>] 3131*c43cad87SWarner Losh </term> 3132*c43cad87SWarner Losh <listitem><para>Cumulative number of times a large extent was returned 3133*c43cad87SWarner Losh to the arena, whether to flush the relevant tcache if <link 3134*c43cad87SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 3135*c43cad87SWarner Losh the size class is within the range being cached, or to directly 3136*c43cad87SWarner Losh deallocate an allocation otherwise.</para></listitem> 3137*c43cad87SWarner Losh </varlistentry> 3138*c43cad87SWarner Losh 3139*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.large.nrequests"> 3140*c43cad87SWarner Losh <term> 3141*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.large.nrequests</mallctl> 3142*c43cad87SWarner Losh (<type>uint64_t</type>) 3143*c43cad87SWarner Losh <literal>r-</literal> 3144*c43cad87SWarner Losh [<option>--enable-stats</option>] 3145*c43cad87SWarner Losh </term> 3146*c43cad87SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 3147*c43cad87SWarner Losh all large size classes.</para></listitem> 3148*c43cad87SWarner Losh </varlistentry> 3149*c43cad87SWarner Losh 3150*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.large.nfills"> 3151*c43cad87SWarner Losh <term> 3152*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.large.nfills</mallctl> 3153*c43cad87SWarner Losh (<type>uint64_t</type>) 3154*c43cad87SWarner Losh <literal>r-</literal> 3155*c43cad87SWarner Losh [<option>--enable-stats</option>] 3156*c43cad87SWarner Losh </term> 3157*c43cad87SWarner Losh <listitem><para>Cumulative number of tcache fills by all large size 3158*c43cad87SWarner Losh classes.</para></listitem> 3159*c43cad87SWarner Losh </varlistentry> 3160*c43cad87SWarner Losh 3161*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.large.nflushes"> 3162*c43cad87SWarner Losh <term> 3163*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.large.nflushes</mallctl> 3164*c43cad87SWarner Losh (<type>uint64_t</type>) 3165*c43cad87SWarner Losh <literal>r-</literal> 3166*c43cad87SWarner Losh [<option>--enable-stats</option>] 3167*c43cad87SWarner Losh </term> 3168*c43cad87SWarner Losh <listitem><para>Cumulative number of tcache flushes by all large size 3169*c43cad87SWarner Losh classes.</para></listitem> 3170*c43cad87SWarner Losh </varlistentry> 3171*c43cad87SWarner Losh 3172*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nmalloc"> 3173*c43cad87SWarner Losh <term> 3174*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nmalloc</mallctl> 3175*c43cad87SWarner Losh (<type>uint64_t</type>) 3176*c43cad87SWarner Losh <literal>r-</literal> 3177*c43cad87SWarner Losh [<option>--enable-stats</option>] 3178*c43cad87SWarner Losh </term> 3179*c43cad87SWarner Losh <listitem><para>Cumulative number of times a bin region of the 3180*c43cad87SWarner Losh corresponding size class was allocated from the arena, whether to fill 3181*c43cad87SWarner Losh the relevant tcache if <link 3182*c43cad87SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled, or 3183*c43cad87SWarner Losh to directly satisfy an allocation request otherwise.</para></listitem> 3184*c43cad87SWarner Losh </varlistentry> 3185*c43cad87SWarner Losh 3186*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.ndalloc"> 3187*c43cad87SWarner Losh <term> 3188*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.ndalloc</mallctl> 3189*c43cad87SWarner Losh (<type>uint64_t</type>) 3190*c43cad87SWarner Losh <literal>r-</literal> 3191*c43cad87SWarner Losh [<option>--enable-stats</option>] 3192*c43cad87SWarner Losh </term> 3193*c43cad87SWarner Losh <listitem><para>Cumulative number of times a bin region of the 3194*c43cad87SWarner Losh corresponding size class was returned to the arena, whether to flush the 3195*c43cad87SWarner Losh relevant tcache if <link 3196*c43cad87SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled, or 3197*c43cad87SWarner Losh to directly deallocate an allocation otherwise.</para></listitem> 3198*c43cad87SWarner Losh </varlistentry> 3199*c43cad87SWarner Losh 3200*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nrequests"> 3201*c43cad87SWarner Losh <term> 3202*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nrequests</mallctl> 3203*c43cad87SWarner Losh (<type>uint64_t</type>) 3204*c43cad87SWarner Losh <literal>r-</literal> 3205*c43cad87SWarner Losh [<option>--enable-stats</option>] 3206*c43cad87SWarner Losh </term> 3207*c43cad87SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 3208*c43cad87SWarner Losh bin regions of the corresponding size class.</para></listitem> 3209*c43cad87SWarner Losh </varlistentry> 3210*c43cad87SWarner Losh 3211*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.curregs"> 3212*c43cad87SWarner Losh <term> 3213*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.curregs</mallctl> 3214*c43cad87SWarner Losh (<type>size_t</type>) 3215*c43cad87SWarner Losh <literal>r-</literal> 3216*c43cad87SWarner Losh [<option>--enable-stats</option>] 3217*c43cad87SWarner Losh </term> 3218*c43cad87SWarner Losh <listitem><para>Current number of regions for this size 3219*c43cad87SWarner Losh class.</para></listitem> 3220*c43cad87SWarner Losh </varlistentry> 3221*c43cad87SWarner Losh 3222*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nfills"> 3223*c43cad87SWarner Losh <term> 3224*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nfills</mallctl> 3225*c43cad87SWarner Losh (<type>uint64_t</type>) 3226*c43cad87SWarner Losh <literal>r-</literal> 3227*c43cad87SWarner Losh </term> 3228*c43cad87SWarner Losh <listitem><para>Cumulative number of tcache fills.</para></listitem> 3229*c43cad87SWarner Losh </varlistentry> 3230*c43cad87SWarner Losh 3231*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nflushes"> 3232*c43cad87SWarner Losh <term> 3233*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nflushes</mallctl> 3234*c43cad87SWarner Losh (<type>uint64_t</type>) 3235*c43cad87SWarner Losh <literal>r-</literal> 3236*c43cad87SWarner Losh </term> 3237*c43cad87SWarner Losh <listitem><para>Cumulative number of tcache flushes.</para></listitem> 3238*c43cad87SWarner Losh </varlistentry> 3239*c43cad87SWarner Losh 3240*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nslabs"> 3241*c43cad87SWarner Losh <term> 3242*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nslabs</mallctl> 3243*c43cad87SWarner Losh (<type>uint64_t</type>) 3244*c43cad87SWarner Losh <literal>r-</literal> 3245*c43cad87SWarner Losh [<option>--enable-stats</option>] 3246*c43cad87SWarner Losh </term> 3247*c43cad87SWarner Losh <listitem><para>Cumulative number of slabs created.</para></listitem> 3248*c43cad87SWarner Losh </varlistentry> 3249*c43cad87SWarner Losh 3250*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nreslabs"> 3251*c43cad87SWarner Losh <term> 3252*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nreslabs</mallctl> 3253*c43cad87SWarner Losh (<type>uint64_t</type>) 3254*c43cad87SWarner Losh <literal>r-</literal> 3255*c43cad87SWarner Losh [<option>--enable-stats</option>] 3256*c43cad87SWarner Losh </term> 3257*c43cad87SWarner Losh <listitem><para>Cumulative number of times the current slab from which 3258*c43cad87SWarner Losh to allocate changed.</para></listitem> 3259*c43cad87SWarner Losh </varlistentry> 3260*c43cad87SWarner Losh 3261*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.curslabs"> 3262*c43cad87SWarner Losh <term> 3263*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.curslabs</mallctl> 3264*c43cad87SWarner Losh (<type>size_t</type>) 3265*c43cad87SWarner Losh <literal>r-</literal> 3266*c43cad87SWarner Losh [<option>--enable-stats</option>] 3267*c43cad87SWarner Losh </term> 3268*c43cad87SWarner Losh <listitem><para>Current number of slabs.</para></listitem> 3269*c43cad87SWarner Losh </varlistentry> 3270*c43cad87SWarner Losh 3271*c43cad87SWarner Losh 3272*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nonfull_slabs"> 3273*c43cad87SWarner Losh <term> 3274*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nonfull_slabs</mallctl> 3275*c43cad87SWarner Losh (<type>size_t</type>) 3276*c43cad87SWarner Losh <literal>r-</literal> 3277*c43cad87SWarner Losh [<option>--enable-stats</option>] 3278*c43cad87SWarner Losh </term> 3279*c43cad87SWarner Losh <listitem><para>Current number of nonfull slabs.</para></listitem> 3280*c43cad87SWarner Losh </varlistentry> 3281*c43cad87SWarner Losh 3282*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.bins.mutex"> 3283*c43cad87SWarner Losh <term> 3284*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.mutex.{counter}</mallctl> 3285*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3286*c43cad87SWarner Losh [<option>--enable-stats</option>] 3287*c43cad87SWarner Losh </term> 3288*c43cad87SWarner Losh <listitem><para>Statistics on 3289*c43cad87SWarner Losh <varname>arena.<i>.bins.<j></varname> mutex (arena bin 3290*c43cad87SWarner Losh scope; bin operation related). <mallctl>{counter}</mallctl> is one of 3291*c43cad87SWarner Losh the counters in <link linkend="mutex_counters">mutex profiling 3292*c43cad87SWarner Losh counters</link>.</para></listitem> 3293*c43cad87SWarner Losh </varlistentry> 3294*c43cad87SWarner Losh 3295*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.extents.n"> 3296*c43cad87SWarner Losh <term> 3297*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.extents.<j>.n{extent_type}</mallctl> 3298*c43cad87SWarner Losh (<type>size_t</type>) 3299*c43cad87SWarner Losh <literal>r-</literal> 3300*c43cad87SWarner Losh [<option>--enable-stats</option>] 3301*c43cad87SWarner Losh </term> 3302*c43cad87SWarner Losh <listitem><para> Number of extents of the given type in this arena in 3303*c43cad87SWarner Losh the bucket corresponding to page size index <j>. The extent type 3304*c43cad87SWarner Losh is one of dirty, muzzy, or retained.</para></listitem> 3305*c43cad87SWarner Losh </varlistentry> 3306*c43cad87SWarner Losh 3307*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.extents.bytes"> 3308*c43cad87SWarner Losh <term> 3309*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.extents.<j>.{extent_type}_bytes</mallctl> 3310*c43cad87SWarner Losh (<type>size_t</type>) 3311*c43cad87SWarner Losh <literal>r-</literal> 3312*c43cad87SWarner Losh [<option>--enable-stats</option>] 3313*c43cad87SWarner Losh </term> 3314*c43cad87SWarner Losh <listitem><para> Sum of the bytes managed by extents of the given type 3315*c43cad87SWarner Losh in this arena in the bucket corresponding to page size index <j>. 3316*c43cad87SWarner Losh The extent type is one of dirty, muzzy, or retained.</para></listitem> 3317*c43cad87SWarner Losh </varlistentry> 3318*c43cad87SWarner Losh 3319*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.nmalloc"> 3320*c43cad87SWarner Losh <term> 3321*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.nmalloc</mallctl> 3322*c43cad87SWarner Losh (<type>uint64_t</type>) 3323*c43cad87SWarner Losh <literal>r-</literal> 3324*c43cad87SWarner Losh [<option>--enable-stats</option>] 3325*c43cad87SWarner Losh </term> 3326*c43cad87SWarner Losh <listitem><para>Cumulative number of times a large extent of the 3327*c43cad87SWarner Losh corresponding size class was allocated from the arena, whether to fill 3328*c43cad87SWarner Losh the relevant tcache if <link 3329*c43cad87SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 3330*c43cad87SWarner Losh the size class is within the range being cached, or to directly satisfy 3331*c43cad87SWarner Losh an allocation request otherwise.</para></listitem> 3332*c43cad87SWarner Losh </varlistentry> 3333*c43cad87SWarner Losh 3334*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.ndalloc"> 3335*c43cad87SWarner Losh <term> 3336*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.ndalloc</mallctl> 3337*c43cad87SWarner Losh (<type>uint64_t</type>) 3338*c43cad87SWarner Losh <literal>r-</literal> 3339*c43cad87SWarner Losh [<option>--enable-stats</option>] 3340*c43cad87SWarner Losh </term> 3341*c43cad87SWarner Losh <listitem><para>Cumulative number of times a large extent of the 3342*c43cad87SWarner Losh corresponding size class was returned to the arena, whether to flush the 3343*c43cad87SWarner Losh relevant tcache if <link 3344*c43cad87SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 3345*c43cad87SWarner Losh the size class is within the range being cached, or to directly 3346*c43cad87SWarner Losh deallocate an allocation otherwise.</para></listitem> 3347*c43cad87SWarner Losh </varlistentry> 3348*c43cad87SWarner Losh 3349*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.nrequests"> 3350*c43cad87SWarner Losh <term> 3351*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.nrequests</mallctl> 3352*c43cad87SWarner Losh (<type>uint64_t</type>) 3353*c43cad87SWarner Losh <literal>r-</literal> 3354*c43cad87SWarner Losh [<option>--enable-stats</option>] 3355*c43cad87SWarner Losh </term> 3356*c43cad87SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 3357*c43cad87SWarner Losh large extents of the corresponding size class.</para></listitem> 3358*c43cad87SWarner Losh </varlistentry> 3359*c43cad87SWarner Losh 3360*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.curlextents"> 3361*c43cad87SWarner Losh <term> 3362*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.curlextents</mallctl> 3363*c43cad87SWarner Losh (<type>size_t</type>) 3364*c43cad87SWarner Losh <literal>r-</literal> 3365*c43cad87SWarner Losh [<option>--enable-stats</option>] 3366*c43cad87SWarner Losh </term> 3367*c43cad87SWarner Losh <listitem><para>Current number of large allocations for this size class. 3368*c43cad87SWarner Losh </para></listitem> 3369*c43cad87SWarner Losh </varlistentry> 3370*c43cad87SWarner Losh 3371*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.large"> 3372*c43cad87SWarner Losh <term> 3373*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.large.{counter}</mallctl> 3374*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3375*c43cad87SWarner Losh [<option>--enable-stats</option>] 3376*c43cad87SWarner Losh </term> 3377*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.large</varname> 3378*c43cad87SWarner Losh mutex (arena scope; large allocation related). 3379*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3380*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3381*c43cad87SWarner Losh counters</link>.</para></listitem> 3382*c43cad87SWarner Losh </varlistentry> 3383*c43cad87SWarner Losh 3384*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extent_avail"> 3385*c43cad87SWarner Losh <term> 3386*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extent_avail.{counter}</mallctl> 3387*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3388*c43cad87SWarner Losh [<option>--enable-stats</option>] 3389*c43cad87SWarner Losh </term> 3390*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extent_avail 3391*c43cad87SWarner Losh </varname> mutex (arena scope; extent avail related). 3392*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3393*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3394*c43cad87SWarner Losh counters</link>.</para></listitem> 3395*c43cad87SWarner Losh </varlistentry> 3396*c43cad87SWarner Losh 3397*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extents_dirty"> 3398*c43cad87SWarner Losh <term> 3399*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extents_dirty.{counter}</mallctl> 3400*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3401*c43cad87SWarner Losh [<option>--enable-stats</option>] 3402*c43cad87SWarner Losh </term> 3403*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extents_dirty 3404*c43cad87SWarner Losh </varname> mutex (arena scope; dirty extents related). 3405*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3406*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3407*c43cad87SWarner Losh counters</link>.</para></listitem> 3408*c43cad87SWarner Losh </varlistentry> 3409*c43cad87SWarner Losh 3410*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extents_muzzy"> 3411*c43cad87SWarner Losh <term> 3412*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extents_muzzy.{counter}</mallctl> 3413*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3414*c43cad87SWarner Losh [<option>--enable-stats</option>] 3415*c43cad87SWarner Losh </term> 3416*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extents_muzzy 3417*c43cad87SWarner Losh </varname> mutex (arena scope; muzzy extents related). 3418*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3419*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3420*c43cad87SWarner Losh counters</link>.</para></listitem> 3421*c43cad87SWarner Losh </varlistentry> 3422*c43cad87SWarner Losh 3423*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extents_retained"> 3424*c43cad87SWarner Losh <term> 3425*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extents_retained.{counter}</mallctl> 3426*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3427*c43cad87SWarner Losh [<option>--enable-stats</option>] 3428*c43cad87SWarner Losh </term> 3429*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extents_retained 3430*c43cad87SWarner Losh </varname> mutex (arena scope; retained extents related). 3431*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3432*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3433*c43cad87SWarner Losh counters</link>.</para></listitem> 3434*c43cad87SWarner Losh </varlistentry> 3435*c43cad87SWarner Losh 3436*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.decay_dirty"> 3437*c43cad87SWarner Losh <term> 3438*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.decay_dirty.{counter}</mallctl> 3439*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3440*c43cad87SWarner Losh [<option>--enable-stats</option>] 3441*c43cad87SWarner Losh </term> 3442*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.decay_dirty 3443*c43cad87SWarner Losh </varname> mutex (arena scope; decay for dirty pages related). 3444*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3445*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3446*c43cad87SWarner Losh counters</link>.</para></listitem> 3447*c43cad87SWarner Losh </varlistentry> 3448*c43cad87SWarner Losh 3449*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.decay_muzzy"> 3450*c43cad87SWarner Losh <term> 3451*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.decay_muzzy.{counter}</mallctl> 3452*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3453*c43cad87SWarner Losh [<option>--enable-stats</option>] 3454*c43cad87SWarner Losh </term> 3455*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.decay_muzzy 3456*c43cad87SWarner Losh </varname> mutex (arena scope; decay for muzzy pages related). 3457*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3458*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3459*c43cad87SWarner Losh counters</link>.</para></listitem> 3460*c43cad87SWarner Losh </varlistentry> 3461*c43cad87SWarner Losh 3462*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.base"> 3463*c43cad87SWarner Losh <term> 3464*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.base.{counter}</mallctl> 3465*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3466*c43cad87SWarner Losh [<option>--enable-stats</option>] 3467*c43cad87SWarner Losh </term> 3468*c43cad87SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.base</varname> 3469*c43cad87SWarner Losh mutex (arena scope; base allocator related). 3470*c43cad87SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 3471*c43cad87SWarner Losh linkend="mutex_counters">mutex profiling 3472*c43cad87SWarner Losh counters</link>.</para></listitem> 3473*c43cad87SWarner Losh </varlistentry> 3474*c43cad87SWarner Losh 3475*c43cad87SWarner Losh <varlistentry id="stats.arenas.i.mutexes.tcache_list"> 3476*c43cad87SWarner Losh <term> 3477*c43cad87SWarner Losh <mallctl>stats.arenas.<i>.mutexes.tcache_list.{counter}</mallctl> 3478*c43cad87SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 3479*c43cad87SWarner Losh [<option>--enable-stats</option>] 3480*c43cad87SWarner Losh </term> 3481*c43cad87SWarner Losh <listitem><para>Statistics on 3482*c43cad87SWarner Losh <varname>arena.<i>.tcache_list</varname> mutex (arena scope; 3483*c43cad87SWarner Losh tcache to arena association related). This mutex is expected to be 3484*c43cad87SWarner Losh accessed less often. <mallctl>{counter}</mallctl> is one of the 3485*c43cad87SWarner Losh counters in <link linkend="mutex_counters">mutex profiling 3486*c43cad87SWarner Losh counters</link>.</para></listitem> 3487*c43cad87SWarner Losh </varlistentry> 3488*c43cad87SWarner Losh 3489*c43cad87SWarner Losh </variablelist> 3490*c43cad87SWarner Losh </refsect1> 3491*c43cad87SWarner Losh <refsect1 id="heap_profile_format"> 3492*c43cad87SWarner Losh <title>HEAP PROFILE FORMAT</title> 3493*c43cad87SWarner Losh <para>Although the heap profiling functionality was originally designed to 3494*c43cad87SWarner Losh be compatible with the 3495*c43cad87SWarner Losh <command>pprof</command> command that is developed as part of the <ulink 3496*c43cad87SWarner Losh url="http://code.google.com/p/gperftools/">gperftools 3497*c43cad87SWarner Losh package</ulink>, the addition of per thread heap profiling functionality 3498*c43cad87SWarner Losh required a different heap profile format. The <command>jeprof</command> 3499*c43cad87SWarner Losh command is derived from <command>pprof</command>, with enhancements to 3500*c43cad87SWarner Losh support the heap profile format described here.</para> 3501*c43cad87SWarner Losh 3502*c43cad87SWarner Losh <para>In the following hypothetical heap profile, <constant>[...]</constant> 3503*c43cad87SWarner Losh indicates elision for the sake of compactness. <programlisting><![CDATA[ 3504*c43cad87SWarner Loshheap_v2/524288 3505*c43cad87SWarner Losh t*: 28106: 56637512 [0: 0] 3506*c43cad87SWarner Losh [...] 3507*c43cad87SWarner Losh t3: 352: 16777344 [0: 0] 3508*c43cad87SWarner Losh [...] 3509*c43cad87SWarner Losh t99: 17754: 29341640 [0: 0] 3510*c43cad87SWarner Losh [...] 3511*c43cad87SWarner Losh@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...] 3512*c43cad87SWarner Losh t*: 13: 6688 [0: 0] 3513*c43cad87SWarner Losh t3: 12: 6496 [0: 0] 3514*c43cad87SWarner Losh t99: 1: 192 [0: 0] 3515*c43cad87SWarner Losh[...] 3516*c43cad87SWarner Losh 3517*c43cad87SWarner LoshMAPPED_LIBRARIES: 3518*c43cad87SWarner Losh[...]]]></programlisting> The following matches the above heap profile, but most 3519*c43cad87SWarner Loshtokens are replaced with <constant><description></constant> to indicate 3520*c43cad87SWarner Loshdescriptions of the corresponding fields. <programlisting><![CDATA[ 3521*c43cad87SWarner Losh<heap_profile_format_version>/<mean_sample_interval> 3522*c43cad87SWarner Losh <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 3523*c43cad87SWarner Losh [...] 3524*c43cad87SWarner Losh <thread_3_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 3525*c43cad87SWarner Losh [...] 3526*c43cad87SWarner Losh <thread_99_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 3527*c43cad87SWarner Losh [...] 3528*c43cad87SWarner Losh@ <top_frame> <frame> [...] <frame> <frame> <frame> [...] 3529*c43cad87SWarner Losh <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 3530*c43cad87SWarner Losh <backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 3531*c43cad87SWarner Losh <backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 3532*c43cad87SWarner Losh[...] 3533*c43cad87SWarner Losh 3534*c43cad87SWarner LoshMAPPED_LIBRARIES: 3535*c43cad87SWarner Losh</proc/<pid>/maps>]]></programlisting></para> 3536*c43cad87SWarner Losh </refsect1> 3537*c43cad87SWarner Losh 3538*c43cad87SWarner Losh <refsect1 id="debugging_malloc_problems"> 3539*c43cad87SWarner Losh <title>DEBUGGING MALLOC PROBLEMS</title> 3540*c43cad87SWarner Losh <para>When debugging, it is a good idea to configure/build jemalloc with 3541*c43cad87SWarner Losh the <option>--enable-debug</option> and <option>--enable-fill</option> 3542*c43cad87SWarner Losh options, and recompile the program with suitable options and symbols for 3543*c43cad87SWarner Losh debugger support. When so configured, jemalloc incorporates a wide variety 3544*c43cad87SWarner Losh of run-time assertions that catch application errors such as double-free, 3545*c43cad87SWarner Losh write-after-free, etc.</para> 3546*c43cad87SWarner Losh 3547*c43cad87SWarner Losh <para>Programs often accidentally depend on <quote>uninitialized</quote> 3548*c43cad87SWarner Losh memory actually being filled with zero bytes. Junk filling 3549*c43cad87SWarner Losh (see the <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link> 3550*c43cad87SWarner Losh option) tends to expose such bugs in the form of obviously incorrect 3551*c43cad87SWarner Losh results and/or coredumps. Conversely, zero 3552*c43cad87SWarner Losh filling (see the <link 3553*c43cad87SWarner Losh linkend="opt.zero"><mallctl>opt.zero</mallctl></link> option) eliminates 3554*c43cad87SWarner Losh the symptoms of such bugs. Between these two options, it is usually 3555*c43cad87SWarner Losh possible to quickly detect, diagnose, and eliminate such bugs.</para> 3556*c43cad87SWarner Losh 3557*c43cad87SWarner Losh <para>This implementation does not provide much detail about the problems 3558*c43cad87SWarner Losh it detects, because the performance impact for storing such information 3559*c43cad87SWarner Losh would be prohibitive.</para> 3560*c43cad87SWarner Losh </refsect1> 3561*c43cad87SWarner Losh <refsect1 id="diagnostic_messages"> 3562*c43cad87SWarner Losh <title>DIAGNOSTIC MESSAGES</title> 3563*c43cad87SWarner Losh <para>If any of the memory allocation/deallocation functions detect an 3564*c43cad87SWarner Losh error or warning condition, a message will be printed to file descriptor 3565*c43cad87SWarner Losh <constant>STDERR_FILENO</constant>. Errors will result in the process 3566*c43cad87SWarner Losh dumping core. If the <link 3567*c43cad87SWarner Losh linkend="opt.abort"><mallctl>opt.abort</mallctl></link> option is set, most 3568*c43cad87SWarner Losh warnings are treated as errors.</para> 3569*c43cad87SWarner Losh 3570*c43cad87SWarner Losh <para>The <varname>malloc_message</varname> variable allows the programmer 3571*c43cad87SWarner Losh to override the function which emits the text strings forming the errors 3572*c43cad87SWarner Losh and warnings if for some reason the <constant>STDERR_FILENO</constant> file 3573*c43cad87SWarner Losh descriptor is not suitable for this. 3574*c43cad87SWarner Losh <function>malloc_message()</function> takes the 3575*c43cad87SWarner Losh <parameter>cbopaque</parameter> pointer argument that is 3576*c43cad87SWarner Losh <constant>NULL</constant> unless overridden by the arguments in a call to 3577*c43cad87SWarner Losh <function>malloc_stats_print()</function>, followed by a string 3578*c43cad87SWarner Losh pointer. Please note that doing anything which tries to allocate memory in 3579*c43cad87SWarner Losh this function is likely to result in a crash or deadlock.</para> 3580*c43cad87SWarner Losh 3581*c43cad87SWarner Losh <para>All messages are prefixed by 3582*c43cad87SWarner Losh <quote><computeroutput><jemalloc>: </computeroutput></quote>.</para> 3583*c43cad87SWarner Losh </refsect1> 3584*c43cad87SWarner Losh <refsect1 id="return_values"> 3585*c43cad87SWarner Losh <title>RETURN VALUES</title> 3586*c43cad87SWarner Losh <refsect2> 3587*c43cad87SWarner Losh <title>Standard API</title> 3588*c43cad87SWarner Losh <para>The <function>malloc()</function> and 3589*c43cad87SWarner Losh <function>calloc()</function> functions return a pointer to the 3590*c43cad87SWarner Losh allocated memory if successful; otherwise a <constant>NULL</constant> 3591*c43cad87SWarner Losh pointer is returned and <varname>errno</varname> is set to 3592*c43cad87SWarner Losh <errorname>ENOMEM</errorname>.</para> 3593*c43cad87SWarner Losh 3594*c43cad87SWarner Losh <para>The <function>posix_memalign()</function> function 3595*c43cad87SWarner Losh returns the value 0 if successful; otherwise it returns an error value. 3596*c43cad87SWarner Losh The <function>posix_memalign()</function> function will fail 3597*c43cad87SWarner Losh if: 3598*c43cad87SWarner Losh <variablelist> 3599*c43cad87SWarner Losh <varlistentry> 3600*c43cad87SWarner Losh <term><errorname>EINVAL</errorname></term> 3601*c43cad87SWarner Losh 3602*c43cad87SWarner Losh <listitem><para>The <parameter>alignment</parameter> parameter is 3603*c43cad87SWarner Losh not a power of 2 at least as large as 3604*c43cad87SWarner Losh <code language="C">sizeof(<type>void *</type>)</code>. 3605*c43cad87SWarner Losh </para></listitem> 3606*c43cad87SWarner Losh </varlistentry> 3607*c43cad87SWarner Losh <varlistentry> 3608*c43cad87SWarner Losh <term><errorname>ENOMEM</errorname></term> 3609*c43cad87SWarner Losh 3610*c43cad87SWarner Losh <listitem><para>Memory allocation error.</para></listitem> 3611*c43cad87SWarner Losh </varlistentry> 3612*c43cad87SWarner Losh </variablelist> 3613*c43cad87SWarner Losh </para> 3614*c43cad87SWarner Losh 3615*c43cad87SWarner Losh <para>The <function>aligned_alloc()</function> function returns 3616*c43cad87SWarner Losh a pointer to the allocated memory if successful; otherwise a 3617*c43cad87SWarner Losh <constant>NULL</constant> pointer is returned and 3618*c43cad87SWarner Losh <varname>errno</varname> is set. The 3619*c43cad87SWarner Losh <function>aligned_alloc()</function> function will fail if: 3620*c43cad87SWarner Losh <variablelist> 3621*c43cad87SWarner Losh <varlistentry> 3622*c43cad87SWarner Losh <term><errorname>EINVAL</errorname></term> 3623*c43cad87SWarner Losh 3624*c43cad87SWarner Losh <listitem><para>The <parameter>alignment</parameter> parameter is 3625*c43cad87SWarner Losh not a power of 2. 3626*c43cad87SWarner Losh </para></listitem> 3627*c43cad87SWarner Losh </varlistentry> 3628*c43cad87SWarner Losh <varlistentry> 3629*c43cad87SWarner Losh <term><errorname>ENOMEM</errorname></term> 3630*c43cad87SWarner Losh 3631*c43cad87SWarner Losh <listitem><para>Memory allocation error.</para></listitem> 3632*c43cad87SWarner Losh </varlistentry> 3633*c43cad87SWarner Losh </variablelist> 3634*c43cad87SWarner Losh </para> 3635*c43cad87SWarner Losh 3636*c43cad87SWarner Losh <para>The <function>realloc()</function> function returns a 3637*c43cad87SWarner Losh pointer, possibly identical to <parameter>ptr</parameter>, to the 3638*c43cad87SWarner Losh allocated memory if successful; otherwise a <constant>NULL</constant> 3639*c43cad87SWarner Losh pointer is returned, and <varname>errno</varname> is set to 3640*c43cad87SWarner Losh <errorname>ENOMEM</errorname> if the error was the result of an 3641*c43cad87SWarner Losh allocation failure. The <function>realloc()</function> 3642*c43cad87SWarner Losh function always leaves the original buffer intact when an error occurs. 3643*c43cad87SWarner Losh </para> 3644*c43cad87SWarner Losh 3645*c43cad87SWarner Losh <para>The <function>free()</function> function returns no 3646*c43cad87SWarner Losh value.</para> 3647*c43cad87SWarner Losh </refsect2> 3648*c43cad87SWarner Losh <refsect2> 3649*c43cad87SWarner Losh <title>Non-standard API</title> 3650*c43cad87SWarner Losh <para>The <function>mallocx()</function> and 3651*c43cad87SWarner Losh <function>rallocx()</function> functions return a pointer to 3652*c43cad87SWarner Losh the allocated memory if successful; otherwise a <constant>NULL</constant> 3653*c43cad87SWarner Losh pointer is returned to indicate insufficient contiguous memory was 3654*c43cad87SWarner Losh available to service the allocation request. </para> 3655*c43cad87SWarner Losh 3656*c43cad87SWarner Losh <para>The <function>xallocx()</function> function returns the 3657*c43cad87SWarner Losh real size of the resulting resized allocation pointed to by 3658*c43cad87SWarner Losh <parameter>ptr</parameter>, which is a value less than 3659*c43cad87SWarner Losh <parameter>size</parameter> if the allocation could not be adequately 3660*c43cad87SWarner Losh grown in place. </para> 3661*c43cad87SWarner Losh 3662*c43cad87SWarner Losh <para>The <function>sallocx()</function> function returns the 3663*c43cad87SWarner Losh real size of the allocation pointed to by <parameter>ptr</parameter>. 3664*c43cad87SWarner Losh </para> 3665*c43cad87SWarner Losh 3666*c43cad87SWarner Losh <para>The <function>nallocx()</function> returns the real size 3667*c43cad87SWarner Losh that would result from a successful equivalent 3668*c43cad87SWarner Losh <function>mallocx()</function> function call, or zero if 3669*c43cad87SWarner Losh insufficient memory is available to perform the size computation. </para> 3670*c43cad87SWarner Losh 3671*c43cad87SWarner Losh <para>The <function>mallctl()</function>, 3672*c43cad87SWarner Losh <function>mallctlnametomib()</function>, and 3673*c43cad87SWarner Losh <function>mallctlbymib()</function> functions return 0 on 3674*c43cad87SWarner Losh success; otherwise they return an error value. The functions will fail 3675*c43cad87SWarner Losh if: 3676*c43cad87SWarner Losh <variablelist> 3677*c43cad87SWarner Losh <varlistentry> 3678*c43cad87SWarner Losh <term><errorname>EINVAL</errorname></term> 3679*c43cad87SWarner Losh 3680*c43cad87SWarner Losh <listitem><para><parameter>newp</parameter> is not 3681*c43cad87SWarner Losh <constant>NULL</constant>, and <parameter>newlen</parameter> is too 3682*c43cad87SWarner Losh large or too small. Alternatively, <parameter>*oldlenp</parameter> 3683*c43cad87SWarner Losh is too large or too small; when it happens, except for a very few 3684*c43cad87SWarner Losh cases explicitly documented otherwise, as much data as possible 3685*c43cad87SWarner Losh are read despite the error, with the amount of data read being 3686*c43cad87SWarner Losh recorded in <parameter>*oldlenp</parameter>.</para></listitem> 3687*c43cad87SWarner Losh </varlistentry> 3688*c43cad87SWarner Losh <varlistentry> 3689*c43cad87SWarner Losh <term><errorname>ENOENT</errorname></term> 3690*c43cad87SWarner Losh 3691*c43cad87SWarner Losh <listitem><para><parameter>name</parameter> or 3692*c43cad87SWarner Losh <parameter>mib</parameter> specifies an unknown/invalid 3693*c43cad87SWarner Losh value.</para></listitem> 3694*c43cad87SWarner Losh </varlistentry> 3695*c43cad87SWarner Losh <varlistentry> 3696*c43cad87SWarner Losh <term><errorname>EPERM</errorname></term> 3697*c43cad87SWarner Losh 3698*c43cad87SWarner Losh <listitem><para>Attempt to read or write void value, or attempt to 3699*c43cad87SWarner Losh write read-only value.</para></listitem> 3700*c43cad87SWarner Losh </varlistentry> 3701*c43cad87SWarner Losh <varlistentry> 3702*c43cad87SWarner Losh <term><errorname>EAGAIN</errorname></term> 3703*c43cad87SWarner Losh 3704*c43cad87SWarner Losh <listitem><para>A memory allocation failure 3705*c43cad87SWarner Losh occurred.</para></listitem> 3706*c43cad87SWarner Losh </varlistentry> 3707*c43cad87SWarner Losh <varlistentry> 3708*c43cad87SWarner Losh <term><errorname>EFAULT</errorname></term> 3709*c43cad87SWarner Losh 3710*c43cad87SWarner Losh <listitem><para>An interface with side effects failed in some way 3711*c43cad87SWarner Losh not directly related to <function>mallctl*()</function> 3712*c43cad87SWarner Losh read/write processing.</para></listitem> 3713*c43cad87SWarner Losh </varlistentry> 3714*c43cad87SWarner Losh </variablelist> 3715*c43cad87SWarner Losh </para> 3716*c43cad87SWarner Losh 3717*c43cad87SWarner Losh <para>The <function>malloc_usable_size()</function> function 3718*c43cad87SWarner Losh returns the usable size of the allocation pointed to by 3719*c43cad87SWarner Losh <parameter>ptr</parameter>. </para> 3720*c43cad87SWarner Losh </refsect2> 3721*c43cad87SWarner Losh </refsect1> 3722*c43cad87SWarner Losh <refsect1 id="environment"> 3723*c43cad87SWarner Losh <title>ENVIRONMENT</title> 3724*c43cad87SWarner Losh <para>The following environment variable affects the execution of the 3725*c43cad87SWarner Losh allocation functions: 3726*c43cad87SWarner Losh <variablelist> 3727*c43cad87SWarner Losh <varlistentry> 3728*c43cad87SWarner Losh <term><envar>MALLOC_CONF</envar></term> 3729*c43cad87SWarner Losh 3730*c43cad87SWarner Losh <listitem><para>If the environment variable 3731*c43cad87SWarner Losh <envar>MALLOC_CONF</envar> is set, the characters it contains 3732*c43cad87SWarner Losh will be interpreted as options.</para></listitem> 3733*c43cad87SWarner Losh </varlistentry> 3734*c43cad87SWarner Losh </variablelist> 3735*c43cad87SWarner Losh </para> 3736*c43cad87SWarner Losh </refsect1> 3737*c43cad87SWarner Losh <refsect1 id="examples"> 3738*c43cad87SWarner Losh <title>EXAMPLES</title> 3739*c43cad87SWarner Losh <para>To dump core whenever a problem occurs: 3740*c43cad87SWarner Losh <screen>ln -s 'abort:true' /etc/malloc.conf</screen> 3741*c43cad87SWarner Losh </para> 3742*c43cad87SWarner Losh <para>To specify in the source that only one arena should be automatically 3743*c43cad87SWarner Losh created: 3744*c43cad87SWarner Losh <programlisting language="C"><![CDATA[ 3745*c43cad87SWarner Loshmalloc_conf = "narenas:1";]]></programlisting></para> 3746*c43cad87SWarner Losh </refsect1> 3747*c43cad87SWarner Losh <refsect1 id="see_also"> 3748*c43cad87SWarner Losh <title>SEE ALSO</title> 3749*c43cad87SWarner Losh <para><citerefentry><refentrytitle>madvise</refentrytitle> 3750*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 3751*c43cad87SWarner Losh <citerefentry><refentrytitle>mmap</refentrytitle> 3752*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 3753*c43cad87SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 3754*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 3755*c43cad87SWarner Losh <citerefentry><refentrytitle>utrace</refentrytitle> 3756*c43cad87SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 3757*c43cad87SWarner Losh <citerefentry><refentrytitle>alloca</refentrytitle> 3758*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry>, 3759*c43cad87SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 3760*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry>, 3761*c43cad87SWarner Losh <citerefentry><refentrytitle>getpagesize</refentrytitle> 3762*c43cad87SWarner Losh <manvolnum>3</manvolnum></citerefentry></para> 3763*c43cad87SWarner Losh </refsect1> 3764*c43cad87SWarner Losh <refsect1 id="standards"> 3765*c43cad87SWarner Losh <title>STANDARDS</title> 3766*c43cad87SWarner Losh <para>The <function>malloc()</function>, 3767*c43cad87SWarner Losh <function>calloc()</function>, 3768*c43cad87SWarner Losh <function>realloc()</function>, and 3769*c43cad87SWarner Losh <function>free()</function> functions conform to ISO/IEC 3770*c43cad87SWarner Losh 9899:1990 (<quote>ISO C90</quote>).</para> 3771*c43cad87SWarner Losh 3772*c43cad87SWarner Losh <para>The <function>posix_memalign()</function> function conforms 3773*c43cad87SWarner Losh to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para> 3774*c43cad87SWarner Losh </refsect1> 3775*c43cad87SWarner Losh <refsect1 id="history"> 3776*c43cad87SWarner Losh <title>HISTORY</title> 3777*c43cad87SWarner Losh <para>The <function>malloc_usable_size()</function> and 3778*c43cad87SWarner Losh <function>posix_memalign()</function> functions first appeared in FreeBSD 3779*c43cad87SWarner Losh 7.0.</para> 3780*c43cad87SWarner Losh 3781*c43cad87SWarner Losh <para>The <function>aligned_alloc()</function>, 3782*c43cad87SWarner Losh <function>malloc_stats_print()</function>, and 3783*c43cad87SWarner Losh <function>mallctl*()</function> functions first appeared in FreeBSD 3784*c43cad87SWarner Losh 10.0.</para> 3785*c43cad87SWarner Losh 3786*c43cad87SWarner Losh <para>The <function>*allocx()</function> functions first appeared in FreeBSD 3787*c43cad87SWarner Losh 11.0.</para> 3788*c43cad87SWarner Losh </refsect1> 3789*c43cad87SWarner Losh</refentry> 3790*c43cad87SWarner Losh||||||| dec341af7695 3791*c43cad87SWarner Losh======= 3792bf6039f0SWarner Losh<?xml version='1.0' encoding='UTF-8'?> 3793bf6039f0SWarner Losh<?xml-stylesheet type="text/xsl" 3794bf6039f0SWarner Losh href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?> 3795bf6039f0SWarner Losh<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3796bf6039f0SWarner Losh "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3797bf6039f0SWarner Losh]> 3798bf6039f0SWarner Losh 3799bf6039f0SWarner Losh<refentry> 3800bf6039f0SWarner Losh <refentryinfo> 3801bf6039f0SWarner Losh <title>User Manual</title> 3802bf6039f0SWarner Losh <productname>jemalloc</productname> 3803bf6039f0SWarner Losh <releaseinfo role="version">@jemalloc_version@</releaseinfo> 3804bf6039f0SWarner Losh <authorgroup> 3805bf6039f0SWarner Losh <author> 3806bf6039f0SWarner Losh <firstname>Jason</firstname> 3807bf6039f0SWarner Losh <surname>Evans</surname> 3808bf6039f0SWarner Losh <personblurb>Author</personblurb> 3809bf6039f0SWarner Losh </author> 3810bf6039f0SWarner Losh </authorgroup> 3811bf6039f0SWarner Losh </refentryinfo> 3812bf6039f0SWarner Losh <refmeta> 3813bf6039f0SWarner Losh <refentrytitle>JEMALLOC</refentrytitle> 3814bf6039f0SWarner Losh <manvolnum>3</manvolnum> 3815bf6039f0SWarner Losh </refmeta> 3816bf6039f0SWarner Losh <refnamediv> 3817bf6039f0SWarner Losh <refdescriptor>jemalloc</refdescriptor> 3818bf6039f0SWarner Losh <refname>jemalloc</refname> 3819bf6039f0SWarner Losh <!-- Each refname causes a man page file to be created. Only if this were 3820bf6039f0SWarner Losh the system malloc(3) implementation would these files be appropriate. 3821bf6039f0SWarner Losh <refname>malloc</refname> 3822bf6039f0SWarner Losh <refname>calloc</refname> 3823bf6039f0SWarner Losh <refname>posix_memalign</refname> 3824bf6039f0SWarner Losh <refname>aligned_alloc</refname> 3825bf6039f0SWarner Losh <refname>realloc</refname> 3826bf6039f0SWarner Losh <refname>free</refname> 3827bf6039f0SWarner Losh <refname>mallocx</refname> 3828bf6039f0SWarner Losh <refname>rallocx</refname> 3829bf6039f0SWarner Losh <refname>xallocx</refname> 3830bf6039f0SWarner Losh <refname>sallocx</refname> 3831bf6039f0SWarner Losh <refname>dallocx</refname> 3832bf6039f0SWarner Losh <refname>sdallocx</refname> 3833bf6039f0SWarner Losh <refname>nallocx</refname> 3834bf6039f0SWarner Losh <refname>mallctl</refname> 3835bf6039f0SWarner Losh <refname>mallctlnametomib</refname> 3836bf6039f0SWarner Losh <refname>mallctlbymib</refname> 3837bf6039f0SWarner Losh <refname>malloc_stats_print</refname> 3838bf6039f0SWarner Losh <refname>malloc_usable_size</refname> 3839bf6039f0SWarner Losh --> 3840bf6039f0SWarner Losh <refpurpose>general purpose memory allocation functions</refpurpose> 3841bf6039f0SWarner Losh </refnamediv> 3842bf6039f0SWarner Losh <refsect1 id="library"> 3843bf6039f0SWarner Losh <title>LIBRARY</title> 3844bf6039f0SWarner Losh <para>This manual describes jemalloc @jemalloc_version@. More information 3845bf6039f0SWarner Losh can be found at the <ulink 3846bf6039f0SWarner Losh url="http://jemalloc.net/">jemalloc website</ulink>.</para> 3847a0dfba69SWarner Losh 3848a0dfba69SWarner Losh <para>The following configuration options are enabled in libc's built-in 3849a0dfba69SWarner Losh jemalloc: <option>--enable-fill</option>, 3850a0dfba69SWarner Losh <option>--enable-lazy-lock</option>, <option>--enable-stats</option>, 3851a0dfba69SWarner Losh <option>--enable-utrace</option>, <option>--enable-xmalloc</option>, and 3852a0dfba69SWarner Losh <option>--with-malloc-conf=abort_conf:false</option>. 3853a0dfba69SWarner Losh Additionally, <option>--enable-debug</option> is enabled in development 3854a0dfba69SWarner Losh versions of FreeBSD (controlled by the 3855a0dfba69SWarner Losh <constant>MK_MALLOC_PRODUCTION</constant> make variable).</para> 3856a0dfba69SWarner Losh 3857bf6039f0SWarner Losh </refsect1> 3858bf6039f0SWarner Losh <refsynopsisdiv> 3859bf6039f0SWarner Losh <title>SYNOPSIS</title> 3860bf6039f0SWarner Losh <funcsynopsis> 3861a0dfba69SWarner Losh <funcsynopsisinfo>#include <<filename class="headerfile">stdlib.h</filename>> 3862a0dfba69SWarner Losh#include <<filename class="headerfile">malloc_np.h</filename>></funcsynopsisinfo> 3863bf6039f0SWarner Losh <refsect2> 3864bf6039f0SWarner Losh <title>Standard API</title> 3865bf6039f0SWarner Losh <funcprototype> 3866bf6039f0SWarner Losh <funcdef>void *<function>malloc</function></funcdef> 3867bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3868bf6039f0SWarner Losh </funcprototype> 3869bf6039f0SWarner Losh <funcprototype> 3870bf6039f0SWarner Losh <funcdef>void *<function>calloc</function></funcdef> 3871bf6039f0SWarner Losh <paramdef>size_t <parameter>number</parameter></paramdef> 3872bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3873bf6039f0SWarner Losh </funcprototype> 3874bf6039f0SWarner Losh <funcprototype> 3875bf6039f0SWarner Losh <funcdef>int <function>posix_memalign</function></funcdef> 3876bf6039f0SWarner Losh <paramdef>void **<parameter>ptr</parameter></paramdef> 3877bf6039f0SWarner Losh <paramdef>size_t <parameter>alignment</parameter></paramdef> 3878bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3879bf6039f0SWarner Losh </funcprototype> 3880bf6039f0SWarner Losh <funcprototype> 3881bf6039f0SWarner Losh <funcdef>void *<function>aligned_alloc</function></funcdef> 3882bf6039f0SWarner Losh <paramdef>size_t <parameter>alignment</parameter></paramdef> 3883bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3884bf6039f0SWarner Losh </funcprototype> 3885bf6039f0SWarner Losh <funcprototype> 3886bf6039f0SWarner Losh <funcdef>void *<function>realloc</function></funcdef> 3887bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3888bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3889bf6039f0SWarner Losh </funcprototype> 3890bf6039f0SWarner Losh <funcprototype> 3891bf6039f0SWarner Losh <funcdef>void <function>free</function></funcdef> 3892bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3893bf6039f0SWarner Losh </funcprototype> 3894bf6039f0SWarner Losh </refsect2> 3895bf6039f0SWarner Losh <refsect2> 3896bf6039f0SWarner Losh <title>Non-standard API</title> 3897bf6039f0SWarner Losh <funcprototype> 3898bf6039f0SWarner Losh <funcdef>void *<function>mallocx</function></funcdef> 3899bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3900bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3901bf6039f0SWarner Losh </funcprototype> 3902bf6039f0SWarner Losh <funcprototype> 3903bf6039f0SWarner Losh <funcdef>void *<function>rallocx</function></funcdef> 3904bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3905bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3906bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3907bf6039f0SWarner Losh </funcprototype> 3908bf6039f0SWarner Losh <funcprototype> 3909bf6039f0SWarner Losh <funcdef>size_t <function>xallocx</function></funcdef> 3910bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3911bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3912bf6039f0SWarner Losh <paramdef>size_t <parameter>extra</parameter></paramdef> 3913bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3914bf6039f0SWarner Losh </funcprototype> 3915bf6039f0SWarner Losh <funcprototype> 3916bf6039f0SWarner Losh <funcdef>size_t <function>sallocx</function></funcdef> 3917bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3918bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3919bf6039f0SWarner Losh </funcprototype> 3920bf6039f0SWarner Losh <funcprototype> 3921bf6039f0SWarner Losh <funcdef>void <function>dallocx</function></funcdef> 3922bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3923bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3924bf6039f0SWarner Losh </funcprototype> 3925bf6039f0SWarner Losh <funcprototype> 3926bf6039f0SWarner Losh <funcdef>void <function>sdallocx</function></funcdef> 3927bf6039f0SWarner Losh <paramdef>void *<parameter>ptr</parameter></paramdef> 3928bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3929bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3930bf6039f0SWarner Losh </funcprototype> 3931bf6039f0SWarner Losh <funcprototype> 3932bf6039f0SWarner Losh <funcdef>size_t <function>nallocx</function></funcdef> 3933bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 3934bf6039f0SWarner Losh <paramdef>int <parameter>flags</parameter></paramdef> 3935bf6039f0SWarner Losh </funcprototype> 3936bf6039f0SWarner Losh <funcprototype> 3937bf6039f0SWarner Losh <funcdef>int <function>mallctl</function></funcdef> 3938bf6039f0SWarner Losh <paramdef>const char *<parameter>name</parameter></paramdef> 3939bf6039f0SWarner Losh <paramdef>void *<parameter>oldp</parameter></paramdef> 3940bf6039f0SWarner Losh <paramdef>size_t *<parameter>oldlenp</parameter></paramdef> 3941bf6039f0SWarner Losh <paramdef>void *<parameter>newp</parameter></paramdef> 3942bf6039f0SWarner Losh <paramdef>size_t <parameter>newlen</parameter></paramdef> 3943bf6039f0SWarner Losh </funcprototype> 3944bf6039f0SWarner Losh <funcprototype> 3945bf6039f0SWarner Losh <funcdef>int <function>mallctlnametomib</function></funcdef> 3946bf6039f0SWarner Losh <paramdef>const char *<parameter>name</parameter></paramdef> 3947bf6039f0SWarner Losh <paramdef>size_t *<parameter>mibp</parameter></paramdef> 3948bf6039f0SWarner Losh <paramdef>size_t *<parameter>miblenp</parameter></paramdef> 3949bf6039f0SWarner Losh </funcprototype> 3950bf6039f0SWarner Losh <funcprototype> 3951bf6039f0SWarner Losh <funcdef>int <function>mallctlbymib</function></funcdef> 3952bf6039f0SWarner Losh <paramdef>const size_t *<parameter>mib</parameter></paramdef> 3953bf6039f0SWarner Losh <paramdef>size_t <parameter>miblen</parameter></paramdef> 3954bf6039f0SWarner Losh <paramdef>void *<parameter>oldp</parameter></paramdef> 3955bf6039f0SWarner Losh <paramdef>size_t *<parameter>oldlenp</parameter></paramdef> 3956bf6039f0SWarner Losh <paramdef>void *<parameter>newp</parameter></paramdef> 3957bf6039f0SWarner Losh <paramdef>size_t <parameter>newlen</parameter></paramdef> 3958bf6039f0SWarner Losh </funcprototype> 3959bf6039f0SWarner Losh <funcprototype> 3960bf6039f0SWarner Losh <funcdef>void <function>malloc_stats_print</function></funcdef> 3961bf6039f0SWarner Losh <paramdef>void <parameter>(*write_cb)</parameter> 3962bf6039f0SWarner Losh <funcparams>void *, const char *</funcparams> 3963bf6039f0SWarner Losh </paramdef> 3964bf6039f0SWarner Losh <paramdef>void *<parameter>cbopaque</parameter></paramdef> 3965bf6039f0SWarner Losh <paramdef>const char *<parameter>opts</parameter></paramdef> 3966bf6039f0SWarner Losh </funcprototype> 3967bf6039f0SWarner Losh <funcprototype> 3968bf6039f0SWarner Losh <funcdef>size_t <function>malloc_usable_size</function></funcdef> 3969bf6039f0SWarner Losh <paramdef>const void *<parameter>ptr</parameter></paramdef> 3970bf6039f0SWarner Losh </funcprototype> 3971bf6039f0SWarner Losh <funcprototype> 3972bf6039f0SWarner Losh <funcdef>void <function>(*malloc_message)</function></funcdef> 3973bf6039f0SWarner Losh <paramdef>void *<parameter>cbopaque</parameter></paramdef> 3974bf6039f0SWarner Losh <paramdef>const char *<parameter>s</parameter></paramdef> 3975bf6039f0SWarner Losh </funcprototype> 3976bf6039f0SWarner Losh <para><type>const char *</type><varname>malloc_conf</varname>;</para> 3977bf6039f0SWarner Losh </refsect2> 3978bf6039f0SWarner Losh </funcsynopsis> 3979bf6039f0SWarner Losh </refsynopsisdiv> 3980bf6039f0SWarner Losh <refsect1 id="description"> 3981bf6039f0SWarner Losh <title>DESCRIPTION</title> 3982bf6039f0SWarner Losh <refsect2> 3983bf6039f0SWarner Losh <title>Standard API</title> 3984bf6039f0SWarner Losh 3985bf6039f0SWarner Losh <para>The <function>malloc()</function> function allocates 3986bf6039f0SWarner Losh <parameter>size</parameter> bytes of uninitialized memory. The allocated 3987bf6039f0SWarner Losh space is suitably aligned (after possible pointer coercion) for storage 3988bf6039f0SWarner Losh of any type of object.</para> 3989bf6039f0SWarner Losh 3990bf6039f0SWarner Losh <para>The <function>calloc()</function> function allocates 3991bf6039f0SWarner Losh space for <parameter>number</parameter> objects, each 3992bf6039f0SWarner Losh <parameter>size</parameter> bytes in length. The result is identical to 3993bf6039f0SWarner Losh calling <function>malloc()</function> with an argument of 3994bf6039f0SWarner Losh <parameter>number</parameter> * <parameter>size</parameter>, with the 3995bf6039f0SWarner Losh exception that the allocated memory is explicitly initialized to zero 3996bf6039f0SWarner Losh bytes.</para> 3997bf6039f0SWarner Losh 3998bf6039f0SWarner Losh <para>The <function>posix_memalign()</function> function 3999bf6039f0SWarner Losh allocates <parameter>size</parameter> bytes of memory such that the 4000bf6039f0SWarner Losh allocation's base address is a multiple of 4001bf6039f0SWarner Losh <parameter>alignment</parameter>, and returns the allocation in the value 4002bf6039f0SWarner Losh pointed to by <parameter>ptr</parameter>. The requested 4003bf6039f0SWarner Losh <parameter>alignment</parameter> must be a power of 2 at least as large as 4004bf6039f0SWarner Losh <code language="C">sizeof(<type>void *</type>)</code>.</para> 4005bf6039f0SWarner Losh 4006bf6039f0SWarner Losh <para>The <function>aligned_alloc()</function> function 4007bf6039f0SWarner Losh allocates <parameter>size</parameter> bytes of memory such that the 4008bf6039f0SWarner Losh allocation's base address is a multiple of 4009bf6039f0SWarner Losh <parameter>alignment</parameter>. The requested 4010bf6039f0SWarner Losh <parameter>alignment</parameter> must be a power of 2. Behavior is 4011bf6039f0SWarner Losh undefined if <parameter>size</parameter> is not an integral multiple of 4012bf6039f0SWarner Losh <parameter>alignment</parameter>.</para> 4013bf6039f0SWarner Losh 4014bf6039f0SWarner Losh <para>The <function>realloc()</function> function changes the 4015bf6039f0SWarner Losh size of the previously allocated memory referenced by 4016bf6039f0SWarner Losh <parameter>ptr</parameter> to <parameter>size</parameter> bytes. The 4017bf6039f0SWarner Losh contents of the memory are unchanged up to the lesser of the new and old 4018bf6039f0SWarner Losh sizes. If the new size is larger, the contents of the newly allocated 4019bf6039f0SWarner Losh portion of the memory are undefined. Upon success, the memory referenced 4020bf6039f0SWarner Losh by <parameter>ptr</parameter> is freed and a pointer to the newly 4021bf6039f0SWarner Losh allocated memory is returned. Note that 4022bf6039f0SWarner Losh <function>realloc()</function> may move the memory allocation, 4023bf6039f0SWarner Losh resulting in a different return value than <parameter>ptr</parameter>. 4024bf6039f0SWarner Losh If <parameter>ptr</parameter> is <constant>NULL</constant>, the 4025bf6039f0SWarner Losh <function>realloc()</function> function behaves identically to 4026bf6039f0SWarner Losh <function>malloc()</function> for the specified size.</para> 4027bf6039f0SWarner Losh 4028bf6039f0SWarner Losh <para>The <function>free()</function> function causes the 4029bf6039f0SWarner Losh allocated memory referenced by <parameter>ptr</parameter> to be made 4030bf6039f0SWarner Losh available for future allocations. If <parameter>ptr</parameter> is 4031bf6039f0SWarner Losh <constant>NULL</constant>, no action occurs.</para> 4032bf6039f0SWarner Losh </refsect2> 4033bf6039f0SWarner Losh <refsect2> 4034bf6039f0SWarner Losh <title>Non-standard API</title> 4035bf6039f0SWarner Losh <para>The <function>mallocx()</function>, 4036bf6039f0SWarner Losh <function>rallocx()</function>, 4037bf6039f0SWarner Losh <function>xallocx()</function>, 4038bf6039f0SWarner Losh <function>sallocx()</function>, 4039bf6039f0SWarner Losh <function>dallocx()</function>, 4040bf6039f0SWarner Losh <function>sdallocx()</function>, and 4041bf6039f0SWarner Losh <function>nallocx()</function> functions all have a 4042bf6039f0SWarner Losh <parameter>flags</parameter> argument that can be used to specify 4043bf6039f0SWarner Losh options. The functions only check the options that are contextually 4044bf6039f0SWarner Losh relevant. Use bitwise or (<code language="C">|</code>) operations to 4045bf6039f0SWarner Losh specify one or more of the following: 4046bf6039f0SWarner Losh <variablelist> 4047bf6039f0SWarner Losh <varlistentry id="MALLOCX_LG_ALIGN"> 4048bf6039f0SWarner Losh <term><constant>MALLOCX_LG_ALIGN(<parameter>la</parameter>) 4049bf6039f0SWarner Losh </constant></term> 4050bf6039f0SWarner Losh 4051bf6039f0SWarner Losh <listitem><para>Align the memory allocation to start at an address 4052bf6039f0SWarner Losh that is a multiple of <code language="C">(1 << 4053bf6039f0SWarner Losh <parameter>la</parameter>)</code>. This macro does not validate 4054bf6039f0SWarner Losh that <parameter>la</parameter> is within the valid 4055bf6039f0SWarner Losh range.</para></listitem> 4056bf6039f0SWarner Losh </varlistentry> 4057bf6039f0SWarner Losh <varlistentry id="MALLOCX_ALIGN"> 4058bf6039f0SWarner Losh <term><constant>MALLOCX_ALIGN(<parameter>a</parameter>) 4059bf6039f0SWarner Losh </constant></term> 4060bf6039f0SWarner Losh 4061bf6039f0SWarner Losh <listitem><para>Align the memory allocation to start at an address 4062bf6039f0SWarner Losh that is a multiple of <parameter>a</parameter>, where 4063bf6039f0SWarner Losh <parameter>a</parameter> is a power of two. This macro does not 4064bf6039f0SWarner Losh validate that <parameter>a</parameter> is a power of 2. 4065bf6039f0SWarner Losh </para></listitem> 4066bf6039f0SWarner Losh </varlistentry> 4067bf6039f0SWarner Losh <varlistentry id="MALLOCX_ZERO"> 4068bf6039f0SWarner Losh <term><constant>MALLOCX_ZERO</constant></term> 4069bf6039f0SWarner Losh 4070bf6039f0SWarner Losh <listitem><para>Initialize newly allocated memory to contain zero 4071bf6039f0SWarner Losh bytes. In the growing reallocation case, the real size prior to 4072bf6039f0SWarner Losh reallocation defines the boundary between untouched bytes and those 4073bf6039f0SWarner Losh that are initialized to contain zero bytes. If this macro is 4074bf6039f0SWarner Losh absent, newly allocated memory is uninitialized.</para></listitem> 4075bf6039f0SWarner Losh </varlistentry> 4076bf6039f0SWarner Losh <varlistentry id="MALLOCX_TCACHE"> 4077bf6039f0SWarner Losh <term><constant>MALLOCX_TCACHE(<parameter>tc</parameter>) 4078bf6039f0SWarner Losh </constant></term> 4079bf6039f0SWarner Losh 4080bf6039f0SWarner Losh <listitem><para>Use the thread-specific cache (tcache) specified by 4081bf6039f0SWarner Losh the identifier <parameter>tc</parameter>, which must have been 4082bf6039f0SWarner Losh acquired via the <link 4083bf6039f0SWarner Losh linkend="tcache.create"><mallctl>tcache.create</mallctl></link> 4084bf6039f0SWarner Losh mallctl. This macro does not validate that 4085bf6039f0SWarner Losh <parameter>tc</parameter> specifies a valid 4086bf6039f0SWarner Losh identifier.</para></listitem> 4087bf6039f0SWarner Losh </varlistentry> 4088bf6039f0SWarner Losh <varlistentry id="MALLOC_TCACHE_NONE"> 4089bf6039f0SWarner Losh <term><constant>MALLOCX_TCACHE_NONE</constant></term> 4090bf6039f0SWarner Losh 4091bf6039f0SWarner Losh <listitem><para>Do not use a thread-specific cache (tcache). Unless 4092bf6039f0SWarner Losh <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant> or 4093bf6039f0SWarner Losh <constant>MALLOCX_TCACHE_NONE</constant> is specified, an 4094bf6039f0SWarner Losh automatically managed tcache will be used under many circumstances. 4095bf6039f0SWarner Losh This macro cannot be used in the same <parameter>flags</parameter> 4096bf6039f0SWarner Losh argument as 4097bf6039f0SWarner Losh <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant>.</para></listitem> 4098bf6039f0SWarner Losh </varlistentry> 4099bf6039f0SWarner Losh <varlistentry id="MALLOCX_ARENA"> 4100bf6039f0SWarner Losh <term><constant>MALLOCX_ARENA(<parameter>a</parameter>) 4101bf6039f0SWarner Losh </constant></term> 4102bf6039f0SWarner Losh 4103bf6039f0SWarner Losh <listitem><para>Use the arena specified by the index 4104bf6039f0SWarner Losh <parameter>a</parameter>. This macro has no effect for regions that 4105bf6039f0SWarner Losh were allocated via an arena other than the one specified. This 4106bf6039f0SWarner Losh macro does not validate that <parameter>a</parameter> specifies an 4107bf6039f0SWarner Losh arena index in the valid range.</para></listitem> 4108bf6039f0SWarner Losh </varlistentry> 4109bf6039f0SWarner Losh </variablelist> 4110bf6039f0SWarner Losh </para> 4111bf6039f0SWarner Losh 4112bf6039f0SWarner Losh <para>The <function>mallocx()</function> function allocates at 4113bf6039f0SWarner Losh least <parameter>size</parameter> bytes of memory, and returns a pointer 4114bf6039f0SWarner Losh to the base address of the allocation. Behavior is undefined if 4115bf6039f0SWarner Losh <parameter>size</parameter> is <constant>0</constant>.</para> 4116bf6039f0SWarner Losh 4117bf6039f0SWarner Losh <para>The <function>rallocx()</function> function resizes the 4118bf6039f0SWarner Losh allocation at <parameter>ptr</parameter> to be at least 4119bf6039f0SWarner Losh <parameter>size</parameter> bytes, and returns a pointer to the base 4120bf6039f0SWarner Losh address of the resulting allocation, which may or may not have moved from 4121bf6039f0SWarner Losh its original location. Behavior is undefined if 4122bf6039f0SWarner Losh <parameter>size</parameter> is <constant>0</constant>.</para> 4123bf6039f0SWarner Losh 4124bf6039f0SWarner Losh <para>The <function>xallocx()</function> function resizes the 4125bf6039f0SWarner Losh allocation at <parameter>ptr</parameter> in place to be at least 4126bf6039f0SWarner Losh <parameter>size</parameter> bytes, and returns the real size of the 4127bf6039f0SWarner Losh allocation. If <parameter>extra</parameter> is non-zero, an attempt is 4128bf6039f0SWarner Losh made to resize the allocation to be at least <code 4129bf6039f0SWarner Losh language="C">(<parameter>size</parameter> + 4130bf6039f0SWarner Losh <parameter>extra</parameter>)</code> bytes, though inability to allocate 4131bf6039f0SWarner Losh the extra byte(s) will not by itself result in failure to resize. 4132bf6039f0SWarner Losh Behavior is undefined if <parameter>size</parameter> is 4133bf6039f0SWarner Losh <constant>0</constant>, or if <code 4134bf6039f0SWarner Losh language="C">(<parameter>size</parameter> + <parameter>extra</parameter> 4135bf6039f0SWarner Losh > <constant>SIZE_T_MAX</constant>)</code>.</para> 4136bf6039f0SWarner Losh 4137bf6039f0SWarner Losh <para>The <function>sallocx()</function> function returns the 4138bf6039f0SWarner Losh real size of the allocation at <parameter>ptr</parameter>.</para> 4139bf6039f0SWarner Losh 4140bf6039f0SWarner Losh <para>The <function>dallocx()</function> function causes the 4141bf6039f0SWarner Losh memory referenced by <parameter>ptr</parameter> to be made available for 4142bf6039f0SWarner Losh future allocations.</para> 4143bf6039f0SWarner Losh 4144bf6039f0SWarner Losh <para>The <function>sdallocx()</function> function is an 4145bf6039f0SWarner Losh extension of <function>dallocx()</function> with a 4146bf6039f0SWarner Losh <parameter>size</parameter> parameter to allow the caller to pass in the 4147bf6039f0SWarner Losh allocation size as an optimization. The minimum valid input size is the 4148bf6039f0SWarner Losh original requested size of the allocation, and the maximum valid input 4149bf6039f0SWarner Losh size is the corresponding value returned by 4150bf6039f0SWarner Losh <function>nallocx()</function> or 4151bf6039f0SWarner Losh <function>sallocx()</function>.</para> 4152bf6039f0SWarner Losh 4153bf6039f0SWarner Losh <para>The <function>nallocx()</function> function allocates no 4154bf6039f0SWarner Losh memory, but it performs the same size computation as the 4155bf6039f0SWarner Losh <function>mallocx()</function> function, and returns the real 4156bf6039f0SWarner Losh size of the allocation that would result from the equivalent 4157bf6039f0SWarner Losh <function>mallocx()</function> function call, or 4158bf6039f0SWarner Losh <constant>0</constant> if the inputs exceed the maximum supported size 4159bf6039f0SWarner Losh class and/or alignment. Behavior is undefined if 4160bf6039f0SWarner Losh <parameter>size</parameter> is <constant>0</constant>.</para> 4161bf6039f0SWarner Losh 4162bf6039f0SWarner Losh <para>The <function>mallctl()</function> function provides a 4163bf6039f0SWarner Losh general interface for introspecting the memory allocator, as well as 4164bf6039f0SWarner Losh setting modifiable parameters and triggering actions. The 4165bf6039f0SWarner Losh period-separated <parameter>name</parameter> argument specifies a 4166bf6039f0SWarner Losh location in a tree-structured namespace; see the <xref 4167bf6039f0SWarner Losh linkend="mallctl_namespace" xrefstyle="template:%t"/> section for 4168bf6039f0SWarner Losh documentation on the tree contents. To read a value, pass a pointer via 4169bf6039f0SWarner Losh <parameter>oldp</parameter> to adequate space to contain the value, and a 4170bf6039f0SWarner Losh pointer to its length via <parameter>oldlenp</parameter>; otherwise pass 4171bf6039f0SWarner Losh <constant>NULL</constant> and <constant>NULL</constant>. Similarly, to 4172bf6039f0SWarner Losh write a value, pass a pointer to the value via 4173bf6039f0SWarner Losh <parameter>newp</parameter>, and its length via 4174bf6039f0SWarner Losh <parameter>newlen</parameter>; otherwise pass <constant>NULL</constant> 4175bf6039f0SWarner Losh and <constant>0</constant>.</para> 4176bf6039f0SWarner Losh 4177bf6039f0SWarner Losh <para>The <function>mallctlnametomib()</function> function 4178bf6039f0SWarner Losh provides a way to avoid repeated name lookups for applications that 4179bf6039f0SWarner Losh repeatedly query the same portion of the namespace, by translating a name 4180bf6039f0SWarner Losh to a <quote>Management Information Base</quote> (MIB) that can be passed 4181bf6039f0SWarner Losh repeatedly to <function>mallctlbymib()</function>. Upon 4182bf6039f0SWarner Losh successful return from <function>mallctlnametomib()</function>, 4183bf6039f0SWarner Losh <parameter>mibp</parameter> contains an array of 4184bf6039f0SWarner Losh <parameter>*miblenp</parameter> integers, where 4185bf6039f0SWarner Losh <parameter>*miblenp</parameter> is the lesser of the number of components 4186bf6039f0SWarner Losh in <parameter>name</parameter> and the input value of 4187bf6039f0SWarner Losh <parameter>*miblenp</parameter>. Thus it is possible to pass a 4188bf6039f0SWarner Losh <parameter>*miblenp</parameter> that is smaller than the number of 4189bf6039f0SWarner Losh period-separated name components, which results in a partial MIB that can 4190bf6039f0SWarner Losh be used as the basis for constructing a complete MIB. For name 4191bf6039f0SWarner Losh components that are integers (e.g. the 2 in 4192bf6039f0SWarner Losh <link 4193bf6039f0SWarner Losh linkend="arenas.bin.i.size"><mallctl>arenas.bin.2.size</mallctl></link>), 4194bf6039f0SWarner Losh the corresponding MIB component will always be that integer. Therefore, 4195bf6039f0SWarner Losh it is legitimate to construct code like the following: <programlisting 4196bf6039f0SWarner Losh language="C"><![CDATA[ 4197bf6039f0SWarner Loshunsigned nbins, i; 4198bf6039f0SWarner Loshsize_t mib[4]; 4199bf6039f0SWarner Loshsize_t len, miblen; 4200bf6039f0SWarner Losh 4201bf6039f0SWarner Loshlen = sizeof(nbins); 4202bf6039f0SWarner Loshmallctl("arenas.nbins", &nbins, &len, NULL, 0); 4203bf6039f0SWarner Losh 4204bf6039f0SWarner Loshmiblen = 4; 4205bf6039f0SWarner Loshmallctlnametomib("arenas.bin.0.size", mib, &miblen); 4206bf6039f0SWarner Loshfor (i = 0; i < nbins; i++) { 4207bf6039f0SWarner Losh size_t bin_size; 4208bf6039f0SWarner Losh 4209bf6039f0SWarner Losh mib[2] = i; 4210bf6039f0SWarner Losh len = sizeof(bin_size); 4211bf6039f0SWarner Losh mallctlbymib(mib, miblen, (void *)&bin_size, &len, NULL, 0); 4212bf6039f0SWarner Losh /* Do something with bin_size... */ 4213bf6039f0SWarner Losh}]]></programlisting></para> 4214bf6039f0SWarner Losh 4215bf6039f0SWarner Losh <varlistentry id="malloc_stats_print_opts"> 4216bf6039f0SWarner Losh </varlistentry> 4217bf6039f0SWarner Losh <para>The <function>malloc_stats_print()</function> function writes 4218bf6039f0SWarner Losh summary statistics via the <parameter>write_cb</parameter> callback 4219bf6039f0SWarner Losh function pointer and <parameter>cbopaque</parameter> data passed to 4220bf6039f0SWarner Losh <parameter>write_cb</parameter>, or <function>malloc_message()</function> 4221bf6039f0SWarner Losh if <parameter>write_cb</parameter> is <constant>NULL</constant>. The 4222bf6039f0SWarner Losh statistics are presented in human-readable form unless <quote>J</quote> is 4223bf6039f0SWarner Losh specified as a character within the <parameter>opts</parameter> string, in 4224bf6039f0SWarner Losh which case the statistics are presented in <ulink 4225bf6039f0SWarner Losh url="http://www.json.org/">JSON format</ulink>. This function can be 4226bf6039f0SWarner Losh called repeatedly. General information that never changes during 4227bf6039f0SWarner Losh execution can be omitted by specifying <quote>g</quote> as a character 4228bf6039f0SWarner Losh within the <parameter>opts</parameter> string. Note that 4229bf6039f0SWarner Losh <function>malloc_stats_print()</function> uses the 4230bf6039f0SWarner Losh <function>mallctl*()</function> functions internally, so inconsistent 4231bf6039f0SWarner Losh statistics can be reported if multiple threads use these functions 4232bf6039f0SWarner Losh simultaneously. If <option>--enable-stats</option> is specified during 4233bf6039f0SWarner Losh configuration, <quote>m</quote>, <quote>d</quote>, and <quote>a</quote> 4234bf6039f0SWarner Losh can be specified to omit merged arena, destroyed merged arena, and per 4235bf6039f0SWarner Losh arena statistics, respectively; <quote>b</quote> and <quote>l</quote> can 4236bf6039f0SWarner Losh be specified to omit per size class statistics for bins and large objects, 4237bf6039f0SWarner Losh respectively; <quote>x</quote> can be specified to omit all mutex 4238bf6039f0SWarner Losh statistics; <quote>e</quote> can be used to omit extent statistics. 4239bf6039f0SWarner Losh Unrecognized characters are silently ignored. Note that thread caching 4240bf6039f0SWarner Losh may prevent some statistics from being completely up to date, since extra 4241bf6039f0SWarner Losh locking would be required to merge counters that track thread cache 4242bf6039f0SWarner Losh operations.</para> 4243bf6039f0SWarner Losh 4244bf6039f0SWarner Losh <para>The <function>malloc_usable_size()</function> function 4245bf6039f0SWarner Losh returns the usable size of the allocation pointed to by 4246bf6039f0SWarner Losh <parameter>ptr</parameter>. The return value may be larger than the size 4247bf6039f0SWarner Losh that was requested during allocation. The 4248bf6039f0SWarner Losh <function>malloc_usable_size()</function> function is not a 4249bf6039f0SWarner Losh mechanism for in-place <function>realloc()</function>; rather 4250bf6039f0SWarner Losh it is provided solely as a tool for introspection purposes. Any 4251bf6039f0SWarner Losh discrepancy between the requested allocation size and the size reported 4252bf6039f0SWarner Losh by <function>malloc_usable_size()</function> should not be 4253bf6039f0SWarner Losh depended on, since such behavior is entirely implementation-dependent. 4254bf6039f0SWarner Losh </para> 4255bf6039f0SWarner Losh </refsect2> 4256bf6039f0SWarner Losh </refsect1> 4257bf6039f0SWarner Losh <refsect1 id="tuning"> 4258bf6039f0SWarner Losh <title>TUNING</title> 4259bf6039f0SWarner Losh <para>Once, when the first call is made to one of the memory allocation 4260bf6039f0SWarner Losh routines, the allocator initializes its internals based in part on various 4261bf6039f0SWarner Losh options that can be specified at compile- or run-time.</para> 4262bf6039f0SWarner Losh 4263bf6039f0SWarner Losh <para>The string specified via <option>--with-malloc-conf</option>, the 4264bf6039f0SWarner Losh string pointed to by the global variable <varname>malloc_conf</varname>, the 4265bf6039f0SWarner Losh <quote>name</quote> of the file referenced by the symbolic link named 4266bf6039f0SWarner Losh <filename class="symlink">/etc/malloc.conf</filename>, and the value of the 4267bf6039f0SWarner Losh environment variable <envar>MALLOC_CONF</envar>, will be interpreted, in 4268bf6039f0SWarner Losh that order, from left to right as options. Note that 4269bf6039f0SWarner Losh <varname>malloc_conf</varname> may be read before 4270bf6039f0SWarner Losh <function>main()</function> is entered, so the declaration of 4271bf6039f0SWarner Losh <varname>malloc_conf</varname> should specify an initializer that contains 4272bf6039f0SWarner Losh the final value to be read by jemalloc. <option>--with-malloc-conf</option> 4273bf6039f0SWarner Losh and <varname>malloc_conf</varname> are compile-time mechanisms, whereas 4274bf6039f0SWarner Losh <filename class="symlink">/etc/malloc.conf</filename> and 4275bf6039f0SWarner Losh <envar>MALLOC_CONF</envar> can be safely set any time prior to program 4276bf6039f0SWarner Losh invocation.</para> 4277bf6039f0SWarner Losh 4278bf6039f0SWarner Losh <para>An options string is a comma-separated list of option:value pairs. 4279bf6039f0SWarner Losh There is one key corresponding to each <link 4280bf6039f0SWarner Losh linkend="opt.abort"><mallctl>opt.*</mallctl></link> mallctl (see the <xref 4281bf6039f0SWarner Losh linkend="mallctl_namespace" xrefstyle="template:%t"/> section for options 4282bf6039f0SWarner Losh documentation). For example, <literal>abort:true,narenas:1</literal> sets 4283bf6039f0SWarner Losh the <link linkend="opt.abort"><mallctl>opt.abort</mallctl></link> and <link 4284bf6039f0SWarner Losh linkend="opt.narenas"><mallctl>opt.narenas</mallctl></link> options. Some 4285bf6039f0SWarner Losh options have boolean values (true/false), others have integer values (base 4286bf6039f0SWarner Losh 8, 10, or 16, depending on prefix), and yet others have raw string 4287bf6039f0SWarner Losh values.</para> 4288bf6039f0SWarner Losh </refsect1> 4289bf6039f0SWarner Losh <refsect1 id="implementation_notes"> 4290bf6039f0SWarner Losh <title>IMPLEMENTATION NOTES</title> 4291bf6039f0SWarner Losh <para>Traditionally, allocators have used 4292bf6039f0SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 4293bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> to obtain memory, which is 4294bf6039f0SWarner Losh suboptimal for several reasons, including race conditions, increased 4295bf6039f0SWarner Losh fragmentation, and artificial limitations on maximum usable memory. If 4296bf6039f0SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 4297bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> is supported by the operating 4298bf6039f0SWarner Losh system, this allocator uses both 4299bf6039f0SWarner Losh <citerefentry><refentrytitle>mmap</refentrytitle> 4300bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> and 4301bf6039f0SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 4302bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>, in that order of preference; 4303bf6039f0SWarner Losh otherwise only <citerefentry><refentrytitle>mmap</refentrytitle> 4304bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> is used.</para> 4305bf6039f0SWarner Losh 4306bf6039f0SWarner Losh <para>This allocator uses multiple arenas in order to reduce lock 4307bf6039f0SWarner Losh contention for threaded programs on multi-processor systems. This works 4308bf6039f0SWarner Losh well with regard to threading scalability, but incurs some costs. There is 4309bf6039f0SWarner Losh a small fixed per-arena overhead, and additionally, arenas manage memory 4310bf6039f0SWarner Losh completely independently of each other, which means a small fixed increase 4311bf6039f0SWarner Losh in overall memory fragmentation. These overheads are not generally an 4312bf6039f0SWarner Losh issue, given the number of arenas normally used. Note that using 4313bf6039f0SWarner Losh substantially more arenas than the default is not likely to improve 4314bf6039f0SWarner Losh performance, mainly due to reduced cache performance. However, it may make 4315bf6039f0SWarner Losh sense to reduce the number of arenas if an application does not make much 4316bf6039f0SWarner Losh use of the allocation functions.</para> 4317bf6039f0SWarner Losh 4318bf6039f0SWarner Losh <para>In addition to multiple arenas, this allocator supports 4319bf6039f0SWarner Losh thread-specific caching, in order to make it possible to completely avoid 4320bf6039f0SWarner Losh synchronization for most allocation requests. Such caching allows very fast 4321bf6039f0SWarner Losh allocation in the common case, but it increases memory usage and 4322bf6039f0SWarner Losh fragmentation, since a bounded number of objects can remain allocated in 4323bf6039f0SWarner Losh each thread cache.</para> 4324bf6039f0SWarner Losh 4325bf6039f0SWarner Losh <para>Memory is conceptually broken into extents. Extents are always 4326bf6039f0SWarner Losh aligned to multiples of the page size. This alignment makes it possible to 4327bf6039f0SWarner Losh find metadata for user objects quickly. User objects are broken into two 4328bf6039f0SWarner Losh categories according to size: small and large. Contiguous small objects 4329bf6039f0SWarner Losh comprise a slab, which resides within a single extent, whereas large objects 4330bf6039f0SWarner Losh each have their own extents backing them.</para> 4331bf6039f0SWarner Losh 4332bf6039f0SWarner Losh <para>Small objects are managed in groups by slabs. Each slab maintains 4333bf6039f0SWarner Losh a bitmap to track which regions are in use. Allocation requests that are no 4334bf6039f0SWarner Losh more than half the quantum (8 or 16, depending on architecture) are rounded 4335bf6039f0SWarner Losh up to the nearest power of two that is at least <code 4336bf6039f0SWarner Losh language="C">sizeof(<type>double</type>)</code>. All other object size 4337bf6039f0SWarner Losh classes are multiples of the quantum, spaced such that there are four size 4338bf6039f0SWarner Losh classes for each doubling in size, which limits internal fragmentation to 4339bf6039f0SWarner Losh approximately 20% for all but the smallest size classes. Small size classes 4340bf6039f0SWarner Losh are smaller than four times the page size, and large size classes extend 4341bf6039f0SWarner Losh from four times the page size up to the largest size class that does not 4342bf6039f0SWarner Losh exceed <constant>PTRDIFF_MAX</constant>.</para> 4343bf6039f0SWarner Losh 4344bf6039f0SWarner Losh <para>Allocations are packed tightly together, which can be an issue for 4345bf6039f0SWarner Losh multi-threaded applications. If you need to assure that allocations do not 4346bf6039f0SWarner Losh suffer from cacheline sharing, round your allocation requests up to the 4347bf6039f0SWarner Losh nearest multiple of the cacheline size, or specify cacheline alignment when 4348bf6039f0SWarner Losh allocating.</para> 4349bf6039f0SWarner Losh 4350bf6039f0SWarner Losh <para>The <function>realloc()</function>, 4351bf6039f0SWarner Losh <function>rallocx()</function>, and 4352bf6039f0SWarner Losh <function>xallocx()</function> functions may resize allocations 4353bf6039f0SWarner Losh without moving them under limited circumstances. Unlike the 4354bf6039f0SWarner Losh <function>*allocx()</function> API, the standard API does not 4355bf6039f0SWarner Losh officially round up the usable size of an allocation to the nearest size 4356bf6039f0SWarner Losh class, so technically it is necessary to call 4357bf6039f0SWarner Losh <function>realloc()</function> to grow e.g. a 9-byte allocation to 4358bf6039f0SWarner Losh 16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage 4359bf6039f0SWarner Losh trivially succeeds in place as long as the pre-size and post-size both round 4360bf6039f0SWarner Losh up to the same size class. No other API guarantees are made regarding 4361bf6039f0SWarner Losh in-place resizing, but the current implementation also tries to resize large 4362bf6039f0SWarner Losh allocations in place, as long as the pre-size and post-size are both large. 4363bf6039f0SWarner Losh For shrinkage to succeed, the extent allocator must support splitting (see 4364bf6039f0SWarner Losh <link 4365bf6039f0SWarner Losh linkend="arena.i.extent_hooks"><mallctl>arena.<i>.extent_hooks</mallctl></link>). 4366bf6039f0SWarner Losh Growth only succeeds if the trailing memory is currently available, and the 4367bf6039f0SWarner Losh extent allocator supports merging.</para> 4368bf6039f0SWarner Losh 4369bf6039f0SWarner Losh <para>Assuming 4 KiB pages and a 16-byte quantum on a 64-bit system, the 4370bf6039f0SWarner Losh size classes in each category are as shown in <xref linkend="size_classes" 4371bf6039f0SWarner Losh xrefstyle="template:Table %n"/>.</para> 4372bf6039f0SWarner Losh 4373bf6039f0SWarner Losh <table xml:id="size_classes" frame="all"> 4374bf6039f0SWarner Losh <title>Size classes</title> 4375bf6039f0SWarner Losh <tgroup cols="3" colsep="1" rowsep="1"> 4376bf6039f0SWarner Losh <colspec colname="c1" align="left"/> 4377bf6039f0SWarner Losh <colspec colname="c2" align="right"/> 4378bf6039f0SWarner Losh <colspec colname="c3" align="left"/> 4379bf6039f0SWarner Losh <thead> 4380bf6039f0SWarner Losh <row> 4381bf6039f0SWarner Losh <entry>Category</entry> 4382bf6039f0SWarner Losh <entry>Spacing</entry> 4383bf6039f0SWarner Losh <entry>Size</entry> 4384bf6039f0SWarner Losh </row> 4385bf6039f0SWarner Losh </thead> 4386bf6039f0SWarner Losh <tbody> 4387bf6039f0SWarner Losh <row> 4388bf6039f0SWarner Losh <entry morerows="8">Small</entry> 4389bf6039f0SWarner Losh <entry>lg</entry> 4390bf6039f0SWarner Losh <entry>[8]</entry> 4391bf6039f0SWarner Losh </row> 4392bf6039f0SWarner Losh <row> 4393bf6039f0SWarner Losh <entry>16</entry> 4394bf6039f0SWarner Losh <entry>[16, 32, 48, 64, 80, 96, 112, 128]</entry> 4395bf6039f0SWarner Losh </row> 4396bf6039f0SWarner Losh <row> 4397bf6039f0SWarner Losh <entry>32</entry> 4398bf6039f0SWarner Losh <entry>[160, 192, 224, 256]</entry> 4399bf6039f0SWarner Losh </row> 4400bf6039f0SWarner Losh <row> 4401bf6039f0SWarner Losh <entry>64</entry> 4402bf6039f0SWarner Losh <entry>[320, 384, 448, 512]</entry> 4403bf6039f0SWarner Losh </row> 4404bf6039f0SWarner Losh <row> 4405bf6039f0SWarner Losh <entry>128</entry> 4406bf6039f0SWarner Losh <entry>[640, 768, 896, 1024]</entry> 4407bf6039f0SWarner Losh </row> 4408bf6039f0SWarner Losh <row> 4409bf6039f0SWarner Losh <entry>256</entry> 4410bf6039f0SWarner Losh <entry>[1280, 1536, 1792, 2048]</entry> 4411bf6039f0SWarner Losh </row> 4412bf6039f0SWarner Losh <row> 4413bf6039f0SWarner Losh <entry>512</entry> 4414bf6039f0SWarner Losh <entry>[2560, 3072, 3584, 4096]</entry> 4415bf6039f0SWarner Losh </row> 4416bf6039f0SWarner Losh <row> 4417bf6039f0SWarner Losh <entry>1 KiB</entry> 4418bf6039f0SWarner Losh <entry>[5 KiB, 6 KiB, 7 KiB, 8 KiB]</entry> 4419bf6039f0SWarner Losh </row> 4420bf6039f0SWarner Losh <row> 4421bf6039f0SWarner Losh <entry>2 KiB</entry> 4422bf6039f0SWarner Losh <entry>[10 KiB, 12 KiB, 14 KiB]</entry> 4423bf6039f0SWarner Losh </row> 4424bf6039f0SWarner Losh <row> 4425bf6039f0SWarner Losh <entry morerows="15">Large</entry> 4426bf6039f0SWarner Losh <entry>2 KiB</entry> 4427bf6039f0SWarner Losh <entry>[16 KiB]</entry> 4428bf6039f0SWarner Losh </row> 4429bf6039f0SWarner Losh <row> 4430bf6039f0SWarner Losh <entry>4 KiB</entry> 4431bf6039f0SWarner Losh <entry>[20 KiB, 24 KiB, 28 KiB, 32 KiB]</entry> 4432bf6039f0SWarner Losh </row> 4433bf6039f0SWarner Losh <row> 4434bf6039f0SWarner Losh <entry>8 KiB</entry> 4435bf6039f0SWarner Losh <entry>[40 KiB, 48 KiB, 54 KiB, 64 KiB]</entry> 4436bf6039f0SWarner Losh </row> 4437bf6039f0SWarner Losh <row> 4438bf6039f0SWarner Losh <entry>16 KiB</entry> 4439bf6039f0SWarner Losh <entry>[80 KiB, 96 KiB, 112 KiB, 128 KiB]</entry> 4440bf6039f0SWarner Losh </row> 4441bf6039f0SWarner Losh <row> 4442bf6039f0SWarner Losh <entry>32 KiB</entry> 4443bf6039f0SWarner Losh <entry>[160 KiB, 192 KiB, 224 KiB, 256 KiB]</entry> 4444bf6039f0SWarner Losh </row> 4445bf6039f0SWarner Losh <row> 4446bf6039f0SWarner Losh <entry>64 KiB</entry> 4447bf6039f0SWarner Losh <entry>[320 KiB, 384 KiB, 448 KiB, 512 KiB]</entry> 4448bf6039f0SWarner Losh </row> 4449bf6039f0SWarner Losh <row> 4450bf6039f0SWarner Losh <entry>128 KiB</entry> 4451bf6039f0SWarner Losh <entry>[640 KiB, 768 KiB, 896 KiB, 1 MiB]</entry> 4452bf6039f0SWarner Losh </row> 4453bf6039f0SWarner Losh <row> 4454bf6039f0SWarner Losh <entry>256 KiB</entry> 4455bf6039f0SWarner Losh <entry>[1280 KiB, 1536 KiB, 1792 KiB, 2 MiB]</entry> 4456bf6039f0SWarner Losh </row> 4457bf6039f0SWarner Losh <row> 4458bf6039f0SWarner Losh <entry>512 KiB</entry> 4459bf6039f0SWarner Losh <entry>[2560 KiB, 3 MiB, 3584 KiB, 4 MiB]</entry> 4460bf6039f0SWarner Losh </row> 4461bf6039f0SWarner Losh <row> 4462bf6039f0SWarner Losh <entry>1 MiB</entry> 4463bf6039f0SWarner Losh <entry>[5 MiB, 6 MiB, 7 MiB, 8 MiB]</entry> 4464bf6039f0SWarner Losh </row> 4465bf6039f0SWarner Losh <row> 4466bf6039f0SWarner Losh <entry>2 MiB</entry> 4467bf6039f0SWarner Losh <entry>[10 MiB, 12 MiB, 14 MiB, 16 MiB]</entry> 4468bf6039f0SWarner Losh </row> 4469bf6039f0SWarner Losh <row> 4470bf6039f0SWarner Losh <entry>4 MiB</entry> 4471bf6039f0SWarner Losh <entry>[20 MiB, 24 MiB, 28 MiB, 32 MiB]</entry> 4472bf6039f0SWarner Losh </row> 4473bf6039f0SWarner Losh <row> 4474bf6039f0SWarner Losh <entry>8 MiB</entry> 4475bf6039f0SWarner Losh <entry>[40 MiB, 48 MiB, 56 MiB, 64 MiB]</entry> 4476bf6039f0SWarner Losh </row> 4477bf6039f0SWarner Losh <row> 4478bf6039f0SWarner Losh <entry>...</entry> 4479bf6039f0SWarner Losh <entry>...</entry> 4480bf6039f0SWarner Losh </row> 4481bf6039f0SWarner Losh <row> 4482bf6039f0SWarner Losh <entry>512 PiB</entry> 4483bf6039f0SWarner Losh <entry>[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]</entry> 4484bf6039f0SWarner Losh </row> 4485bf6039f0SWarner Losh <row> 4486bf6039f0SWarner Losh <entry>1 EiB</entry> 4487bf6039f0SWarner Losh <entry>[5 EiB, 6 EiB, 7 EiB]</entry> 4488bf6039f0SWarner Losh </row> 4489bf6039f0SWarner Losh </tbody> 4490bf6039f0SWarner Losh </tgroup> 4491bf6039f0SWarner Losh </table> 4492bf6039f0SWarner Losh </refsect1> 4493bf6039f0SWarner Losh <refsect1 id="mallctl_namespace"> 4494bf6039f0SWarner Losh <title>MALLCTL NAMESPACE</title> 4495bf6039f0SWarner Losh <para>The following names are defined in the namespace accessible via the 4496bf6039f0SWarner Losh <function>mallctl*()</function> functions. Value types are specified in 4497bf6039f0SWarner Losh parentheses, their readable/writable statuses are encoded as 4498bf6039f0SWarner Losh <literal>rw</literal>, <literal>r-</literal>, <literal>-w</literal>, or 4499bf6039f0SWarner Losh <literal>--</literal>, and required build configuration flags follow, if 4500bf6039f0SWarner Losh any. A name element encoded as <literal><i></literal> or 4501bf6039f0SWarner Losh <literal><j></literal> indicates an integer component, where the 4502bf6039f0SWarner Losh integer varies from 0 to some upper value that must be determined via 4503bf6039f0SWarner Losh introspection. In the case of <mallctl>stats.arenas.<i>.*</mallctl> 4504bf6039f0SWarner Losh and <mallctl>arena.<i>.{initialized,purge,decay,dss}</mallctl>, 4505bf6039f0SWarner Losh <literal><i></literal> equal to 4506bf6039f0SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant> can be used to operate on all arenas 4507bf6039f0SWarner Losh or access the summation of statistics from all arenas; similarly 4508bf6039f0SWarner Losh <literal><i></literal> equal to 4509bf6039f0SWarner Losh <constant>MALLCTL_ARENAS_DESTROYED</constant> can be used to access the 4510bf6039f0SWarner Losh summation of statistics from all destroyed arenas. These constants can be 4511bf6039f0SWarner Losh utilized either via <function>mallctlnametomib()</function> followed by 4512bf6039f0SWarner Losh <function>mallctlbymib()</function>, or via code such as the following: 4513bf6039f0SWarner Losh <programlisting language="C"><![CDATA[ 4514bf6039f0SWarner Losh#define STRINGIFY_HELPER(x) #x 4515bf6039f0SWarner Losh#define STRINGIFY(x) STRINGIFY_HELPER(x) 4516bf6039f0SWarner Losh 4517bf6039f0SWarner Loshmallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay", 4518bf6039f0SWarner Losh NULL, NULL, NULL, 0);]]></programlisting> 4519bf6039f0SWarner Losh Take special note of the <link 4520bf6039f0SWarner Losh linkend="epoch"><mallctl>epoch</mallctl></link> mallctl, which controls 4521bf6039f0SWarner Losh refreshing of cached dynamic statistics.</para> 4522bf6039f0SWarner Losh 4523bf6039f0SWarner Losh <variablelist> 4524bf6039f0SWarner Losh <varlistentry id="version"> 4525bf6039f0SWarner Losh <term> 4526bf6039f0SWarner Losh <mallctl>version</mallctl> 4527bf6039f0SWarner Losh (<type>const char *</type>) 4528bf6039f0SWarner Losh <literal>r-</literal> 4529bf6039f0SWarner Losh </term> 4530bf6039f0SWarner Losh <listitem><para>Return the jemalloc version string.</para></listitem> 4531bf6039f0SWarner Losh </varlistentry> 4532bf6039f0SWarner Losh 4533bf6039f0SWarner Losh <varlistentry id="epoch"> 4534bf6039f0SWarner Losh <term> 4535bf6039f0SWarner Losh <mallctl>epoch</mallctl> 4536bf6039f0SWarner Losh (<type>uint64_t</type>) 4537bf6039f0SWarner Losh <literal>rw</literal> 4538bf6039f0SWarner Losh </term> 4539bf6039f0SWarner Losh <listitem><para>If a value is passed in, refresh the data from which 4540bf6039f0SWarner Losh the <function>mallctl*()</function> functions report values, 4541bf6039f0SWarner Losh and increment the epoch. Return the current epoch. This is useful for 4542bf6039f0SWarner Losh detecting whether another thread caused a refresh.</para></listitem> 4543bf6039f0SWarner Losh </varlistentry> 4544bf6039f0SWarner Losh 4545bf6039f0SWarner Losh <varlistentry id="background_thread"> 4546bf6039f0SWarner Losh <term> 4547bf6039f0SWarner Losh <mallctl>background_thread</mallctl> 4548bf6039f0SWarner Losh (<type>bool</type>) 4549bf6039f0SWarner Losh <literal>rw</literal> 4550bf6039f0SWarner Losh </term> 4551bf6039f0SWarner Losh <listitem><para>Enable/disable internal background worker threads. When 4552bf6039f0SWarner Losh set to true, background threads are created on demand (the number of 4553bf6039f0SWarner Losh background threads will be no more than the number of CPUs or active 4554bf6039f0SWarner Losh arenas). Threads run periodically, and handle <link 4555bf6039f0SWarner Losh linkend="arena.i.decay">purging</link> asynchronously. When switching 4556bf6039f0SWarner Losh off, background threads are terminated synchronously. Note that after 4557bf6039f0SWarner Losh <citerefentry><refentrytitle>fork</refentrytitle><manvolnum>2</manvolnum></citerefentry> 4558bf6039f0SWarner Losh function, the state in the child process will be disabled regardless 4559bf6039f0SWarner Losh the state in parent process. See <link 4560bf6039f0SWarner Losh linkend="stats.background_thread.num_threads"><mallctl>stats.background_thread</mallctl></link> 4561bf6039f0SWarner Losh for related stats. <link 4562bf6039f0SWarner Losh linkend="opt.background_thread"><mallctl>opt.background_thread</mallctl></link> 4563bf6039f0SWarner Losh can be used to set the default option. This option is only available on 4564bf6039f0SWarner Losh selected pthread-based platforms.</para></listitem> 4565bf6039f0SWarner Losh </varlistentry> 4566bf6039f0SWarner Losh 4567bf6039f0SWarner Losh <varlistentry id="max_background_threads"> 4568bf6039f0SWarner Losh <term> 4569bf6039f0SWarner Losh <mallctl>max_background_threads</mallctl> 4570bf6039f0SWarner Losh (<type>size_t</type>) 4571bf6039f0SWarner Losh <literal>rw</literal> 4572bf6039f0SWarner Losh </term> 4573bf6039f0SWarner Losh <listitem><para>Maximum number of background worker threads that will 4574bf6039f0SWarner Losh be created. This value is capped at <link 4575bf6039f0SWarner Losh linkend="opt.max_background_threads"><mallctl>opt.max_background_threads</mallctl></link> at 4576bf6039f0SWarner Losh startup.</para></listitem> 4577bf6039f0SWarner Losh </varlistentry> 4578bf6039f0SWarner Losh 4579bf6039f0SWarner Losh <varlistentry id="config.cache_oblivious"> 4580bf6039f0SWarner Losh <term> 4581bf6039f0SWarner Losh <mallctl>config.cache_oblivious</mallctl> 4582bf6039f0SWarner Losh (<type>bool</type>) 4583bf6039f0SWarner Losh <literal>r-</literal> 4584bf6039f0SWarner Losh </term> 4585bf6039f0SWarner Losh <listitem><para><option>--enable-cache-oblivious</option> was specified 4586bf6039f0SWarner Losh during build configuration.</para></listitem> 4587bf6039f0SWarner Losh </varlistentry> 4588bf6039f0SWarner Losh 4589bf6039f0SWarner Losh <varlistentry id="config.debug"> 4590bf6039f0SWarner Losh <term> 4591bf6039f0SWarner Losh <mallctl>config.debug</mallctl> 4592bf6039f0SWarner Losh (<type>bool</type>) 4593bf6039f0SWarner Losh <literal>r-</literal> 4594bf6039f0SWarner Losh </term> 4595bf6039f0SWarner Losh <listitem><para><option>--enable-debug</option> was specified during 4596bf6039f0SWarner Losh build configuration.</para></listitem> 4597bf6039f0SWarner Losh </varlistentry> 4598bf6039f0SWarner Losh 4599bf6039f0SWarner Losh <varlistentry id="config.fill"> 4600bf6039f0SWarner Losh <term> 4601bf6039f0SWarner Losh <mallctl>config.fill</mallctl> 4602bf6039f0SWarner Losh (<type>bool</type>) 4603bf6039f0SWarner Losh <literal>r-</literal> 4604bf6039f0SWarner Losh </term> 4605bf6039f0SWarner Losh <listitem><para><option>--enable-fill</option> was specified during 4606bf6039f0SWarner Losh build configuration.</para></listitem> 4607bf6039f0SWarner Losh </varlistentry> 4608bf6039f0SWarner Losh 4609bf6039f0SWarner Losh <varlistentry id="config.lazy_lock"> 4610bf6039f0SWarner Losh <term> 4611bf6039f0SWarner Losh <mallctl>config.lazy_lock</mallctl> 4612bf6039f0SWarner Losh (<type>bool</type>) 4613bf6039f0SWarner Losh <literal>r-</literal> 4614bf6039f0SWarner Losh </term> 4615bf6039f0SWarner Losh <listitem><para><option>--enable-lazy-lock</option> was specified 4616bf6039f0SWarner Losh during build configuration.</para></listitem> 4617bf6039f0SWarner Losh </varlistentry> 4618bf6039f0SWarner Losh 4619bf6039f0SWarner Losh <varlistentry id="config.malloc_conf"> 4620bf6039f0SWarner Losh <term> 4621bf6039f0SWarner Losh <mallctl>config.malloc_conf</mallctl> 4622bf6039f0SWarner Losh (<type>const char *</type>) 4623bf6039f0SWarner Losh <literal>r-</literal> 4624bf6039f0SWarner Losh </term> 4625bf6039f0SWarner Losh <listitem><para>Embedded configure-time-specified run-time options 4626bf6039f0SWarner Losh string, empty unless <option>--with-malloc-conf</option> was specified 4627bf6039f0SWarner Losh during build configuration.</para></listitem> 4628bf6039f0SWarner Losh </varlistentry> 4629bf6039f0SWarner Losh 4630bf6039f0SWarner Losh <varlistentry id="config.prof"> 4631bf6039f0SWarner Losh <term> 4632bf6039f0SWarner Losh <mallctl>config.prof</mallctl> 4633bf6039f0SWarner Losh (<type>bool</type>) 4634bf6039f0SWarner Losh <literal>r-</literal> 4635bf6039f0SWarner Losh </term> 4636bf6039f0SWarner Losh <listitem><para><option>--enable-prof</option> was specified during 4637bf6039f0SWarner Losh build configuration.</para></listitem> 4638bf6039f0SWarner Losh </varlistentry> 4639bf6039f0SWarner Losh 4640bf6039f0SWarner Losh <varlistentry id="config.prof_libgcc"> 4641bf6039f0SWarner Losh <term> 4642bf6039f0SWarner Losh <mallctl>config.prof_libgcc</mallctl> 4643bf6039f0SWarner Losh (<type>bool</type>) 4644bf6039f0SWarner Losh <literal>r-</literal> 4645bf6039f0SWarner Losh </term> 4646bf6039f0SWarner Losh <listitem><para><option>--disable-prof-libgcc</option> was not 4647bf6039f0SWarner Losh specified during build configuration.</para></listitem> 4648bf6039f0SWarner Losh </varlistentry> 4649bf6039f0SWarner Losh 4650bf6039f0SWarner Losh <varlistentry id="config.prof_libunwind"> 4651bf6039f0SWarner Losh <term> 4652bf6039f0SWarner Losh <mallctl>config.prof_libunwind</mallctl> 4653bf6039f0SWarner Losh (<type>bool</type>) 4654bf6039f0SWarner Losh <literal>r-</literal> 4655bf6039f0SWarner Losh </term> 4656bf6039f0SWarner Losh <listitem><para><option>--enable-prof-libunwind</option> was specified 4657bf6039f0SWarner Losh during build configuration.</para></listitem> 4658bf6039f0SWarner Losh </varlistentry> 4659bf6039f0SWarner Losh 4660bf6039f0SWarner Losh <varlistentry id="config.stats"> 4661bf6039f0SWarner Losh <term> 4662bf6039f0SWarner Losh <mallctl>config.stats</mallctl> 4663bf6039f0SWarner Losh (<type>bool</type>) 4664bf6039f0SWarner Losh <literal>r-</literal> 4665bf6039f0SWarner Losh </term> 4666bf6039f0SWarner Losh <listitem><para><option>--enable-stats</option> was specified during 4667bf6039f0SWarner Losh build configuration.</para></listitem> 4668bf6039f0SWarner Losh </varlistentry> 4669bf6039f0SWarner Losh 4670bf6039f0SWarner Losh 4671bf6039f0SWarner Losh <varlistentry id="config.utrace"> 4672bf6039f0SWarner Losh <term> 4673bf6039f0SWarner Losh <mallctl>config.utrace</mallctl> 4674bf6039f0SWarner Losh (<type>bool</type>) 4675bf6039f0SWarner Losh <literal>r-</literal> 4676bf6039f0SWarner Losh </term> 4677bf6039f0SWarner Losh <listitem><para><option>--enable-utrace</option> was specified during 4678bf6039f0SWarner Losh build configuration.</para></listitem> 4679bf6039f0SWarner Losh </varlistentry> 4680bf6039f0SWarner Losh 4681bf6039f0SWarner Losh <varlistentry id="config.xmalloc"> 4682bf6039f0SWarner Losh <term> 4683bf6039f0SWarner Losh <mallctl>config.xmalloc</mallctl> 4684bf6039f0SWarner Losh (<type>bool</type>) 4685bf6039f0SWarner Losh <literal>r-</literal> 4686bf6039f0SWarner Losh </term> 4687bf6039f0SWarner Losh <listitem><para><option>--enable-xmalloc</option> was specified during 4688bf6039f0SWarner Losh build configuration.</para></listitem> 4689bf6039f0SWarner Losh </varlistentry> 4690bf6039f0SWarner Losh 4691bf6039f0SWarner Losh <varlistentry id="opt.abort"> 4692bf6039f0SWarner Losh <term> 4693bf6039f0SWarner Losh <mallctl>opt.abort</mallctl> 4694bf6039f0SWarner Losh (<type>bool</type>) 4695bf6039f0SWarner Losh <literal>r-</literal> 4696bf6039f0SWarner Losh </term> 4697bf6039f0SWarner Losh <listitem><para>Abort-on-warning enabled/disabled. If true, most 4698bf6039f0SWarner Losh warnings are fatal. Note that runtime option warnings are not included 4699bf6039f0SWarner Losh (see <link 4700bf6039f0SWarner Losh linkend="opt.abort_conf"><mallctl>opt.abort_conf</mallctl></link> for 4701bf6039f0SWarner Losh that). The process will call 4702bf6039f0SWarner Losh <citerefentry><refentrytitle>abort</refentrytitle> 4703bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry> in these cases. This option is 4704bf6039f0SWarner Losh disabled by default unless <option>--enable-debug</option> is 4705bf6039f0SWarner Losh specified during configuration, in which case it is enabled by default. 4706bf6039f0SWarner Losh </para></listitem> 4707bf6039f0SWarner Losh </varlistentry> 4708bf6039f0SWarner Losh 4709bf6039f0SWarner Losh <varlistentry id="opt.confirm_conf"> 4710bf6039f0SWarner Losh <term> 4711bf6039f0SWarner Losh <mallctl>opt.confirm_conf</mallctl> 4712bf6039f0SWarner Losh (<type>bool</type>) 4713bf6039f0SWarner Losh <literal>r-</literal> 4714bf6039f0SWarner Losh </term> 4715bf6039f0SWarner Losh <listitem><para>Confirm-runtime-options-when-program-starts 4716bf6039f0SWarner Losh enabled/disabled. If true, the string specified via 4717bf6039f0SWarner Losh <option>--with-malloc-conf</option>, the string pointed to by the 4718bf6039f0SWarner Losh global variable <varname>malloc_conf</varname>, the <quote>name</quote> 4719bf6039f0SWarner Losh of the file referenced by the symbolic link named 4720bf6039f0SWarner Losh <filename class="symlink">/etc/malloc.conf</filename>, and the value of 4721bf6039f0SWarner Losh the environment variable <envar>MALLOC_CONF</envar>, will be printed in 4722bf6039f0SWarner Losh order. Then, each option being set will be individually printed. This 4723bf6039f0SWarner Losh option is disabled by default.</para></listitem> 4724bf6039f0SWarner Losh </varlistentry> 4725bf6039f0SWarner Losh 4726bf6039f0SWarner Losh <varlistentry id="opt.abort_conf"> 4727bf6039f0SWarner Losh <term> 4728bf6039f0SWarner Losh <mallctl>opt.abort_conf</mallctl> 4729bf6039f0SWarner Losh (<type>bool</type>) 4730bf6039f0SWarner Losh <literal>r-</literal> 4731bf6039f0SWarner Losh </term> 4732bf6039f0SWarner Losh <listitem><para>Abort-on-invalid-configuration enabled/disabled. If 4733bf6039f0SWarner Losh true, invalid runtime options are fatal. The process will call 4734bf6039f0SWarner Losh <citerefentry><refentrytitle>abort</refentrytitle> 4735bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry> in these cases. This option is 4736bf6039f0SWarner Losh disabled by default unless <option>--enable-debug</option> is 4737bf6039f0SWarner Losh specified during configuration, in which case it is enabled by default. 4738bf6039f0SWarner Losh </para></listitem> 4739bf6039f0SWarner Losh </varlistentry> 4740bf6039f0SWarner Losh 4741bf6039f0SWarner Losh <varlistentry id="opt.metadata_thp"> 4742bf6039f0SWarner Losh <term> 4743bf6039f0SWarner Losh <mallctl>opt.metadata_thp</mallctl> 4744bf6039f0SWarner Losh (<type>const char *</type>) 4745bf6039f0SWarner Losh <literal>r-</literal> 4746bf6039f0SWarner Losh </term> 4747bf6039f0SWarner Losh <listitem><para>Controls whether to allow jemalloc to use transparent 4748bf6039f0SWarner Losh huge page (THP) for internal metadata (see <link 4749bf6039f0SWarner Losh linkend="stats.metadata">stats.metadata</link>). <quote>always</quote> 4750bf6039f0SWarner Losh allows such usage. <quote>auto</quote> uses no THP initially, but may 4751bf6039f0SWarner Losh begin to do so when metadata usage reaches certain level. The default 4752bf6039f0SWarner Losh is <quote>disabled</quote>.</para></listitem> 4753bf6039f0SWarner Losh </varlistentry> 4754bf6039f0SWarner Losh 4755bf6039f0SWarner Losh <varlistentry id="opt.retain"> 4756bf6039f0SWarner Losh <term> 4757bf6039f0SWarner Losh <mallctl>opt.retain</mallctl> 4758bf6039f0SWarner Losh (<type>bool</type>) 4759bf6039f0SWarner Losh <literal>r-</literal> 4760bf6039f0SWarner Losh </term> 4761bf6039f0SWarner Losh <listitem><para>If true, retain unused virtual memory for later reuse 4762bf6039f0SWarner Losh rather than discarding it by calling 4763bf6039f0SWarner Losh <citerefentry><refentrytitle>munmap</refentrytitle> 4764bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> or equivalent (see <link 4765bf6039f0SWarner Losh linkend="stats.retained">stats.retained</link> for related details). 4766bf6039f0SWarner Losh It also makes jemalloc use <citerefentry> 4767bf6039f0SWarner Losh <refentrytitle>mmap</refentrytitle><manvolnum>2</manvolnum> 4768bf6039f0SWarner Losh </citerefentry> or equivalent in a more greedy way, mapping larger 4769bf6039f0SWarner Losh chunks in one go. This option is disabled by default unless discarding 4770bf6039f0SWarner Losh virtual memory is known to trigger platform-specific performance 4771bf6039f0SWarner Losh problems, namely 1) for [64-bit] Linux, which has a quirk in its virtual 4772bf6039f0SWarner Losh memory allocation algorithm that causes semi-permanent VM map holes 4773bf6039f0SWarner Losh under normal jemalloc operation; and 2) for [64-bit] Windows, which 4774bf6039f0SWarner Losh disallows split / merged regions with 4775bf6039f0SWarner Losh <parameter><constant>MEM_RELEASE</constant></parameter>. Although the 4776bf6039f0SWarner Losh same issues may present on 32-bit platforms as well, retaining virtual 4777bf6039f0SWarner Losh memory for 32-bit Linux and Windows is disabled by default due to the 4778bf6039f0SWarner Losh practical possibility of address space exhaustion. </para></listitem> 4779bf6039f0SWarner Losh </varlistentry> 4780bf6039f0SWarner Losh 4781bf6039f0SWarner Losh <varlistentry id="opt.dss"> 4782bf6039f0SWarner Losh <term> 4783bf6039f0SWarner Losh <mallctl>opt.dss</mallctl> 4784bf6039f0SWarner Losh (<type>const char *</type>) 4785bf6039f0SWarner Losh <literal>r-</literal> 4786bf6039f0SWarner Losh </term> 4787bf6039f0SWarner Losh <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle> 4788bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>) allocation precedence as 4789bf6039f0SWarner Losh related to <citerefentry><refentrytitle>mmap</refentrytitle> 4790bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> allocation. The following 4791bf6039f0SWarner Losh settings are supported if 4792bf6039f0SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 4793bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> is supported by the operating 4794bf6039f0SWarner Losh system: <quote>disabled</quote>, <quote>primary</quote>, and 4795bf6039f0SWarner Losh <quote>secondary</quote>; otherwise only <quote>disabled</quote> is 4796bf6039f0SWarner Losh supported. The default is <quote>secondary</quote> if 4797bf6039f0SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 4798bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> is supported by the operating 4799bf6039f0SWarner Losh system; <quote>disabled</quote> otherwise. 4800bf6039f0SWarner Losh </para></listitem> 4801bf6039f0SWarner Losh </varlistentry> 4802bf6039f0SWarner Losh 4803bf6039f0SWarner Losh <varlistentry id="opt.narenas"> 4804bf6039f0SWarner Losh <term> 4805bf6039f0SWarner Losh <mallctl>opt.narenas</mallctl> 4806bf6039f0SWarner Losh (<type>unsigned</type>) 4807bf6039f0SWarner Losh <literal>r-</literal> 4808bf6039f0SWarner Losh </term> 4809bf6039f0SWarner Losh <listitem><para>Maximum number of arenas to use for automatic 4810bf6039f0SWarner Losh multiplexing of threads and arenas. The default is four times the 4811bf6039f0SWarner Losh number of CPUs, or one if there is a single CPU.</para></listitem> 4812bf6039f0SWarner Losh </varlistentry> 4813bf6039f0SWarner Losh 4814bf6039f0SWarner Losh <varlistentry id="opt.oversize_threshold"> 4815bf6039f0SWarner Losh <term> 4816bf6039f0SWarner Losh <mallctl>opt.oversize_threshold</mallctl> 4817bf6039f0SWarner Losh (<type>size_t</type>) 4818bf6039f0SWarner Losh <literal>r-</literal> 4819bf6039f0SWarner Losh </term> 4820bf6039f0SWarner Losh <listitem><para>The threshold in bytes of which requests are considered 4821bf6039f0SWarner Losh oversize. Allocation requests with greater sizes are fulfilled from a 4822bf6039f0SWarner Losh dedicated arena (automatically managed, however not within 4823bf6039f0SWarner Losh <literal>narenas</literal>), in order to reduce fragmentation by not 4824bf6039f0SWarner Losh mixing huge allocations with small ones. In addition, the decay API 4825bf6039f0SWarner Losh guarantees on the extents greater than the specified threshold may be 4826bf6039f0SWarner Losh overridden. Note that requests with arena index specified via 4827bf6039f0SWarner Losh <constant>MALLOCX_ARENA</constant>, or threads associated with explicit 4828bf6039f0SWarner Losh arenas will not be considered. The default threshold is 8MiB. Values 4829bf6039f0SWarner Losh not within large size classes disables this feature.</para></listitem> 4830bf6039f0SWarner Losh </varlistentry> 4831bf6039f0SWarner Losh 4832bf6039f0SWarner Losh <varlistentry id="opt.percpu_arena"> 4833bf6039f0SWarner Losh <term> 4834bf6039f0SWarner Losh <mallctl>opt.percpu_arena</mallctl> 4835bf6039f0SWarner Losh (<type>const char *</type>) 4836bf6039f0SWarner Losh <literal>r-</literal> 4837bf6039f0SWarner Losh </term> 4838bf6039f0SWarner Losh <listitem><para>Per CPU arena mode. Use the <quote>percpu</quote> 4839bf6039f0SWarner Losh setting to enable this feature, which uses number of CPUs to determine 4840bf6039f0SWarner Losh number of arenas, and bind threads to arenas dynamically based on the 4841bf6039f0SWarner Losh CPU the thread runs on currently. <quote>phycpu</quote> setting uses 4842bf6039f0SWarner Losh one arena per physical CPU, which means the two hyper threads on the 4843bf6039f0SWarner Losh same CPU share one arena. Note that no runtime checking regarding the 4844bf6039f0SWarner Losh availability of hyper threading is done at the moment. When set to 4845bf6039f0SWarner Losh <quote>disabled</quote>, narenas and thread to arena association will 4846bf6039f0SWarner Losh not be impacted by this option. The default is <quote>disabled</quote>. 4847bf6039f0SWarner Losh </para></listitem> 4848bf6039f0SWarner Losh </varlistentry> 4849bf6039f0SWarner Losh 4850bf6039f0SWarner Losh <varlistentry id="opt.background_thread"> 4851bf6039f0SWarner Losh <term> 4852bf6039f0SWarner Losh <mallctl>opt.background_thread</mallctl> 4853bf6039f0SWarner Losh (<type>bool</type>) 4854bf6039f0SWarner Losh <literal>r-</literal> 4855bf6039f0SWarner Losh </term> 4856bf6039f0SWarner Losh <listitem><para>Internal background worker threads enabled/disabled. 4857bf6039f0SWarner Losh Because of potential circular dependencies, enabling background thread 4858bf6039f0SWarner Losh using this option may cause crash or deadlock during initialization. For 4859bf6039f0SWarner Losh a reliable way to use this feature, see <link 4860bf6039f0SWarner Losh linkend="background_thread">background_thread</link> for dynamic control 4861bf6039f0SWarner Losh options and details. This option is disabled by 4862bf6039f0SWarner Losh default.</para></listitem> 4863bf6039f0SWarner Losh </varlistentry> 4864bf6039f0SWarner Losh 4865bf6039f0SWarner Losh <varlistentry id="opt.max_background_threads"> 4866bf6039f0SWarner Losh <term> 4867bf6039f0SWarner Losh <mallctl>opt.max_background_threads</mallctl> 4868bf6039f0SWarner Losh (<type>size_t</type>) 4869bf6039f0SWarner Losh <literal>r-</literal> 4870bf6039f0SWarner Losh </term> 4871bf6039f0SWarner Losh <listitem><para>Maximum number of background threads that will be created 4872bf6039f0SWarner Losh if <link linkend="background_thread">background_thread</link> is set. 4873bf6039f0SWarner Losh Defaults to number of cpus.</para></listitem> 4874bf6039f0SWarner Losh </varlistentry> 4875bf6039f0SWarner Losh 4876bf6039f0SWarner Losh <varlistentry id="opt.dirty_decay_ms"> 4877bf6039f0SWarner Losh <term> 4878bf6039f0SWarner Losh <mallctl>opt.dirty_decay_ms</mallctl> 4879bf6039f0SWarner Losh (<type>ssize_t</type>) 4880bf6039f0SWarner Losh <literal>r-</literal> 4881bf6039f0SWarner Losh </term> 4882bf6039f0SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 4883bf6039f0SWarner Losh set of unused dirty pages until an equivalent set of unused dirty pages 4884bf6039f0SWarner Losh is purged (i.e. converted to muzzy via e.g. 4885bf6039f0SWarner Losh <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function> 4886bf6039f0SWarner Losh if supported by the operating system, or converted to clean otherwise) 4887bf6039f0SWarner Losh and/or reused. Dirty pages are defined as previously having been 4888bf6039f0SWarner Losh potentially written to by the application, and therefore consuming 4889bf6039f0SWarner Losh physical memory, yet having no current use. The pages are incrementally 4890bf6039f0SWarner Losh purged according to a sigmoidal decay curve that starts and ends with 4891bf6039f0SWarner Losh zero purge rate. A decay time of 0 causes all unused dirty pages to be 4892bf6039f0SWarner Losh purged immediately upon creation. A decay time of -1 disables purging. 4893bf6039f0SWarner Losh The default decay time is 10 seconds. See <link 4894bf6039f0SWarner Losh linkend="arenas.dirty_decay_ms"><mallctl>arenas.dirty_decay_ms</mallctl></link> 4895bf6039f0SWarner Losh and <link 4896bf6039f0SWarner Losh linkend="arena.i.dirty_decay_ms"><mallctl>arena.<i>.dirty_decay_ms</mallctl></link> 4897bf6039f0SWarner Losh for related dynamic control options. See <link 4898bf6039f0SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 4899bf6039f0SWarner Losh for a description of muzzy pages.for a description of muzzy pages. Note 4900bf6039f0SWarner Losh that when the <link 4901bf6039f0SWarner Losh linkend="opt.oversize_threshold"><mallctl>oversize_threshold</mallctl></link> 4902bf6039f0SWarner Losh feature is enabled, the arenas reserved for oversize requests may have 4903bf6039f0SWarner Losh its own default decay settings.</para></listitem> 4904bf6039f0SWarner Losh </varlistentry> 4905bf6039f0SWarner Losh 4906bf6039f0SWarner Losh <varlistentry id="opt.muzzy_decay_ms"> 4907bf6039f0SWarner Losh <term> 4908bf6039f0SWarner Losh <mallctl>opt.muzzy_decay_ms</mallctl> 4909bf6039f0SWarner Losh (<type>ssize_t</type>) 4910bf6039f0SWarner Losh <literal>r-</literal> 4911bf6039f0SWarner Losh </term> 4912bf6039f0SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 4913bf6039f0SWarner Losh set of unused muzzy pages until an equivalent set of unused muzzy pages 4914bf6039f0SWarner Losh is purged (i.e. converted to clean) and/or reused. Muzzy pages are 4915bf6039f0SWarner Losh defined as previously having been unused dirty pages that were 4916bf6039f0SWarner Losh subsequently purged in a manner that left them subject to the 4917bf6039f0SWarner Losh reclamation whims of the operating system (e.g. 4918bf6039f0SWarner Losh <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>), 4919bf6039f0SWarner Losh and therefore in an indeterminate state. The pages are incrementally 4920bf6039f0SWarner Losh purged according to a sigmoidal decay curve that starts and ends with 4921bf6039f0SWarner Losh zero purge rate. A decay time of 0 causes all unused muzzy pages to be 4922bf6039f0SWarner Losh purged immediately upon creation. A decay time of -1 disables purging. 4923bf6039f0SWarner Losh The default decay time is 10 seconds. See <link 4924bf6039f0SWarner Losh linkend="arenas.muzzy_decay_ms"><mallctl>arenas.muzzy_decay_ms</mallctl></link> 4925bf6039f0SWarner Losh and <link 4926bf6039f0SWarner Losh linkend="arena.i.muzzy_decay_ms"><mallctl>arena.<i>.muzzy_decay_ms</mallctl></link> 4927bf6039f0SWarner Losh for related dynamic control options.</para></listitem> 4928bf6039f0SWarner Losh </varlistentry> 4929bf6039f0SWarner Losh 4930bf6039f0SWarner Losh <varlistentry id="opt.lg_extent_max_active_fit"> 4931bf6039f0SWarner Losh <term> 4932bf6039f0SWarner Losh <mallctl>opt.lg_extent_max_active_fit</mallctl> 4933bf6039f0SWarner Losh (<type>size_t</type>) 4934bf6039f0SWarner Losh <literal>r-</literal> 4935bf6039f0SWarner Losh </term> 4936bf6039f0SWarner Losh <listitem><para>When reusing dirty extents, this determines the (log 4937bf6039f0SWarner Losh base 2 of the) maximum ratio between the size of the active extent 4938bf6039f0SWarner Losh selected (to split off from) and the size of the requested allocation. 4939bf6039f0SWarner Losh This prevents the splitting of large active extents for smaller 4940bf6039f0SWarner Losh allocations, which can reduce fragmentation over the long run 4941bf6039f0SWarner Losh (especially for non-active extents). Lower value may reduce 4942bf6039f0SWarner Losh fragmentation, at the cost of extra active extents. The default value 4943bf6039f0SWarner Losh is 6, which gives a maximum ratio of 64 (2^6).</para></listitem> 4944bf6039f0SWarner Losh </varlistentry> 4945bf6039f0SWarner Losh 4946bf6039f0SWarner Losh <varlistentry id="opt.stats_print"> 4947bf6039f0SWarner Losh <term> 4948bf6039f0SWarner Losh <mallctl>opt.stats_print</mallctl> 4949bf6039f0SWarner Losh (<type>bool</type>) 4950bf6039f0SWarner Losh <literal>r-</literal> 4951bf6039f0SWarner Losh </term> 4952bf6039f0SWarner Losh <listitem><para>Enable/disable statistics printing at exit. If 4953bf6039f0SWarner Losh enabled, the <function>malloc_stats_print()</function> 4954bf6039f0SWarner Losh function is called at program exit via an 4955bf6039f0SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 4956bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry> function. <link 4957bf6039f0SWarner Losh linkend="opt.stats_print_opts"><mallctl>opt.stats_print_opts</mallctl></link> 4958bf6039f0SWarner Losh can be combined to specify output options. If 4959bf6039f0SWarner Losh <option>--enable-stats</option> is specified during configuration, this 4960bf6039f0SWarner Losh has the potential to cause deadlock for a multi-threaded process that 4961bf6039f0SWarner Losh exits while one or more threads are executing in the memory allocation 4962bf6039f0SWarner Losh functions. Furthermore, <function>atexit()</function> may 4963bf6039f0SWarner Losh allocate memory during application initialization and then deadlock 4964bf6039f0SWarner Losh internally when jemalloc in turn calls 4965bf6039f0SWarner Losh <function>atexit()</function>, so this option is not 4966bf6039f0SWarner Losh universally usable (though the application can register its own 4967bf6039f0SWarner Losh <function>atexit()</function> function with equivalent 4968bf6039f0SWarner Losh functionality). Therefore, this option should only be used with care; 4969bf6039f0SWarner Losh it is primarily intended as a performance tuning aid during application 4970bf6039f0SWarner Losh development. This option is disabled by default.</para></listitem> 4971bf6039f0SWarner Losh </varlistentry> 4972bf6039f0SWarner Losh 4973bf6039f0SWarner Losh <varlistentry id="opt.stats_print_opts"> 4974bf6039f0SWarner Losh <term> 4975bf6039f0SWarner Losh <mallctl>opt.stats_print_opts</mallctl> 4976bf6039f0SWarner Losh (<type>const char *</type>) 4977bf6039f0SWarner Losh <literal>r-</literal> 4978bf6039f0SWarner Losh </term> 4979bf6039f0SWarner Losh <listitem><para>Options (the <parameter>opts</parameter> string) to pass 4980bf6039f0SWarner Losh to the <function>malloc_stats_print()</function> at exit (enabled 4981bf6039f0SWarner Losh through <link 4982bf6039f0SWarner Losh linkend="opt.stats_print"><mallctl>opt.stats_print</mallctl></link>). See 4983bf6039f0SWarner Losh available options in <link 4984bf6039f0SWarner Losh linkend="malloc_stats_print_opts"><function>malloc_stats_print()</function></link>. 4985bf6039f0SWarner Losh Has no effect unless <link 4986bf6039f0SWarner Losh linkend="opt.stats_print"><mallctl>opt.stats_print</mallctl></link> is 4987bf6039f0SWarner Losh enabled. The default is <quote></quote>.</para></listitem> 4988bf6039f0SWarner Losh </varlistentry> 4989bf6039f0SWarner Losh 4990bf6039f0SWarner Losh <varlistentry id="opt.junk"> 4991bf6039f0SWarner Losh <term> 4992bf6039f0SWarner Losh <mallctl>opt.junk</mallctl> 4993bf6039f0SWarner Losh (<type>const char *</type>) 4994bf6039f0SWarner Losh <literal>r-</literal> 4995bf6039f0SWarner Losh [<option>--enable-fill</option>] 4996bf6039f0SWarner Losh </term> 4997bf6039f0SWarner Losh <listitem><para>Junk filling. If set to <quote>alloc</quote>, each byte 4998bf6039f0SWarner Losh of uninitialized allocated memory will be initialized to 4999bf6039f0SWarner Losh <literal>0xa5</literal>. If set to <quote>free</quote>, all deallocated 5000bf6039f0SWarner Losh memory will be initialized to <literal>0x5a</literal>. If set to 5001bf6039f0SWarner Losh <quote>true</quote>, both allocated and deallocated memory will be 5002bf6039f0SWarner Losh initialized, and if set to <quote>false</quote>, junk filling be 5003bf6039f0SWarner Losh disabled entirely. This is intended for debugging and will impact 5004bf6039f0SWarner Losh performance negatively. This option is <quote>false</quote> by default 5005bf6039f0SWarner Losh unless <option>--enable-debug</option> is specified during 5006bf6039f0SWarner Losh configuration, in which case it is <quote>true</quote> by 5007bf6039f0SWarner Losh default.</para></listitem> 5008bf6039f0SWarner Losh </varlistentry> 5009bf6039f0SWarner Losh 5010bf6039f0SWarner Losh <varlistentry id="opt.zero"> 5011bf6039f0SWarner Losh <term> 5012bf6039f0SWarner Losh <mallctl>opt.zero</mallctl> 5013bf6039f0SWarner Losh (<type>bool</type>) 5014bf6039f0SWarner Losh <literal>r-</literal> 5015bf6039f0SWarner Losh [<option>--enable-fill</option>] 5016bf6039f0SWarner Losh </term> 5017bf6039f0SWarner Losh <listitem><para>Zero filling enabled/disabled. If enabled, each byte 5018bf6039f0SWarner Losh of uninitialized allocated memory will be initialized to 0. Note that 5019bf6039f0SWarner Losh this initialization only happens once for each byte, so 5020bf6039f0SWarner Losh <function>realloc()</function> and 5021bf6039f0SWarner Losh <function>rallocx()</function> calls do not zero memory that 5022bf6039f0SWarner Losh was previously allocated. This is intended for debugging and will 5023bf6039f0SWarner Losh impact performance negatively. This option is disabled by default. 5024bf6039f0SWarner Losh </para></listitem> 5025bf6039f0SWarner Losh </varlistentry> 5026bf6039f0SWarner Losh 5027bf6039f0SWarner Losh <varlistentry id="opt.utrace"> 5028bf6039f0SWarner Losh <term> 5029bf6039f0SWarner Losh <mallctl>opt.utrace</mallctl> 5030bf6039f0SWarner Losh (<type>bool</type>) 5031bf6039f0SWarner Losh <literal>r-</literal> 5032bf6039f0SWarner Losh [<option>--enable-utrace</option>] 5033bf6039f0SWarner Losh </term> 5034bf6039f0SWarner Losh <listitem><para>Allocation tracing based on 5035bf6039f0SWarner Losh <citerefentry><refentrytitle>utrace</refentrytitle> 5036bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> enabled/disabled. This option 5037bf6039f0SWarner Losh is disabled by default.</para></listitem> 5038bf6039f0SWarner Losh </varlistentry> 5039bf6039f0SWarner Losh 5040bf6039f0SWarner Losh <varlistentry id="opt.xmalloc"> 5041bf6039f0SWarner Losh <term> 5042bf6039f0SWarner Losh <mallctl>opt.xmalloc</mallctl> 5043bf6039f0SWarner Losh (<type>bool</type>) 5044bf6039f0SWarner Losh <literal>r-</literal> 5045bf6039f0SWarner Losh [<option>--enable-xmalloc</option>] 5046bf6039f0SWarner Losh </term> 5047bf6039f0SWarner Losh <listitem><para>Abort-on-out-of-memory enabled/disabled. If enabled, 5048bf6039f0SWarner Losh rather than returning failure for any allocation function, display a 5049bf6039f0SWarner Losh diagnostic message on <constant>STDERR_FILENO</constant> and cause the 5050bf6039f0SWarner Losh program to drop core (using 5051bf6039f0SWarner Losh <citerefentry><refentrytitle>abort</refentrytitle> 5052bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry>). If an application is 5053bf6039f0SWarner Losh designed to depend on this behavior, set the option at compile time by 5054bf6039f0SWarner Losh including the following in the source code: 5055bf6039f0SWarner Losh <programlisting language="C"><![CDATA[ 5056bf6039f0SWarner Loshmalloc_conf = "xmalloc:true";]]></programlisting> 5057bf6039f0SWarner Losh This option is disabled by default.</para></listitem> 5058bf6039f0SWarner Losh </varlistentry> 5059bf6039f0SWarner Losh 5060bf6039f0SWarner Losh <varlistentry id="opt.tcache"> 5061bf6039f0SWarner Losh <term> 5062bf6039f0SWarner Losh <mallctl>opt.tcache</mallctl> 5063bf6039f0SWarner Losh (<type>bool</type>) 5064bf6039f0SWarner Losh <literal>r-</literal> 5065bf6039f0SWarner Losh </term> 5066bf6039f0SWarner Losh <listitem><para>Thread-specific caching (tcache) enabled/disabled. When 5067bf6039f0SWarner Losh there are multiple threads, each thread uses a tcache for objects up to 5068bf6039f0SWarner Losh a certain size. Thread-specific caching allows many allocations to be 5069bf6039f0SWarner Losh satisfied without performing any thread synchronization, at the cost of 5070bf6039f0SWarner Losh increased memory use. See the <link 5071bf6039f0SWarner Losh linkend="opt.lg_tcache_max"><mallctl>opt.lg_tcache_max</mallctl></link> 5072bf6039f0SWarner Losh option for related tuning information. This option is enabled by 5073bf6039f0SWarner Losh default.</para></listitem> 5074bf6039f0SWarner Losh </varlistentry> 5075bf6039f0SWarner Losh 5076bf6039f0SWarner Losh <varlistentry id="opt.lg_tcache_max"> 5077bf6039f0SWarner Losh <term> 5078bf6039f0SWarner Losh <mallctl>opt.lg_tcache_max</mallctl> 5079bf6039f0SWarner Losh (<type>size_t</type>) 5080bf6039f0SWarner Losh <literal>r-</literal> 5081bf6039f0SWarner Losh </term> 5082bf6039f0SWarner Losh <listitem><para>Maximum size class (log base 2) to cache in the 5083bf6039f0SWarner Losh thread-specific cache (tcache). At a minimum, all small size classes 5084bf6039f0SWarner Losh are cached, and at a maximum all large size classes are cached. The 5085bf6039f0SWarner Losh default maximum is 32 KiB (2^15).</para></listitem> 5086bf6039f0SWarner Losh </varlistentry> 5087bf6039f0SWarner Losh 5088bf6039f0SWarner Losh <varlistentry id="opt.thp"> 5089bf6039f0SWarner Losh <term> 5090bf6039f0SWarner Losh <mallctl>opt.thp</mallctl> 5091bf6039f0SWarner Losh (<type>const char *</type>) 5092bf6039f0SWarner Losh <literal>r-</literal> 5093bf6039f0SWarner Losh </term> 5094bf6039f0SWarner Losh <listitem><para>Transparent hugepage (THP) mode. Settings "always", 5095bf6039f0SWarner Losh "never" and "default" are available if THP is supported by the operating 5096bf6039f0SWarner Losh system. The "always" setting enables transparent hugepage for all user 5097bf6039f0SWarner Losh memory mappings with 5098bf6039f0SWarner Losh <parameter><constant>MADV_HUGEPAGE</constant></parameter>; "never" 5099bf6039f0SWarner Losh ensures no transparent hugepage with 5100bf6039f0SWarner Losh <parameter><constant>MADV_NOHUGEPAGE</constant></parameter>; the default 5101bf6039f0SWarner Losh setting "default" makes no changes. Note that: this option does not 5102bf6039f0SWarner Losh affect THP for jemalloc internal metadata (see <link 5103bf6039f0SWarner Losh linkend="opt.metadata_thp"><mallctl>opt.metadata_thp</mallctl></link>); 5104bf6039f0SWarner Losh in addition, for arenas with customized <link 5105bf6039f0SWarner Losh linkend="arena.i.extent_hooks"><mallctl>extent_hooks</mallctl></link>, 5106bf6039f0SWarner Losh this option is bypassed as it is implemented as part of the default 5107bf6039f0SWarner Losh extent hooks.</para></listitem> 5108bf6039f0SWarner Losh </varlistentry> 5109bf6039f0SWarner Losh 5110bf6039f0SWarner Losh <varlistentry id="opt.prof"> 5111bf6039f0SWarner Losh <term> 5112bf6039f0SWarner Losh <mallctl>opt.prof</mallctl> 5113bf6039f0SWarner Losh (<type>bool</type>) 5114bf6039f0SWarner Losh <literal>r-</literal> 5115bf6039f0SWarner Losh [<option>--enable-prof</option>] 5116bf6039f0SWarner Losh </term> 5117bf6039f0SWarner Losh <listitem><para>Memory profiling enabled/disabled. If enabled, profile 5118bf6039f0SWarner Losh memory allocation activity. See the <link 5119bf6039f0SWarner Losh linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link> 5120bf6039f0SWarner Losh option for on-the-fly activation/deactivation. See the <link 5121bf6039f0SWarner Losh linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link> 5122bf6039f0SWarner Losh option for probabilistic sampling control. See the <link 5123bf6039f0SWarner Losh linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link> 5124bf6039f0SWarner Losh option for control of cumulative sample reporting. See the <link 5125bf6039f0SWarner Losh linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link> 5126bf6039f0SWarner Losh option for information on interval-triggered profile dumping, the <link 5127bf6039f0SWarner Losh linkend="opt.prof_gdump"><mallctl>opt.prof_gdump</mallctl></link> 5128bf6039f0SWarner Losh option for information on high-water-triggered profile dumping, and the 5129bf6039f0SWarner Losh <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl></link> 5130bf6039f0SWarner Losh option for final profile dumping. Profile output is compatible with 5131bf6039f0SWarner Losh the <command>jeprof</command> command, which is based on the 5132bf6039f0SWarner Losh <command>pprof</command> that is developed as part of the <ulink 5133bf6039f0SWarner Losh url="http://code.google.com/p/gperftools/">gperftools 5134bf6039f0SWarner Losh package</ulink>. See <link linkend="heap_profile_format">HEAP PROFILE 5135bf6039f0SWarner Losh FORMAT</link> for heap profile format documentation.</para></listitem> 5136bf6039f0SWarner Losh </varlistentry> 5137bf6039f0SWarner Losh 5138bf6039f0SWarner Losh <varlistentry id="opt.prof_prefix"> 5139bf6039f0SWarner Losh <term> 5140bf6039f0SWarner Losh <mallctl>opt.prof_prefix</mallctl> 5141bf6039f0SWarner Losh (<type>const char *</type>) 5142bf6039f0SWarner Losh <literal>r-</literal> 5143bf6039f0SWarner Losh [<option>--enable-prof</option>] 5144bf6039f0SWarner Losh </term> 5145bf6039f0SWarner Losh <listitem><para>Filename prefix for profile dumps. If the prefix is 5146bf6039f0SWarner Losh set to the empty string, no automatic dumps will occur; this is 5147bf6039f0SWarner Losh primarily useful for disabling the automatic final heap dump (which 5148bf6039f0SWarner Losh also disables leak reporting, if enabled). The default prefix is 5149bf6039f0SWarner Losh <filename>jeprof</filename>.</para></listitem> 5150bf6039f0SWarner Losh </varlistentry> 5151bf6039f0SWarner Losh 5152bf6039f0SWarner Losh <varlistentry id="opt.prof_active"> 5153bf6039f0SWarner Losh <term> 5154bf6039f0SWarner Losh <mallctl>opt.prof_active</mallctl> 5155bf6039f0SWarner Losh (<type>bool</type>) 5156bf6039f0SWarner Losh <literal>r-</literal> 5157bf6039f0SWarner Losh [<option>--enable-prof</option>] 5158bf6039f0SWarner Losh </term> 5159bf6039f0SWarner Losh <listitem><para>Profiling activated/deactivated. This is a secondary 5160bf6039f0SWarner Losh control mechanism that makes it possible to start the application with 5161bf6039f0SWarner Losh profiling enabled (see the <link 5162bf6039f0SWarner Losh linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option) but 5163bf6039f0SWarner Losh inactive, then toggle profiling at any time during program execution 5164bf6039f0SWarner Losh with the <link 5165bf6039f0SWarner Losh linkend="prof.active"><mallctl>prof.active</mallctl></link> mallctl. 5166bf6039f0SWarner Losh This option is enabled by default.</para></listitem> 5167bf6039f0SWarner Losh </varlistentry> 5168bf6039f0SWarner Losh 5169bf6039f0SWarner Losh <varlistentry id="opt.prof_thread_active_init"> 5170bf6039f0SWarner Losh <term> 5171bf6039f0SWarner Losh <mallctl>opt.prof_thread_active_init</mallctl> 5172bf6039f0SWarner Losh (<type>bool</type>) 5173bf6039f0SWarner Losh <literal>r-</literal> 5174bf6039f0SWarner Losh [<option>--enable-prof</option>] 5175bf6039f0SWarner Losh </term> 5176bf6039f0SWarner Losh <listitem><para>Initial setting for <link 5177bf6039f0SWarner Losh linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link> 5178bf6039f0SWarner Losh in newly created threads. The initial setting for newly created threads 5179bf6039f0SWarner Losh can also be changed during execution via the <link 5180bf6039f0SWarner Losh linkend="prof.thread_active_init"><mallctl>prof.thread_active_init</mallctl></link> 5181bf6039f0SWarner Losh mallctl. This option is enabled by default.</para></listitem> 5182bf6039f0SWarner Losh </varlistentry> 5183bf6039f0SWarner Losh 5184bf6039f0SWarner Losh <varlistentry id="opt.lg_prof_sample"> 5185bf6039f0SWarner Losh <term> 5186bf6039f0SWarner Losh <mallctl>opt.lg_prof_sample</mallctl> 5187bf6039f0SWarner Losh (<type>size_t</type>) 5188bf6039f0SWarner Losh <literal>r-</literal> 5189bf6039f0SWarner Losh [<option>--enable-prof</option>] 5190bf6039f0SWarner Losh </term> 5191bf6039f0SWarner Losh <listitem><para>Average interval (log base 2) between allocation 5192bf6039f0SWarner Losh samples, as measured in bytes of allocation activity. Increasing the 5193bf6039f0SWarner Losh sampling interval decreases profile fidelity, but also decreases the 5194bf6039f0SWarner Losh computational overhead. The default sample interval is 512 KiB (2^19 5195bf6039f0SWarner Losh B).</para></listitem> 5196bf6039f0SWarner Losh </varlistentry> 5197bf6039f0SWarner Losh 5198bf6039f0SWarner Losh <varlistentry id="opt.prof_accum"> 5199bf6039f0SWarner Losh <term> 5200bf6039f0SWarner Losh <mallctl>opt.prof_accum</mallctl> 5201bf6039f0SWarner Losh (<type>bool</type>) 5202bf6039f0SWarner Losh <literal>r-</literal> 5203bf6039f0SWarner Losh [<option>--enable-prof</option>] 5204bf6039f0SWarner Losh </term> 5205bf6039f0SWarner Losh <listitem><para>Reporting of cumulative object/byte counts in profile 5206bf6039f0SWarner Losh dumps enabled/disabled. If this option is enabled, every unique 5207bf6039f0SWarner Losh backtrace must be stored for the duration of execution. Depending on 5208bf6039f0SWarner Losh the application, this can impose a large memory overhead, and the 5209bf6039f0SWarner Losh cumulative counts are not always of interest. This option is disabled 5210bf6039f0SWarner Losh by default.</para></listitem> 5211bf6039f0SWarner Losh </varlistentry> 5212bf6039f0SWarner Losh 5213bf6039f0SWarner Losh <varlistentry id="opt.lg_prof_interval"> 5214bf6039f0SWarner Losh <term> 5215bf6039f0SWarner Losh <mallctl>opt.lg_prof_interval</mallctl> 5216bf6039f0SWarner Losh (<type>ssize_t</type>) 5217bf6039f0SWarner Losh <literal>r-</literal> 5218bf6039f0SWarner Losh [<option>--enable-prof</option>] 5219bf6039f0SWarner Losh </term> 5220bf6039f0SWarner Losh <listitem><para>Average interval (log base 2) between memory profile 5221bf6039f0SWarner Losh dumps, as measured in bytes of allocation activity. The actual 5222bf6039f0SWarner Losh interval between dumps may be sporadic because decentralized allocation 5223bf6039f0SWarner Losh counters are used to avoid synchronization bottlenecks. Profiles are 5224bf6039f0SWarner Losh dumped to files named according to the pattern 5225bf6039f0SWarner Losh <filename><prefix>.<pid>.<seq>.i<iseq>.heap</filename>, 5226bf6039f0SWarner Losh where <literal><prefix></literal> is controlled by the 5227bf6039f0SWarner Losh <link 5228bf6039f0SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> 5229bf6039f0SWarner Losh option. By default, interval-triggered profile dumping is disabled 5230bf6039f0SWarner Losh (encoded as -1). 5231bf6039f0SWarner Losh </para></listitem> 5232bf6039f0SWarner Losh </varlistentry> 5233bf6039f0SWarner Losh 5234bf6039f0SWarner Losh <varlistentry id="opt.prof_gdump"> 5235bf6039f0SWarner Losh <term> 5236bf6039f0SWarner Losh <mallctl>opt.prof_gdump</mallctl> 5237bf6039f0SWarner Losh (<type>bool</type>) 5238bf6039f0SWarner Losh <literal>r-</literal> 5239bf6039f0SWarner Losh [<option>--enable-prof</option>] 5240bf6039f0SWarner Losh </term> 5241bf6039f0SWarner Losh <listitem><para>Set the initial state of <link 5242bf6039f0SWarner Losh linkend="prof.gdump"><mallctl>prof.gdump</mallctl></link>, which when 5243bf6039f0SWarner Losh enabled triggers a memory profile dump every time the total virtual 5244bf6039f0SWarner Losh memory exceeds the previous maximum. This option is disabled by 5245bf6039f0SWarner Losh default.</para></listitem> 5246bf6039f0SWarner Losh </varlistentry> 5247bf6039f0SWarner Losh 5248bf6039f0SWarner Losh <varlistentry id="opt.prof_final"> 5249bf6039f0SWarner Losh <term> 5250bf6039f0SWarner Losh <mallctl>opt.prof_final</mallctl> 5251bf6039f0SWarner Losh (<type>bool</type>) 5252bf6039f0SWarner Losh <literal>r-</literal> 5253bf6039f0SWarner Losh [<option>--enable-prof</option>] 5254bf6039f0SWarner Losh </term> 5255bf6039f0SWarner Losh <listitem><para>Use an 5256bf6039f0SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 5257bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry> function to dump final memory 5258bf6039f0SWarner Losh usage to a file named according to the pattern 5259bf6039f0SWarner Losh <filename><prefix>.<pid>.<seq>.f.heap</filename>, 5260bf6039f0SWarner Losh where <literal><prefix></literal> is controlled by the <link 5261bf6039f0SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> 5262bf6039f0SWarner Losh option. Note that <function>atexit()</function> may allocate 5263bf6039f0SWarner Losh memory during application initialization and then deadlock internally 5264bf6039f0SWarner Losh when jemalloc in turn calls <function>atexit()</function>, so 5265bf6039f0SWarner Losh this option is not universally usable (though the application can 5266bf6039f0SWarner Losh register its own <function>atexit()</function> function with 5267bf6039f0SWarner Losh equivalent functionality). This option is disabled by 5268bf6039f0SWarner Losh default.</para></listitem> 5269bf6039f0SWarner Losh </varlistentry> 5270bf6039f0SWarner Losh 5271bf6039f0SWarner Losh <varlistentry id="opt.prof_leak"> 5272bf6039f0SWarner Losh <term> 5273bf6039f0SWarner Losh <mallctl>opt.prof_leak</mallctl> 5274bf6039f0SWarner Losh (<type>bool</type>) 5275bf6039f0SWarner Losh <literal>r-</literal> 5276bf6039f0SWarner Losh [<option>--enable-prof</option>] 5277bf6039f0SWarner Losh </term> 5278bf6039f0SWarner Losh <listitem><para>Leak reporting enabled/disabled. If enabled, use an 5279bf6039f0SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 5280bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry> function to report memory leaks 5281bf6039f0SWarner Losh detected by allocation sampling. See the 5282bf6039f0SWarner Losh <link linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option for 5283bf6039f0SWarner Losh information on analyzing heap profile output. This option is disabled 5284bf6039f0SWarner Losh by default.</para></listitem> 5285bf6039f0SWarner Losh </varlistentry> 5286bf6039f0SWarner Losh 5287bf6039f0SWarner Losh <varlistentry id="thread.arena"> 5288bf6039f0SWarner Losh <term> 5289bf6039f0SWarner Losh <mallctl>thread.arena</mallctl> 5290bf6039f0SWarner Losh (<type>unsigned</type>) 5291bf6039f0SWarner Losh <literal>rw</literal> 5292bf6039f0SWarner Losh </term> 5293bf6039f0SWarner Losh <listitem><para>Get or set the arena associated with the calling 5294bf6039f0SWarner Losh thread. If the specified arena was not initialized beforehand (see the 5295bf6039f0SWarner Losh <link 5296bf6039f0SWarner Losh linkend="arena.i.initialized"><mallctl>arena.i.initialized</mallctl></link> 5297bf6039f0SWarner Losh mallctl), it will be automatically initialized as a side effect of 5298bf6039f0SWarner Losh calling this interface.</para></listitem> 5299bf6039f0SWarner Losh </varlistentry> 5300bf6039f0SWarner Losh 5301bf6039f0SWarner Losh <varlistentry id="thread.allocated"> 5302bf6039f0SWarner Losh <term> 5303bf6039f0SWarner Losh <mallctl>thread.allocated</mallctl> 5304bf6039f0SWarner Losh (<type>uint64_t</type>) 5305bf6039f0SWarner Losh <literal>r-</literal> 5306bf6039f0SWarner Losh [<option>--enable-stats</option>] 5307bf6039f0SWarner Losh </term> 5308bf6039f0SWarner Losh <listitem><para>Get the total number of bytes ever allocated by the 5309bf6039f0SWarner Losh calling thread. This counter has the potential to wrap around; it is 5310bf6039f0SWarner Losh up to the application to appropriately interpret the counter in such 5311bf6039f0SWarner Losh cases.</para></listitem> 5312bf6039f0SWarner Losh </varlistentry> 5313bf6039f0SWarner Losh 5314bf6039f0SWarner Losh <varlistentry id="thread.allocatedp"> 5315bf6039f0SWarner Losh <term> 5316bf6039f0SWarner Losh <mallctl>thread.allocatedp</mallctl> 5317bf6039f0SWarner Losh (<type>uint64_t *</type>) 5318bf6039f0SWarner Losh <literal>r-</literal> 5319bf6039f0SWarner Losh [<option>--enable-stats</option>] 5320bf6039f0SWarner Losh </term> 5321bf6039f0SWarner Losh <listitem><para>Get a pointer to the the value that is returned by the 5322bf6039f0SWarner Losh <link 5323bf6039f0SWarner Losh linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link> 5324bf6039f0SWarner Losh mallctl. This is useful for avoiding the overhead of repeated 5325bf6039f0SWarner Losh <function>mallctl*()</function> calls.</para></listitem> 5326bf6039f0SWarner Losh </varlistentry> 5327bf6039f0SWarner Losh 5328bf6039f0SWarner Losh <varlistentry id="thread.deallocated"> 5329bf6039f0SWarner Losh <term> 5330bf6039f0SWarner Losh <mallctl>thread.deallocated</mallctl> 5331bf6039f0SWarner Losh (<type>uint64_t</type>) 5332bf6039f0SWarner Losh <literal>r-</literal> 5333bf6039f0SWarner Losh [<option>--enable-stats</option>] 5334bf6039f0SWarner Losh </term> 5335bf6039f0SWarner Losh <listitem><para>Get the total number of bytes ever deallocated by the 5336bf6039f0SWarner Losh calling thread. This counter has the potential to wrap around; it is 5337bf6039f0SWarner Losh up to the application to appropriately interpret the counter in such 5338bf6039f0SWarner Losh cases.</para></listitem> 5339bf6039f0SWarner Losh </varlistentry> 5340bf6039f0SWarner Losh 5341bf6039f0SWarner Losh <varlistentry id="thread.deallocatedp"> 5342bf6039f0SWarner Losh <term> 5343bf6039f0SWarner Losh <mallctl>thread.deallocatedp</mallctl> 5344bf6039f0SWarner Losh (<type>uint64_t *</type>) 5345bf6039f0SWarner Losh <literal>r-</literal> 5346bf6039f0SWarner Losh [<option>--enable-stats</option>] 5347bf6039f0SWarner Losh </term> 5348bf6039f0SWarner Losh <listitem><para>Get a pointer to the the value that is returned by the 5349bf6039f0SWarner Losh <link 5350bf6039f0SWarner Losh linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link> 5351bf6039f0SWarner Losh mallctl. This is useful for avoiding the overhead of repeated 5352bf6039f0SWarner Losh <function>mallctl*()</function> calls.</para></listitem> 5353bf6039f0SWarner Losh </varlistentry> 5354bf6039f0SWarner Losh 5355bf6039f0SWarner Losh <varlistentry id="thread.tcache.enabled"> 5356bf6039f0SWarner Losh <term> 5357bf6039f0SWarner Losh <mallctl>thread.tcache.enabled</mallctl> 5358bf6039f0SWarner Losh (<type>bool</type>) 5359bf6039f0SWarner Losh <literal>rw</literal> 5360bf6039f0SWarner Losh </term> 5361bf6039f0SWarner Losh <listitem><para>Enable/disable calling thread's tcache. The tcache is 5362bf6039f0SWarner Losh implicitly flushed as a side effect of becoming 5363bf6039f0SWarner Losh disabled (see <link 5364bf6039f0SWarner Losh linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>). 5365bf6039f0SWarner Losh </para></listitem> 5366bf6039f0SWarner Losh </varlistentry> 5367bf6039f0SWarner Losh 5368bf6039f0SWarner Losh <varlistentry id="thread.tcache.flush"> 5369bf6039f0SWarner Losh <term> 5370bf6039f0SWarner Losh <mallctl>thread.tcache.flush</mallctl> 5371bf6039f0SWarner Losh (<type>void</type>) 5372bf6039f0SWarner Losh <literal>--</literal> 5373bf6039f0SWarner Losh </term> 5374bf6039f0SWarner Losh <listitem><para>Flush calling thread's thread-specific cache (tcache). 5375bf6039f0SWarner Losh This interface releases all cached objects and internal data structures 5376bf6039f0SWarner Losh associated with the calling thread's tcache. Ordinarily, this interface 5377bf6039f0SWarner Losh need not be called, since automatic periodic incremental garbage 5378bf6039f0SWarner Losh collection occurs, and the thread cache is automatically discarded when 5379bf6039f0SWarner Losh a thread exits. However, garbage collection is triggered by allocation 5380bf6039f0SWarner Losh activity, so it is possible for a thread that stops 5381bf6039f0SWarner Losh allocating/deallocating to retain its cache indefinitely, in which case 5382bf6039f0SWarner Losh the developer may find manual flushing useful.</para></listitem> 5383bf6039f0SWarner Losh </varlistentry> 5384bf6039f0SWarner Losh 5385bf6039f0SWarner Losh <varlistentry id="thread.prof.name"> 5386bf6039f0SWarner Losh <term> 5387bf6039f0SWarner Losh <mallctl>thread.prof.name</mallctl> 5388bf6039f0SWarner Losh (<type>const char *</type>) 5389bf6039f0SWarner Losh <literal>r-</literal> or 5390bf6039f0SWarner Losh <literal>-w</literal> 5391bf6039f0SWarner Losh [<option>--enable-prof</option>] 5392bf6039f0SWarner Losh </term> 5393bf6039f0SWarner Losh <listitem><para>Get/set the descriptive name associated with the calling 5394bf6039f0SWarner Losh thread in memory profile dumps. An internal copy of the name string is 5395bf6039f0SWarner Losh created, so the input string need not be maintained after this interface 5396bf6039f0SWarner Losh completes execution. The output string of this interface should be 5397bf6039f0SWarner Losh copied for non-ephemeral uses, because multiple implementation details 5398bf6039f0SWarner Losh can cause asynchronous string deallocation. Furthermore, each 5399bf6039f0SWarner Losh invocation of this interface can only read or write; simultaneous 5400bf6039f0SWarner Losh read/write is not supported due to string lifetime limitations. The 5401bf6039f0SWarner Losh name string must be nil-terminated and comprised only of characters in 5402bf6039f0SWarner Losh the sets recognized 5403bf6039f0SWarner Losh by <citerefentry><refentrytitle>isgraph</refentrytitle> 5404bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry> and 5405bf6039f0SWarner Losh <citerefentry><refentrytitle>isblank</refentrytitle> 5406bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry>.</para></listitem> 5407bf6039f0SWarner Losh </varlistentry> 5408bf6039f0SWarner Losh 5409bf6039f0SWarner Losh <varlistentry id="thread.prof.active"> 5410bf6039f0SWarner Losh <term> 5411bf6039f0SWarner Losh <mallctl>thread.prof.active</mallctl> 5412bf6039f0SWarner Losh (<type>bool</type>) 5413bf6039f0SWarner Losh <literal>rw</literal> 5414bf6039f0SWarner Losh [<option>--enable-prof</option>] 5415bf6039f0SWarner Losh </term> 5416bf6039f0SWarner Losh <listitem><para>Control whether sampling is currently active for the 5417bf6039f0SWarner Losh calling thread. This is an activation mechanism in addition to <link 5418bf6039f0SWarner Losh linkend="prof.active"><mallctl>prof.active</mallctl></link>; both must 5419bf6039f0SWarner Losh be active for the calling thread to sample. This flag is enabled by 5420bf6039f0SWarner Losh default.</para></listitem> 5421bf6039f0SWarner Losh </varlistentry> 5422bf6039f0SWarner Losh 5423bf6039f0SWarner Losh <varlistentry id="tcache.create"> 5424bf6039f0SWarner Losh <term> 5425bf6039f0SWarner Losh <mallctl>tcache.create</mallctl> 5426bf6039f0SWarner Losh (<type>unsigned</type>) 5427bf6039f0SWarner Losh <literal>r-</literal> 5428bf6039f0SWarner Losh </term> 5429bf6039f0SWarner Losh <listitem><para>Create an explicit thread-specific cache (tcache) and 5430bf6039f0SWarner Losh return an identifier that can be passed to the <link 5431bf6039f0SWarner Losh linkend="MALLOCX_TCACHE"><constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant></link> 5432bf6039f0SWarner Losh macro to explicitly use the specified cache rather than the 5433bf6039f0SWarner Losh automatically managed one that is used by default. Each explicit cache 5434bf6039f0SWarner Losh can be used by only one thread at a time; the application must assure 5435bf6039f0SWarner Losh that this constraint holds. 5436bf6039f0SWarner Losh </para></listitem> 5437bf6039f0SWarner Losh </varlistentry> 5438bf6039f0SWarner Losh 5439bf6039f0SWarner Losh <varlistentry id="tcache.flush"> 5440bf6039f0SWarner Losh <term> 5441bf6039f0SWarner Losh <mallctl>tcache.flush</mallctl> 5442bf6039f0SWarner Losh (<type>unsigned</type>) 5443bf6039f0SWarner Losh <literal>-w</literal> 5444bf6039f0SWarner Losh </term> 5445bf6039f0SWarner Losh <listitem><para>Flush the specified thread-specific cache (tcache). The 5446bf6039f0SWarner Losh same considerations apply to this interface as to <link 5447bf6039f0SWarner Losh linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>, 5448bf6039f0SWarner Losh except that the tcache will never be automatically discarded. 5449bf6039f0SWarner Losh </para></listitem> 5450bf6039f0SWarner Losh </varlistentry> 5451bf6039f0SWarner Losh 5452bf6039f0SWarner Losh <varlistentry id="tcache.destroy"> 5453bf6039f0SWarner Losh <term> 5454bf6039f0SWarner Losh <mallctl>tcache.destroy</mallctl> 5455bf6039f0SWarner Losh (<type>unsigned</type>) 5456bf6039f0SWarner Losh <literal>-w</literal> 5457bf6039f0SWarner Losh </term> 5458bf6039f0SWarner Losh <listitem><para>Flush the specified thread-specific cache (tcache) and 5459bf6039f0SWarner Losh make the identifier available for use during a future tcache creation. 5460bf6039f0SWarner Losh </para></listitem> 5461bf6039f0SWarner Losh </varlistentry> 5462bf6039f0SWarner Losh 5463bf6039f0SWarner Losh <varlistentry id="arena.i.initialized"> 5464bf6039f0SWarner Losh <term> 5465bf6039f0SWarner Losh <mallctl>arena.<i>.initialized</mallctl> 5466bf6039f0SWarner Losh (<type>bool</type>) 5467bf6039f0SWarner Losh <literal>r-</literal> 5468bf6039f0SWarner Losh </term> 5469bf6039f0SWarner Losh <listitem><para>Get whether the specified arena's statistics are 5470bf6039f0SWarner Losh initialized (i.e. the arena was initialized prior to the current epoch). 5471bf6039f0SWarner Losh This interface can also be nominally used to query whether the merged 5472bf6039f0SWarner Losh statistics corresponding to <constant>MALLCTL_ARENAS_ALL</constant> are 5473bf6039f0SWarner Losh initialized (always true).</para></listitem> 5474bf6039f0SWarner Losh </varlistentry> 5475bf6039f0SWarner Losh 5476bf6039f0SWarner Losh <varlistentry id="arena.i.decay"> 5477bf6039f0SWarner Losh <term> 5478bf6039f0SWarner Losh <mallctl>arena.<i>.decay</mallctl> 5479bf6039f0SWarner Losh (<type>void</type>) 5480bf6039f0SWarner Losh <literal>--</literal> 5481bf6039f0SWarner Losh </term> 5482bf6039f0SWarner Losh <listitem><para>Trigger decay-based purging of unused dirty/muzzy pages 5483bf6039f0SWarner Losh for arena <i>, or for all arenas if <i> equals 5484bf6039f0SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant>. The proportion of unused 5485bf6039f0SWarner Losh dirty/muzzy pages to be purged depends on the current time; see <link 5486bf6039f0SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 5487bf6039f0SWarner Losh and <link 5488bf6039f0SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzy_decay_ms</mallctl></link> 5489bf6039f0SWarner Losh for details.</para></listitem> 5490bf6039f0SWarner Losh </varlistentry> 5491bf6039f0SWarner Losh 5492bf6039f0SWarner Losh <varlistentry id="arena.i.purge"> 5493bf6039f0SWarner Losh <term> 5494bf6039f0SWarner Losh <mallctl>arena.<i>.purge</mallctl> 5495bf6039f0SWarner Losh (<type>void</type>) 5496bf6039f0SWarner Losh <literal>--</literal> 5497bf6039f0SWarner Losh </term> 5498bf6039f0SWarner Losh <listitem><para>Purge all unused dirty pages for arena <i>, or for 5499bf6039f0SWarner Losh all arenas if <i> equals <constant>MALLCTL_ARENAS_ALL</constant>. 5500bf6039f0SWarner Losh </para></listitem> 5501bf6039f0SWarner Losh </varlistentry> 5502bf6039f0SWarner Losh 5503bf6039f0SWarner Losh <varlistentry id="arena.i.reset"> 5504bf6039f0SWarner Losh <term> 5505bf6039f0SWarner Losh <mallctl>arena.<i>.reset</mallctl> 5506bf6039f0SWarner Losh (<type>void</type>) 5507bf6039f0SWarner Losh <literal>--</literal> 5508bf6039f0SWarner Losh </term> 5509bf6039f0SWarner Losh <listitem><para>Discard all of the arena's extant allocations. This 5510bf6039f0SWarner Losh interface can only be used with arenas explicitly created via <link 5511bf6039f0SWarner Losh linkend="arenas.create"><mallctl>arenas.create</mallctl></link>. None 5512bf6039f0SWarner Losh of the arena's discarded/cached allocations may accessed afterward. As 5513bf6039f0SWarner Losh part of this requirement, all thread caches which were used to 5514bf6039f0SWarner Losh allocate/deallocate in conjunction with the arena must be flushed 5515bf6039f0SWarner Losh beforehand.</para></listitem> 5516bf6039f0SWarner Losh </varlistentry> 5517bf6039f0SWarner Losh 5518bf6039f0SWarner Losh <varlistentry id="arena.i.destroy"> 5519bf6039f0SWarner Losh <term> 5520bf6039f0SWarner Losh <mallctl>arena.<i>.destroy</mallctl> 5521bf6039f0SWarner Losh (<type>void</type>) 5522bf6039f0SWarner Losh <literal>--</literal> 5523bf6039f0SWarner Losh </term> 5524bf6039f0SWarner Losh <listitem><para>Destroy the arena. Discard all of the arena's extant 5525bf6039f0SWarner Losh allocations using the same mechanism as for <link 5526bf6039f0SWarner Losh linkend="arena.i.reset"><mallctl>arena.<i>.reset</mallctl></link> 5527bf6039f0SWarner Losh (with all the same constraints and side effects), merge the arena stats 5528bf6039f0SWarner Losh into those accessible at arena index 5529bf6039f0SWarner Losh <constant>MALLCTL_ARENAS_DESTROYED</constant>, and then completely 5530bf6039f0SWarner Losh discard all metadata associated with the arena. Future calls to <link 5531bf6039f0SWarner Losh linkend="arenas.create"><mallctl>arenas.create</mallctl></link> may 5532bf6039f0SWarner Losh recycle the arena index. Destruction will fail if any threads are 5533bf6039f0SWarner Losh currently associated with the arena as a result of calls to <link 5534bf6039f0SWarner Losh linkend="thread.arena"><mallctl>thread.arena</mallctl></link>.</para></listitem> 5535bf6039f0SWarner Losh </varlistentry> 5536bf6039f0SWarner Losh 5537bf6039f0SWarner Losh <varlistentry id="arena.i.dss"> 5538bf6039f0SWarner Losh <term> 5539bf6039f0SWarner Losh <mallctl>arena.<i>.dss</mallctl> 5540bf6039f0SWarner Losh (<type>const char *</type>) 5541bf6039f0SWarner Losh <literal>rw</literal> 5542bf6039f0SWarner Losh </term> 5543bf6039f0SWarner Losh <listitem><para>Set the precedence of dss allocation as related to mmap 5544bf6039f0SWarner Losh allocation for arena <i>, or for all arenas if <i> equals 5545bf6039f0SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant>. See <link 5546bf6039f0SWarner Losh linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for supported 5547bf6039f0SWarner Losh settings.</para></listitem> 5548bf6039f0SWarner Losh </varlistentry> 5549bf6039f0SWarner Losh 5550bf6039f0SWarner Losh <varlistentry id="arena.i.dirty_decay_ms"> 5551bf6039f0SWarner Losh <term> 5552bf6039f0SWarner Losh <mallctl>arena.<i>.dirty_decay_ms</mallctl> 5553bf6039f0SWarner Losh (<type>ssize_t</type>) 5554bf6039f0SWarner Losh <literal>rw</literal> 5555bf6039f0SWarner Losh </term> 5556bf6039f0SWarner Losh <listitem><para>Current per-arena approximate time in milliseconds from 5557bf6039f0SWarner Losh the creation of a set of unused dirty pages until an equivalent set of 5558bf6039f0SWarner Losh unused dirty pages is purged and/or reused. Each time this interface is 5559bf6039f0SWarner Losh set, all currently unused dirty pages are considered to have fully 5560bf6039f0SWarner Losh decayed, which causes immediate purging of all unused dirty pages unless 5561bf6039f0SWarner Losh the decay time is set to -1 (i.e. purging disabled). See <link 5562bf6039f0SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 5563bf6039f0SWarner Losh for additional information.</para></listitem> 5564bf6039f0SWarner Losh </varlistentry> 5565bf6039f0SWarner Losh 5566bf6039f0SWarner Losh <varlistentry id="arena.i.muzzy_decay_ms"> 5567bf6039f0SWarner Losh <term> 5568bf6039f0SWarner Losh <mallctl>arena.<i>.muzzy_decay_ms</mallctl> 5569bf6039f0SWarner Losh (<type>ssize_t</type>) 5570bf6039f0SWarner Losh <literal>rw</literal> 5571bf6039f0SWarner Losh </term> 5572bf6039f0SWarner Losh <listitem><para>Current per-arena approximate time in milliseconds from 5573bf6039f0SWarner Losh the creation of a set of unused muzzy pages until an equivalent set of 5574bf6039f0SWarner Losh unused muzzy pages is purged and/or reused. Each time this interface is 5575bf6039f0SWarner Losh set, all currently unused muzzy pages are considered to have fully 5576bf6039f0SWarner Losh decayed, which causes immediate purging of all unused muzzy pages unless 5577bf6039f0SWarner Losh the decay time is set to -1 (i.e. purging disabled). See <link 5578bf6039f0SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 5579bf6039f0SWarner Losh for additional information.</para></listitem> 5580bf6039f0SWarner Losh </varlistentry> 5581bf6039f0SWarner Losh 5582bf6039f0SWarner Losh <varlistentry id="arena.i.retain_grow_limit"> 5583bf6039f0SWarner Losh <term> 5584bf6039f0SWarner Losh <mallctl>arena.<i>.retain_grow_limit</mallctl> 5585bf6039f0SWarner Losh (<type>size_t</type>) 5586bf6039f0SWarner Losh <literal>rw</literal> 5587bf6039f0SWarner Losh </term> 5588bf6039f0SWarner Losh <listitem><para>Maximum size to grow retained region (only relevant when 5589bf6039f0SWarner Losh <link linkend="opt.retain"><mallctl>opt.retain</mallctl></link> is 5590bf6039f0SWarner Losh enabled). This controls the maximum increment to expand virtual memory, 5591bf6039f0SWarner Losh or allocation through <link 5592bf6039f0SWarner Losh linkend="arena.i.extent_hooks"><mallctl>arena.<i>extent_hooks</mallctl></link>. 5593bf6039f0SWarner Losh In particular, if customized extent hooks reserve physical memory 5594bf6039f0SWarner Losh (e.g. 1G huge pages), this is useful to control the allocation hook's 5595bf6039f0SWarner Losh input size. The default is no limit.</para></listitem> 5596bf6039f0SWarner Losh </varlistentry> 5597bf6039f0SWarner Losh 5598bf6039f0SWarner Losh <varlistentry id="arena.i.extent_hooks"> 5599bf6039f0SWarner Losh <term> 5600bf6039f0SWarner Losh <mallctl>arena.<i>.extent_hooks</mallctl> 5601bf6039f0SWarner Losh (<type>extent_hooks_t *</type>) 5602bf6039f0SWarner Losh <literal>rw</literal> 5603bf6039f0SWarner Losh </term> 5604bf6039f0SWarner Losh <listitem><para>Get or set the extent management hook functions for 5605bf6039f0SWarner Losh arena <i>. The functions must be capable of operating on all 5606bf6039f0SWarner Losh extant extents associated with arena <i>, usually by passing 5607bf6039f0SWarner Losh unknown extents to the replaced functions. In practice, it is feasible 5608bf6039f0SWarner Losh to control allocation for arenas explicitly created via <link 5609bf6039f0SWarner Losh linkend="arenas.create"><mallctl>arenas.create</mallctl></link> such 5610bf6039f0SWarner Losh that all extents originate from an application-supplied extent allocator 5611bf6039f0SWarner Losh (by specifying the custom extent hook functions during arena creation). 5612bf6039f0SWarner Losh However, the API guarantees for the automatically created arenas may be 5613bf6039f0SWarner Losh relaxed -- hooks set there may be called in a "best effort" fashion; in 5614bf6039f0SWarner Losh addition there may be extents created prior to the application having an 5615bf6039f0SWarner Losh opportunity to take over extent allocation.</para> 5616bf6039f0SWarner Losh 5617bf6039f0SWarner Losh <programlisting language="C"><![CDATA[ 5618bf6039f0SWarner Loshtypedef extent_hooks_s extent_hooks_t; 5619bf6039f0SWarner Loshstruct extent_hooks_s { 5620bf6039f0SWarner Losh extent_alloc_t *alloc; 5621bf6039f0SWarner Losh extent_dalloc_t *dalloc; 5622bf6039f0SWarner Losh extent_destroy_t *destroy; 5623bf6039f0SWarner Losh extent_commit_t *commit; 5624bf6039f0SWarner Losh extent_decommit_t *decommit; 5625bf6039f0SWarner Losh extent_purge_t *purge_lazy; 5626bf6039f0SWarner Losh extent_purge_t *purge_forced; 5627bf6039f0SWarner Losh extent_split_t *split; 5628bf6039f0SWarner Losh extent_merge_t *merge; 5629bf6039f0SWarner Losh};]]></programlisting> 5630bf6039f0SWarner Losh <para>The <type>extent_hooks_t</type> structure comprises function 5631bf6039f0SWarner Losh pointers which are described individually below. jemalloc uses these 5632bf6039f0SWarner Losh functions to manage extent lifetime, which starts off with allocation of 5633bf6039f0SWarner Losh mapped committed memory, in the simplest case followed by deallocation. 5634bf6039f0SWarner Losh However, there are performance and platform reasons to retain extents 5635bf6039f0SWarner Losh for later reuse. Cleanup attempts cascade from deallocation to decommit 5636bf6039f0SWarner Losh to forced purging to lazy purging, which gives the extent management 5637bf6039f0SWarner Losh functions opportunities to reject the most permanent cleanup operations 5638bf6039f0SWarner Losh in favor of less permanent (and often less costly) operations. All 5639bf6039f0SWarner Losh operations except allocation can be universally opted out of by setting 5640bf6039f0SWarner Losh the hook pointers to <constant>NULL</constant>, or selectively opted out 5641bf6039f0SWarner Losh of by returning failure. Note that once the extent hook is set, the 5642bf6039f0SWarner Losh structure is accessed directly by the associated arenas, so it must 5643bf6039f0SWarner Losh remain valid for the entire lifetime of the arenas.</para> 5644bf6039f0SWarner Losh 5645bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5646bf6039f0SWarner Losh <funcdef>typedef void *<function>(extent_alloc_t)</function></funcdef> 5647bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5648bf6039f0SWarner Losh <paramdef>void *<parameter>new_addr</parameter></paramdef> 5649bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5650bf6039f0SWarner Losh <paramdef>size_t <parameter>alignment</parameter></paramdef> 5651bf6039f0SWarner Losh <paramdef>bool *<parameter>zero</parameter></paramdef> 5652bf6039f0SWarner Losh <paramdef>bool *<parameter>commit</parameter></paramdef> 5653bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5654bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5655bf6039f0SWarner Losh <literallayout></literallayout> 5656bf6039f0SWarner Losh <para>An extent allocation function conforms to the 5657bf6039f0SWarner Losh <type>extent_alloc_t</type> type and upon success returns a pointer to 5658bf6039f0SWarner Losh <parameter>size</parameter> bytes of mapped memory on behalf of arena 5659bf6039f0SWarner Losh <parameter>arena_ind</parameter> such that the extent's base address is 5660bf6039f0SWarner Losh a multiple of <parameter>alignment</parameter>, as well as setting 5661bf6039f0SWarner Losh <parameter>*zero</parameter> to indicate whether the extent is zeroed 5662bf6039f0SWarner Losh and <parameter>*commit</parameter> to indicate whether the extent is 5663bf6039f0SWarner Losh committed. Upon error the function returns <constant>NULL</constant> 5664bf6039f0SWarner Losh and leaves <parameter>*zero</parameter> and 5665bf6039f0SWarner Losh <parameter>*commit</parameter> unmodified. The 5666bf6039f0SWarner Losh <parameter>size</parameter> parameter is always a multiple of the page 5667bf6039f0SWarner Losh size. The <parameter>alignment</parameter> parameter is always a power 5668bf6039f0SWarner Losh of two at least as large as the page size. Zeroing is mandatory if 5669bf6039f0SWarner Losh <parameter>*zero</parameter> is true upon function entry. Committing is 5670bf6039f0SWarner Losh mandatory if <parameter>*commit</parameter> is true upon function entry. 5671bf6039f0SWarner Losh If <parameter>new_addr</parameter> is not <constant>NULL</constant>, the 5672bf6039f0SWarner Losh returned pointer must be <parameter>new_addr</parameter> on success or 5673bf6039f0SWarner Losh <constant>NULL</constant> on error. Committed memory may be committed 5674bf6039f0SWarner Losh in absolute terms as on a system that does not overcommit, or in 5675bf6039f0SWarner Losh implicit terms as on a system that overcommits and satisfies physical 5676bf6039f0SWarner Losh memory needs on demand via soft page faults. Note that replacing the 5677bf6039f0SWarner Losh default extent allocation function makes the arena's <link 5678bf6039f0SWarner Losh linkend="arena.i.dss"><mallctl>arena.<i>.dss</mallctl></link> 5679bf6039f0SWarner Losh setting irrelevant.</para> 5680bf6039f0SWarner Losh 5681bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5682bf6039f0SWarner Losh <funcdef>typedef bool <function>(extent_dalloc_t)</function></funcdef> 5683bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5684bf6039f0SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 5685bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5686bf6039f0SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 5687bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5688bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5689bf6039f0SWarner Losh <literallayout></literallayout> 5690bf6039f0SWarner Losh <para> 5691bf6039f0SWarner Losh An extent deallocation function conforms to the 5692bf6039f0SWarner Losh <type>extent_dalloc_t</type> type and deallocates an extent at given 5693bf6039f0SWarner Losh <parameter>addr</parameter> and <parameter>size</parameter> with 5694bf6039f0SWarner Losh <parameter>committed</parameter>/decommited memory as indicated, on 5695bf6039f0SWarner Losh behalf of arena <parameter>arena_ind</parameter>, returning false upon 5696bf6039f0SWarner Losh success. If the function returns true, this indicates opt-out from 5697bf6039f0SWarner Losh deallocation; the virtual memory mapping associated with the extent 5698bf6039f0SWarner Losh remains mapped, in the same commit state, and available for future use, 5699bf6039f0SWarner Losh in which case it will be automatically retained for later reuse.</para> 5700bf6039f0SWarner Losh 5701bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5702bf6039f0SWarner Losh <funcdef>typedef void <function>(extent_destroy_t)</function></funcdef> 5703bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5704bf6039f0SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 5705bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5706bf6039f0SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 5707bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5708bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5709bf6039f0SWarner Losh <literallayout></literallayout> 5710bf6039f0SWarner Losh <para> 5711bf6039f0SWarner Losh An extent destruction function conforms to the 5712bf6039f0SWarner Losh <type>extent_destroy_t</type> type and unconditionally destroys an 5713bf6039f0SWarner Losh extent at given <parameter>addr</parameter> and 5714bf6039f0SWarner Losh <parameter>size</parameter> with 5715bf6039f0SWarner Losh <parameter>committed</parameter>/decommited memory as indicated, on 5716bf6039f0SWarner Losh behalf of arena <parameter>arena_ind</parameter>. This function may be 5717bf6039f0SWarner Losh called to destroy retained extents during arena destruction (see <link 5718bf6039f0SWarner Losh linkend="arena.i.destroy"><mallctl>arena.<i>.destroy</mallctl></link>).</para> 5719bf6039f0SWarner Losh 5720bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5721bf6039f0SWarner Losh <funcdef>typedef bool <function>(extent_commit_t)</function></funcdef> 5722bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5723bf6039f0SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 5724bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5725bf6039f0SWarner Losh <paramdef>size_t <parameter>offset</parameter></paramdef> 5726bf6039f0SWarner Losh <paramdef>size_t <parameter>length</parameter></paramdef> 5727bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5728bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5729bf6039f0SWarner Losh <literallayout></literallayout> 5730bf6039f0SWarner Losh <para>An extent commit function conforms to the 5731bf6039f0SWarner Losh <type>extent_commit_t</type> type and commits zeroed physical memory to 5732bf6039f0SWarner Losh back pages within an extent at given <parameter>addr</parameter> and 5733bf6039f0SWarner Losh <parameter>size</parameter> at <parameter>offset</parameter> bytes, 5734bf6039f0SWarner Losh extending for <parameter>length</parameter> on behalf of arena 5735bf6039f0SWarner Losh <parameter>arena_ind</parameter>, returning false upon success. 5736bf6039f0SWarner Losh Committed memory may be committed in absolute terms as on a system that 5737bf6039f0SWarner Losh does not overcommit, or in implicit terms as on a system that 5738bf6039f0SWarner Losh overcommits and satisfies physical memory needs on demand via soft page 5739bf6039f0SWarner Losh faults. If the function returns true, this indicates insufficient 5740bf6039f0SWarner Losh physical memory to satisfy the request.</para> 5741bf6039f0SWarner Losh 5742bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5743bf6039f0SWarner Losh <funcdef>typedef bool <function>(extent_decommit_t)</function></funcdef> 5744bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5745bf6039f0SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 5746bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5747bf6039f0SWarner Losh <paramdef>size_t <parameter>offset</parameter></paramdef> 5748bf6039f0SWarner Losh <paramdef>size_t <parameter>length</parameter></paramdef> 5749bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5750bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5751bf6039f0SWarner Losh <literallayout></literallayout> 5752bf6039f0SWarner Losh <para>An extent decommit function conforms to the 5753bf6039f0SWarner Losh <type>extent_decommit_t</type> type and decommits any physical memory 5754bf6039f0SWarner Losh that is backing pages within an extent at given 5755bf6039f0SWarner Losh <parameter>addr</parameter> and <parameter>size</parameter> at 5756bf6039f0SWarner Losh <parameter>offset</parameter> bytes, extending for 5757bf6039f0SWarner Losh <parameter>length</parameter> on behalf of arena 5758bf6039f0SWarner Losh <parameter>arena_ind</parameter>, returning false upon success, in which 5759bf6039f0SWarner Losh case the pages will be committed via the extent commit function before 5760bf6039f0SWarner Losh being reused. If the function returns true, this indicates opt-out from 5761bf6039f0SWarner Losh decommit; the memory remains committed and available for future use, in 5762bf6039f0SWarner Losh which case it will be automatically retained for later reuse.</para> 5763bf6039f0SWarner Losh 5764bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5765bf6039f0SWarner Losh <funcdef>typedef bool <function>(extent_purge_t)</function></funcdef> 5766bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5767bf6039f0SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 5768bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5769bf6039f0SWarner Losh <paramdef>size_t <parameter>offset</parameter></paramdef> 5770bf6039f0SWarner Losh <paramdef>size_t <parameter>length</parameter></paramdef> 5771bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5772bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5773bf6039f0SWarner Losh <literallayout></literallayout> 5774bf6039f0SWarner Losh <para>An extent purge function conforms to the 5775bf6039f0SWarner Losh <type>extent_purge_t</type> type and discards physical pages 5776bf6039f0SWarner Losh within the virtual memory mapping associated with an extent at given 5777bf6039f0SWarner Losh <parameter>addr</parameter> and <parameter>size</parameter> at 5778bf6039f0SWarner Losh <parameter>offset</parameter> bytes, extending for 5779bf6039f0SWarner Losh <parameter>length</parameter> on behalf of arena 5780bf6039f0SWarner Losh <parameter>arena_ind</parameter>. A lazy extent purge function (e.g. 5781bf6039f0SWarner Losh implemented via 5782bf6039f0SWarner Losh <function>madvise(<parameter>...</parameter><parameter><constant>MADV_FREE</constant></parameter>)</function>) 5783bf6039f0SWarner Losh can delay purging indefinitely and leave the pages within the purged 5784bf6039f0SWarner Losh virtual memory range in an indeterminite state, whereas a forced extent 5785bf6039f0SWarner Losh purge function immediately purges, and the pages within the virtual 5786bf6039f0SWarner Losh memory range will be zero-filled the next time they are accessed. If 5787bf6039f0SWarner Losh the function returns true, this indicates failure to purge.</para> 5788bf6039f0SWarner Losh 5789bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5790bf6039f0SWarner Losh <funcdef>typedef bool <function>(extent_split_t)</function></funcdef> 5791bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5792bf6039f0SWarner Losh <paramdef>void *<parameter>addr</parameter></paramdef> 5793bf6039f0SWarner Losh <paramdef>size_t <parameter>size</parameter></paramdef> 5794bf6039f0SWarner Losh <paramdef>size_t <parameter>size_a</parameter></paramdef> 5795bf6039f0SWarner Losh <paramdef>size_t <parameter>size_b</parameter></paramdef> 5796bf6039f0SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 5797bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5798bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5799bf6039f0SWarner Losh <literallayout></literallayout> 5800bf6039f0SWarner Losh <para>An extent split function conforms to the 5801bf6039f0SWarner Losh <type>extent_split_t</type> type and optionally splits an extent at 5802bf6039f0SWarner Losh given <parameter>addr</parameter> and <parameter>size</parameter> into 5803bf6039f0SWarner Losh two adjacent extents, the first of <parameter>size_a</parameter> bytes, 5804bf6039f0SWarner Losh and the second of <parameter>size_b</parameter> bytes, operating on 5805bf6039f0SWarner Losh <parameter>committed</parameter>/decommitted memory as indicated, on 5806bf6039f0SWarner Losh behalf of arena <parameter>arena_ind</parameter>, returning false upon 5807bf6039f0SWarner Losh success. If the function returns true, this indicates that the extent 5808bf6039f0SWarner Losh remains unsplit and therefore should continue to be operated on as a 5809bf6039f0SWarner Losh whole.</para> 5810bf6039f0SWarner Losh 5811bf6039f0SWarner Losh <funcsynopsis><funcprototype> 5812bf6039f0SWarner Losh <funcdef>typedef bool <function>(extent_merge_t)</function></funcdef> 5813bf6039f0SWarner Losh <paramdef>extent_hooks_t *<parameter>extent_hooks</parameter></paramdef> 5814bf6039f0SWarner Losh <paramdef>void *<parameter>addr_a</parameter></paramdef> 5815bf6039f0SWarner Losh <paramdef>size_t <parameter>size_a</parameter></paramdef> 5816bf6039f0SWarner Losh <paramdef>void *<parameter>addr_b</parameter></paramdef> 5817bf6039f0SWarner Losh <paramdef>size_t <parameter>size_b</parameter></paramdef> 5818bf6039f0SWarner Losh <paramdef>bool <parameter>committed</parameter></paramdef> 5819bf6039f0SWarner Losh <paramdef>unsigned <parameter>arena_ind</parameter></paramdef> 5820bf6039f0SWarner Losh </funcprototype></funcsynopsis> 5821bf6039f0SWarner Losh <literallayout></literallayout> 5822bf6039f0SWarner Losh <para>An extent merge function conforms to the 5823bf6039f0SWarner Losh <type>extent_merge_t</type> type and optionally merges adjacent extents, 5824bf6039f0SWarner Losh at given <parameter>addr_a</parameter> and <parameter>size_a</parameter> 5825bf6039f0SWarner Losh with given <parameter>addr_b</parameter> and 5826bf6039f0SWarner Losh <parameter>size_b</parameter> into one contiguous extent, operating on 5827bf6039f0SWarner Losh <parameter>committed</parameter>/decommitted memory as indicated, on 5828bf6039f0SWarner Losh behalf of arena <parameter>arena_ind</parameter>, returning false upon 5829bf6039f0SWarner Losh success. If the function returns true, this indicates that the extents 5830bf6039f0SWarner Losh remain distinct mappings and therefore should continue to be operated on 5831bf6039f0SWarner Losh independently.</para> 5832bf6039f0SWarner Losh </listitem> 5833bf6039f0SWarner Losh </varlistentry> 5834bf6039f0SWarner Losh 5835bf6039f0SWarner Losh <varlistentry id="arenas.narenas"> 5836bf6039f0SWarner Losh <term> 5837bf6039f0SWarner Losh <mallctl>arenas.narenas</mallctl> 5838bf6039f0SWarner Losh (<type>unsigned</type>) 5839bf6039f0SWarner Losh <literal>r-</literal> 5840bf6039f0SWarner Losh </term> 5841bf6039f0SWarner Losh <listitem><para>Current limit on number of arenas.</para></listitem> 5842bf6039f0SWarner Losh </varlistentry> 5843bf6039f0SWarner Losh 5844bf6039f0SWarner Losh <varlistentry id="arenas.dirty_decay_ms"> 5845bf6039f0SWarner Losh <term> 5846bf6039f0SWarner Losh <mallctl>arenas.dirty_decay_ms</mallctl> 5847bf6039f0SWarner Losh (<type>ssize_t</type>) 5848bf6039f0SWarner Losh <literal>rw</literal> 5849bf6039f0SWarner Losh </term> 5850bf6039f0SWarner Losh <listitem><para>Current default per-arena approximate time in 5851bf6039f0SWarner Losh milliseconds from the creation of a set of unused dirty pages until an 5852bf6039f0SWarner Losh equivalent set of unused dirty pages is purged and/or reused, used to 5853bf6039f0SWarner Losh initialize <link 5854bf6039f0SWarner Losh linkend="arena.i.dirty_decay_ms"><mallctl>arena.<i>.dirty_decay_ms</mallctl></link> 5855bf6039f0SWarner Losh during arena creation. See <link 5856bf6039f0SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 5857bf6039f0SWarner Losh for additional information.</para></listitem> 5858bf6039f0SWarner Losh </varlistentry> 5859bf6039f0SWarner Losh 5860bf6039f0SWarner Losh <varlistentry id="arenas.muzzy_decay_ms"> 5861bf6039f0SWarner Losh <term> 5862bf6039f0SWarner Losh <mallctl>arenas.muzzy_decay_ms</mallctl> 5863bf6039f0SWarner Losh (<type>ssize_t</type>) 5864bf6039f0SWarner Losh <literal>rw</literal> 5865bf6039f0SWarner Losh </term> 5866bf6039f0SWarner Losh <listitem><para>Current default per-arena approximate time in 5867bf6039f0SWarner Losh milliseconds from the creation of a set of unused muzzy pages until an 5868bf6039f0SWarner Losh equivalent set of unused muzzy pages is purged and/or reused, used to 5869bf6039f0SWarner Losh initialize <link 5870bf6039f0SWarner Losh linkend="arena.i.muzzy_decay_ms"><mallctl>arena.<i>.muzzy_decay_ms</mallctl></link> 5871bf6039f0SWarner Losh during arena creation. See <link 5872bf6039f0SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 5873bf6039f0SWarner Losh for additional information.</para></listitem> 5874bf6039f0SWarner Losh </varlistentry> 5875bf6039f0SWarner Losh 5876bf6039f0SWarner Losh <varlistentry id="arenas.quantum"> 5877bf6039f0SWarner Losh <term> 5878bf6039f0SWarner Losh <mallctl>arenas.quantum</mallctl> 5879bf6039f0SWarner Losh (<type>size_t</type>) 5880bf6039f0SWarner Losh <literal>r-</literal> 5881bf6039f0SWarner Losh </term> 5882bf6039f0SWarner Losh <listitem><para>Quantum size.</para></listitem> 5883bf6039f0SWarner Losh </varlistentry> 5884bf6039f0SWarner Losh 5885bf6039f0SWarner Losh <varlistentry id="arenas.page"> 5886bf6039f0SWarner Losh <term> 5887bf6039f0SWarner Losh <mallctl>arenas.page</mallctl> 5888bf6039f0SWarner Losh (<type>size_t</type>) 5889bf6039f0SWarner Losh <literal>r-</literal> 5890bf6039f0SWarner Losh </term> 5891bf6039f0SWarner Losh <listitem><para>Page size.</para></listitem> 5892bf6039f0SWarner Losh </varlistentry> 5893bf6039f0SWarner Losh 5894bf6039f0SWarner Losh <varlistentry id="arenas.tcache_max"> 5895bf6039f0SWarner Losh <term> 5896bf6039f0SWarner Losh <mallctl>arenas.tcache_max</mallctl> 5897bf6039f0SWarner Losh (<type>size_t</type>) 5898bf6039f0SWarner Losh <literal>r-</literal> 5899bf6039f0SWarner Losh </term> 5900bf6039f0SWarner Losh <listitem><para>Maximum thread-cached size class.</para></listitem> 5901bf6039f0SWarner Losh </varlistentry> 5902bf6039f0SWarner Losh 5903bf6039f0SWarner Losh <varlistentry id="arenas.nbins"> 5904bf6039f0SWarner Losh <term> 5905bf6039f0SWarner Losh <mallctl>arenas.nbins</mallctl> 5906bf6039f0SWarner Losh (<type>unsigned</type>) 5907bf6039f0SWarner Losh <literal>r-</literal> 5908bf6039f0SWarner Losh </term> 5909bf6039f0SWarner Losh <listitem><para>Number of bin size classes.</para></listitem> 5910bf6039f0SWarner Losh </varlistentry> 5911bf6039f0SWarner Losh 5912bf6039f0SWarner Losh <varlistentry id="arenas.nhbins"> 5913bf6039f0SWarner Losh <term> 5914bf6039f0SWarner Losh <mallctl>arenas.nhbins</mallctl> 5915bf6039f0SWarner Losh (<type>unsigned</type>) 5916bf6039f0SWarner Losh <literal>r-</literal> 5917bf6039f0SWarner Losh </term> 5918bf6039f0SWarner Losh <listitem><para>Total number of thread cache bin size 5919bf6039f0SWarner Losh classes.</para></listitem> 5920bf6039f0SWarner Losh </varlistentry> 5921bf6039f0SWarner Losh 5922bf6039f0SWarner Losh <varlistentry id="arenas.bin.i.size"> 5923bf6039f0SWarner Losh <term> 5924bf6039f0SWarner Losh <mallctl>arenas.bin.<i>.size</mallctl> 5925bf6039f0SWarner Losh (<type>size_t</type>) 5926bf6039f0SWarner Losh <literal>r-</literal> 5927bf6039f0SWarner Losh </term> 5928bf6039f0SWarner Losh <listitem><para>Maximum size supported by size class.</para></listitem> 5929bf6039f0SWarner Losh </varlistentry> 5930bf6039f0SWarner Losh 5931bf6039f0SWarner Losh <varlistentry id="arenas.bin.i.nregs"> 5932bf6039f0SWarner Losh <term> 5933bf6039f0SWarner Losh <mallctl>arenas.bin.<i>.nregs</mallctl> 5934bf6039f0SWarner Losh (<type>uint32_t</type>) 5935bf6039f0SWarner Losh <literal>r-</literal> 5936bf6039f0SWarner Losh </term> 5937bf6039f0SWarner Losh <listitem><para>Number of regions per slab.</para></listitem> 5938bf6039f0SWarner Losh </varlistentry> 5939bf6039f0SWarner Losh 5940bf6039f0SWarner Losh <varlistentry id="arenas.bin.i.slab_size"> 5941bf6039f0SWarner Losh <term> 5942bf6039f0SWarner Losh <mallctl>arenas.bin.<i>.slab_size</mallctl> 5943bf6039f0SWarner Losh (<type>size_t</type>) 5944bf6039f0SWarner Losh <literal>r-</literal> 5945bf6039f0SWarner Losh </term> 5946bf6039f0SWarner Losh <listitem><para>Number of bytes per slab.</para></listitem> 5947bf6039f0SWarner Losh </varlistentry> 5948bf6039f0SWarner Losh 5949bf6039f0SWarner Losh <varlistentry id="arenas.nlextents"> 5950bf6039f0SWarner Losh <term> 5951bf6039f0SWarner Losh <mallctl>arenas.nlextents</mallctl> 5952bf6039f0SWarner Losh (<type>unsigned</type>) 5953bf6039f0SWarner Losh <literal>r-</literal> 5954bf6039f0SWarner Losh </term> 5955bf6039f0SWarner Losh <listitem><para>Total number of large size classes.</para></listitem> 5956bf6039f0SWarner Losh </varlistentry> 5957bf6039f0SWarner Losh 5958bf6039f0SWarner Losh <varlistentry id="arenas.lextent.i.size"> 5959bf6039f0SWarner Losh <term> 5960bf6039f0SWarner Losh <mallctl>arenas.lextent.<i>.size</mallctl> 5961bf6039f0SWarner Losh (<type>size_t</type>) 5962bf6039f0SWarner Losh <literal>r-</literal> 5963bf6039f0SWarner Losh </term> 5964bf6039f0SWarner Losh <listitem><para>Maximum size supported by this large size 5965bf6039f0SWarner Losh class.</para></listitem> 5966bf6039f0SWarner Losh </varlistentry> 5967bf6039f0SWarner Losh 5968bf6039f0SWarner Losh <varlistentry id="arenas.create"> 5969bf6039f0SWarner Losh <term> 5970bf6039f0SWarner Losh <mallctl>arenas.create</mallctl> 5971bf6039f0SWarner Losh (<type>unsigned</type>, <type>extent_hooks_t *</type>) 5972bf6039f0SWarner Losh <literal>rw</literal> 5973bf6039f0SWarner Losh </term> 5974bf6039f0SWarner Losh <listitem><para>Explicitly create a new arena outside the range of 5975bf6039f0SWarner Losh automatically managed arenas, with optionally specified extent hooks, 5976bf6039f0SWarner Losh and return the new arena index.</para></listitem> 5977bf6039f0SWarner Losh </varlistentry> 5978bf6039f0SWarner Losh 5979bf6039f0SWarner Losh <varlistentry id="arenas.lookup"> 5980bf6039f0SWarner Losh <term> 5981bf6039f0SWarner Losh <mallctl>arenas.lookup</mallctl> 5982bf6039f0SWarner Losh (<type>unsigned</type>, <type>void*</type>) 5983bf6039f0SWarner Losh <literal>rw</literal> 5984bf6039f0SWarner Losh </term> 5985bf6039f0SWarner Losh <listitem><para>Index of the arena to which an allocation belongs to.</para></listitem> 5986bf6039f0SWarner Losh </varlistentry> 5987bf6039f0SWarner Losh 5988bf6039f0SWarner Losh <varlistentry id="prof.thread_active_init"> 5989bf6039f0SWarner Losh <term> 5990bf6039f0SWarner Losh <mallctl>prof.thread_active_init</mallctl> 5991bf6039f0SWarner Losh (<type>bool</type>) 5992bf6039f0SWarner Losh <literal>rw</literal> 5993bf6039f0SWarner Losh [<option>--enable-prof</option>] 5994bf6039f0SWarner Losh </term> 5995bf6039f0SWarner Losh <listitem><para>Control the initial setting for <link 5996bf6039f0SWarner Losh linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link> 5997bf6039f0SWarner Losh in newly created threads. See the <link 5998bf6039f0SWarner Losh linkend="opt.prof_thread_active_init"><mallctl>opt.prof_thread_active_init</mallctl></link> 5999bf6039f0SWarner Losh option for additional information.</para></listitem> 6000bf6039f0SWarner Losh </varlistentry> 6001bf6039f0SWarner Losh 6002bf6039f0SWarner Losh <varlistentry id="prof.active"> 6003bf6039f0SWarner Losh <term> 6004bf6039f0SWarner Losh <mallctl>prof.active</mallctl> 6005bf6039f0SWarner Losh (<type>bool</type>) 6006bf6039f0SWarner Losh <literal>rw</literal> 6007bf6039f0SWarner Losh [<option>--enable-prof</option>] 6008bf6039f0SWarner Losh </term> 6009bf6039f0SWarner Losh <listitem><para>Control whether sampling is currently active. See the 6010bf6039f0SWarner Losh <link 6011bf6039f0SWarner Losh linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link> 6012bf6039f0SWarner Losh option for additional information, as well as the interrelated <link 6013bf6039f0SWarner Losh linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link> 6014bf6039f0SWarner Losh mallctl.</para></listitem> 6015bf6039f0SWarner Losh </varlistentry> 6016bf6039f0SWarner Losh 6017bf6039f0SWarner Losh <varlistentry id="prof.dump"> 6018bf6039f0SWarner Losh <term> 6019bf6039f0SWarner Losh <mallctl>prof.dump</mallctl> 6020bf6039f0SWarner Losh (<type>const char *</type>) 6021bf6039f0SWarner Losh <literal>-w</literal> 6022bf6039f0SWarner Losh [<option>--enable-prof</option>] 6023bf6039f0SWarner Losh </term> 6024bf6039f0SWarner Losh <listitem><para>Dump a memory profile to the specified file, or if NULL 6025bf6039f0SWarner Losh is specified, to a file according to the pattern 6026bf6039f0SWarner Losh <filename><prefix>.<pid>.<seq>.m<mseq>.heap</filename>, 6027bf6039f0SWarner Losh where <literal><prefix></literal> is controlled by the 6028bf6039f0SWarner Losh <link 6029bf6039f0SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> 6030bf6039f0SWarner Losh option.</para></listitem> 6031bf6039f0SWarner Losh </varlistentry> 6032bf6039f0SWarner Losh 6033bf6039f0SWarner Losh <varlistentry id="prof.gdump"> 6034bf6039f0SWarner Losh <term> 6035bf6039f0SWarner Losh <mallctl>prof.gdump</mallctl> 6036bf6039f0SWarner Losh (<type>bool</type>) 6037bf6039f0SWarner Losh <literal>rw</literal> 6038bf6039f0SWarner Losh [<option>--enable-prof</option>] 6039bf6039f0SWarner Losh </term> 6040bf6039f0SWarner Losh <listitem><para>When enabled, trigger a memory profile dump every time 6041bf6039f0SWarner Losh the total virtual memory exceeds the previous maximum. Profiles are 6042bf6039f0SWarner Losh dumped to files named according to the pattern 6043bf6039f0SWarner Losh <filename><prefix>.<pid>.<seq>.u<useq>.heap</filename>, 6044bf6039f0SWarner Losh where <literal><prefix></literal> is controlled by the <link 6045bf6039f0SWarner Losh linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> 6046bf6039f0SWarner Losh option.</para></listitem> 6047bf6039f0SWarner Losh </varlistentry> 6048bf6039f0SWarner Losh 6049bf6039f0SWarner Losh <varlistentry id="prof.reset"> 6050bf6039f0SWarner Losh <term> 6051bf6039f0SWarner Losh <mallctl>prof.reset</mallctl> 6052bf6039f0SWarner Losh (<type>size_t</type>) 6053bf6039f0SWarner Losh <literal>-w</literal> 6054bf6039f0SWarner Losh [<option>--enable-prof</option>] 6055bf6039f0SWarner Losh </term> 6056bf6039f0SWarner Losh <listitem><para>Reset all memory profile statistics, and optionally 6057bf6039f0SWarner Losh update the sample rate (see <link 6058bf6039f0SWarner Losh linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link> 6059bf6039f0SWarner Losh and <link 6060bf6039f0SWarner Losh linkend="prof.lg_sample"><mallctl>prof.lg_sample</mallctl></link>). 6061bf6039f0SWarner Losh </para></listitem> 6062bf6039f0SWarner Losh </varlistentry> 6063bf6039f0SWarner Losh 6064bf6039f0SWarner Losh <varlistentry id="prof.lg_sample"> 6065bf6039f0SWarner Losh <term> 6066bf6039f0SWarner Losh <mallctl>prof.lg_sample</mallctl> 6067bf6039f0SWarner Losh (<type>size_t</type>) 6068bf6039f0SWarner Losh <literal>r-</literal> 6069bf6039f0SWarner Losh [<option>--enable-prof</option>] 6070bf6039f0SWarner Losh </term> 6071bf6039f0SWarner Losh <listitem><para>Get the current sample rate (see <link 6072bf6039f0SWarner Losh linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>). 6073bf6039f0SWarner Losh </para></listitem> 6074bf6039f0SWarner Losh </varlistentry> 6075bf6039f0SWarner Losh 6076bf6039f0SWarner Losh <varlistentry id="prof.interval"> 6077bf6039f0SWarner Losh <term> 6078bf6039f0SWarner Losh <mallctl>prof.interval</mallctl> 6079bf6039f0SWarner Losh (<type>uint64_t</type>) 6080bf6039f0SWarner Losh <literal>r-</literal> 6081bf6039f0SWarner Losh [<option>--enable-prof</option>] 6082bf6039f0SWarner Losh </term> 6083bf6039f0SWarner Losh <listitem><para>Average number of bytes allocated between 6084bf6039f0SWarner Losh interval-based profile dumps. See the 6085bf6039f0SWarner Losh <link 6086bf6039f0SWarner Losh linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link> 6087bf6039f0SWarner Losh option for additional information.</para></listitem> 6088bf6039f0SWarner Losh </varlistentry> 6089bf6039f0SWarner Losh 6090bf6039f0SWarner Losh <varlistentry id="stats.allocated"> 6091bf6039f0SWarner Losh <term> 6092bf6039f0SWarner Losh <mallctl>stats.allocated</mallctl> 6093bf6039f0SWarner Losh (<type>size_t</type>) 6094bf6039f0SWarner Losh <literal>r-</literal> 6095bf6039f0SWarner Losh [<option>--enable-stats</option>] 6096bf6039f0SWarner Losh </term> 6097bf6039f0SWarner Losh <listitem><para>Total number of bytes allocated by the 6098bf6039f0SWarner Losh application.</para></listitem> 6099bf6039f0SWarner Losh </varlistentry> 6100bf6039f0SWarner Losh 6101bf6039f0SWarner Losh <varlistentry id="stats.active"> 6102bf6039f0SWarner Losh <term> 6103bf6039f0SWarner Losh <mallctl>stats.active</mallctl> 6104bf6039f0SWarner Losh (<type>size_t</type>) 6105bf6039f0SWarner Losh <literal>r-</literal> 6106bf6039f0SWarner Losh [<option>--enable-stats</option>] 6107bf6039f0SWarner Losh </term> 6108bf6039f0SWarner Losh <listitem><para>Total number of bytes in active pages allocated by the 6109bf6039f0SWarner Losh application. This is a multiple of the page size, and greater than or 6110bf6039f0SWarner Losh equal to <link 6111bf6039f0SWarner Losh linkend="stats.allocated"><mallctl>stats.allocated</mallctl></link>. 6112bf6039f0SWarner Losh This does not include <link linkend="stats.arenas.i.pdirty"> 6113bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.pdirty</mallctl></link>, 6114bf6039f0SWarner Losh <link linkend="stats.arenas.i.pmuzzy"> 6115bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.pmuzzy</mallctl></link>, nor pages 6116bf6039f0SWarner Losh entirely devoted to allocator metadata.</para></listitem> 6117bf6039f0SWarner Losh </varlistentry> 6118bf6039f0SWarner Losh 6119bf6039f0SWarner Losh <varlistentry id="stats.metadata"> 6120bf6039f0SWarner Losh <term> 6121bf6039f0SWarner Losh <mallctl>stats.metadata</mallctl> 6122bf6039f0SWarner Losh (<type>size_t</type>) 6123bf6039f0SWarner Losh <literal>r-</literal> 6124bf6039f0SWarner Losh [<option>--enable-stats</option>] 6125bf6039f0SWarner Losh </term> 6126bf6039f0SWarner Losh <listitem><para>Total number of bytes dedicated to metadata, which 6127bf6039f0SWarner Losh comprise base allocations used for bootstrap-sensitive allocator 6128bf6039f0SWarner Losh metadata structures (see <link 6129bf6039f0SWarner Losh linkend="stats.arenas.i.base"><mallctl>stats.arenas.<i>.base</mallctl></link>) 6130bf6039f0SWarner Losh and internal allocations (see <link 6131bf6039f0SWarner Losh linkend="stats.arenas.i.internal"><mallctl>stats.arenas.<i>.internal</mallctl></link>). 6132bf6039f0SWarner Losh Transparent huge page (enabled with <link 6133bf6039f0SWarner Losh linkend="opt.metadata_thp">opt.metadata_thp</link>) usage is not 6134bf6039f0SWarner Losh considered.</para></listitem> 6135bf6039f0SWarner Losh </varlistentry> 6136bf6039f0SWarner Losh 6137bf6039f0SWarner Losh <varlistentry id="stats.metadata_thp"> 6138bf6039f0SWarner Losh <term> 6139bf6039f0SWarner Losh <mallctl>stats.metadata_thp</mallctl> 6140bf6039f0SWarner Losh (<type>size_t</type>) 6141bf6039f0SWarner Losh <literal>r-</literal> 6142bf6039f0SWarner Losh [<option>--enable-stats</option>] 6143bf6039f0SWarner Losh </term> 6144bf6039f0SWarner Losh <listitem><para>Number of transparent huge pages (THP) used for 6145bf6039f0SWarner Losh metadata. See <link 6146bf6039f0SWarner Losh linkend="stats.metadata"><mallctl>stats.metadata</mallctl></link> and 6147bf6039f0SWarner Losh <link linkend="opt.metadata_thp">opt.metadata_thp</link>) for 6148bf6039f0SWarner Losh details.</para></listitem> 6149bf6039f0SWarner Losh </varlistentry> 6150bf6039f0SWarner Losh 6151bf6039f0SWarner Losh <varlistentry id="stats.resident"> 6152bf6039f0SWarner Losh <term> 6153bf6039f0SWarner Losh <mallctl>stats.resident</mallctl> 6154bf6039f0SWarner Losh (<type>size_t</type>) 6155bf6039f0SWarner Losh <literal>r-</literal> 6156bf6039f0SWarner Losh [<option>--enable-stats</option>] 6157bf6039f0SWarner Losh </term> 6158bf6039f0SWarner Losh <listitem><para>Maximum number of bytes in physically resident data 6159bf6039f0SWarner Losh pages mapped by the allocator, comprising all pages dedicated to 6160bf6039f0SWarner Losh allocator metadata, pages backing active allocations, and unused dirty 6161bf6039f0SWarner Losh pages. This is a maximum rather than precise because pages may not 6162bf6039f0SWarner Losh actually be physically resident if they correspond to demand-zeroed 6163bf6039f0SWarner Losh virtual memory that has not yet been touched. This is a multiple of the 6164bf6039f0SWarner Losh page size, and is larger than <link 6165bf6039f0SWarner Losh linkend="stats.active"><mallctl>stats.active</mallctl></link>.</para></listitem> 6166bf6039f0SWarner Losh </varlistentry> 6167bf6039f0SWarner Losh 6168bf6039f0SWarner Losh <varlistentry id="stats.mapped"> 6169bf6039f0SWarner Losh <term> 6170bf6039f0SWarner Losh <mallctl>stats.mapped</mallctl> 6171bf6039f0SWarner Losh (<type>size_t</type>) 6172bf6039f0SWarner Losh <literal>r-</literal> 6173bf6039f0SWarner Losh [<option>--enable-stats</option>] 6174bf6039f0SWarner Losh </term> 6175bf6039f0SWarner Losh <listitem><para>Total number of bytes in active extents mapped by the 6176bf6039f0SWarner Losh allocator. This is larger than <link 6177bf6039f0SWarner Losh linkend="stats.active"><mallctl>stats.active</mallctl></link>. This 6178bf6039f0SWarner Losh does not include inactive extents, even those that contain unused dirty 6179bf6039f0SWarner Losh pages, which means that there is no strict ordering between this and 6180bf6039f0SWarner Losh <link 6181bf6039f0SWarner Losh linkend="stats.resident"><mallctl>stats.resident</mallctl></link>.</para></listitem> 6182bf6039f0SWarner Losh </varlistentry> 6183bf6039f0SWarner Losh 6184bf6039f0SWarner Losh <varlistentry id="stats.retained"> 6185bf6039f0SWarner Losh <term> 6186bf6039f0SWarner Losh <mallctl>stats.retained</mallctl> 6187bf6039f0SWarner Losh (<type>size_t</type>) 6188bf6039f0SWarner Losh <literal>r-</literal> 6189bf6039f0SWarner Losh [<option>--enable-stats</option>] 6190bf6039f0SWarner Losh </term> 6191bf6039f0SWarner Losh <listitem><para>Total number of bytes in virtual memory mappings that 6192bf6039f0SWarner Losh were retained rather than being returned to the operating system via 6193bf6039f0SWarner Losh e.g. <citerefentry><refentrytitle>munmap</refentrytitle> 6194bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> or similar. Retained virtual 6195bf6039f0SWarner Losh memory is typically untouched, decommitted, or purged, so it has no 6196bf6039f0SWarner Losh strongly associated physical memory (see <link 6197bf6039f0SWarner Losh linkend="arena.i.extent_hooks">extent hooks</link> for details). 6198bf6039f0SWarner Losh Retained memory is excluded from mapped memory statistics, e.g. <link 6199bf6039f0SWarner Losh linkend="stats.mapped"><mallctl>stats.mapped</mallctl></link>. 6200bf6039f0SWarner Losh </para></listitem> 6201bf6039f0SWarner Losh </varlistentry> 6202bf6039f0SWarner Losh 6203bf6039f0SWarner Losh <varlistentry id="stats.background_thread.num_threads"> 6204bf6039f0SWarner Losh <term> 6205bf6039f0SWarner Losh <mallctl>stats.background_thread.num_threads</mallctl> 6206bf6039f0SWarner Losh (<type>size_t</type>) 6207bf6039f0SWarner Losh <literal>r-</literal> 6208bf6039f0SWarner Losh [<option>--enable-stats</option>] 6209bf6039f0SWarner Losh </term> 6210bf6039f0SWarner Losh <listitem><para> Number of <link linkend="background_thread">background 6211bf6039f0SWarner Losh threads</link> running currently.</para></listitem> 6212bf6039f0SWarner Losh </varlistentry> 6213bf6039f0SWarner Losh 6214bf6039f0SWarner Losh <varlistentry id="stats.background_thread.num_runs"> 6215bf6039f0SWarner Losh <term> 6216bf6039f0SWarner Losh <mallctl>stats.background_thread.num_runs</mallctl> 6217bf6039f0SWarner Losh (<type>uint64_t</type>) 6218bf6039f0SWarner Losh <literal>r-</literal> 6219bf6039f0SWarner Losh [<option>--enable-stats</option>] 6220bf6039f0SWarner Losh </term> 6221bf6039f0SWarner Losh <listitem><para> Total number of runs from all <link 6222bf6039f0SWarner Losh linkend="background_thread">background threads</link>.</para></listitem> 6223bf6039f0SWarner Losh </varlistentry> 6224bf6039f0SWarner Losh 6225bf6039f0SWarner Losh <varlistentry id="stats.background_thread.run_interval"> 6226bf6039f0SWarner Losh <term> 6227bf6039f0SWarner Losh <mallctl>stats.background_thread.run_interval</mallctl> 6228bf6039f0SWarner Losh (<type>uint64_t</type>) 6229bf6039f0SWarner Losh <literal>r-</literal> 6230bf6039f0SWarner Losh [<option>--enable-stats</option>] 6231bf6039f0SWarner Losh </term> 6232bf6039f0SWarner Losh <listitem><para> Average run interval in nanoseconds of <link 6233bf6039f0SWarner Losh linkend="background_thread">background threads</link>.</para></listitem> 6234bf6039f0SWarner Losh </varlistentry> 6235bf6039f0SWarner Losh 6236bf6039f0SWarner Losh <varlistentry id="stats.mutexes.ctl"> 6237bf6039f0SWarner Losh <term> 6238bf6039f0SWarner Losh <mallctl>stats.mutexes.ctl.{counter};</mallctl> 6239bf6039f0SWarner Losh (<type>counter specific type</type>) 6240bf6039f0SWarner Losh <literal>r-</literal> 6241bf6039f0SWarner Losh [<option>--enable-stats</option>] 6242bf6039f0SWarner Losh </term> 6243bf6039f0SWarner Losh <listitem><para>Statistics on <varname>ctl</varname> mutex (global 6244bf6039f0SWarner Losh scope; mallctl related). <mallctl>{counter}</mallctl> is one of the 6245bf6039f0SWarner Losh counters below:</para> 6246bf6039f0SWarner Losh <varlistentry id="mutex_counters"> 6247bf6039f0SWarner Losh <listitem><para><varname>num_ops</varname> (<type>uint64_t</type>): 6248bf6039f0SWarner Losh Total number of lock acquisition operations on this mutex.</para> 6249bf6039f0SWarner Losh 6250bf6039f0SWarner Losh <para><varname>num_spin_acq</varname> (<type>uint64_t</type>): Number 6251bf6039f0SWarner Losh of times the mutex was spin-acquired. When the mutex is currently 6252bf6039f0SWarner Losh locked and cannot be acquired immediately, a short period of 6253bf6039f0SWarner Losh spin-retry within jemalloc will be performed. Acquired through spin 6254bf6039f0SWarner Losh generally means the contention was lightweight and not causing context 6255bf6039f0SWarner Losh switches.</para> 6256bf6039f0SWarner Losh 6257bf6039f0SWarner Losh <para><varname>num_wait</varname> (<type>uint64_t</type>): Number of 6258bf6039f0SWarner Losh times the mutex was wait-acquired, which means the mutex contention 6259bf6039f0SWarner Losh was not solved by spin-retry, and blocking operation was likely 6260bf6039f0SWarner Losh involved in order to acquire the mutex. This event generally implies 6261bf6039f0SWarner Losh higher cost / longer delay, and should be investigated if it happens 6262bf6039f0SWarner Losh often.</para> 6263bf6039f0SWarner Losh 6264bf6039f0SWarner Losh <para><varname>max_wait_time</varname> (<type>uint64_t</type>): 6265bf6039f0SWarner Losh Maximum length of time in nanoseconds spent on a single wait-acquired 6266bf6039f0SWarner Losh lock operation. Note that to avoid profiling overhead on the common 6267bf6039f0SWarner Losh path, this does not consider spin-acquired cases.</para> 6268bf6039f0SWarner Losh 6269bf6039f0SWarner Losh <para><varname>total_wait_time</varname> (<type>uint64_t</type>): 6270bf6039f0SWarner Losh Cumulative time in nanoseconds spent on wait-acquired lock operations. 6271bf6039f0SWarner Losh Similarly, spin-acquired cases are not considered.</para> 6272bf6039f0SWarner Losh 6273bf6039f0SWarner Losh <para><varname>max_num_thds</varname> (<type>uint32_t</type>): Maximum 6274bf6039f0SWarner Losh number of threads waiting on this mutex simultaneously. Similarly, 6275bf6039f0SWarner Losh spin-acquired cases are not considered.</para> 6276bf6039f0SWarner Losh 6277bf6039f0SWarner Losh <para><varname>num_owner_switch</varname> (<type>uint64_t</type>): 6278bf6039f0SWarner Losh Number of times the current mutex owner is different from the previous 6279bf6039f0SWarner Losh one. This event does not generally imply an issue; rather it is an 6280bf6039f0SWarner Losh indicator of how often the protected data are accessed by different 6281bf6039f0SWarner Losh threads. 6282bf6039f0SWarner Losh </para> 6283bf6039f0SWarner Losh </listitem> 6284bf6039f0SWarner Losh </varlistentry> 6285bf6039f0SWarner Losh </listitem> 6286bf6039f0SWarner Losh </varlistentry> 6287bf6039f0SWarner Losh 6288bf6039f0SWarner Losh <varlistentry id="stats.mutexes.background_thread"> 6289bf6039f0SWarner Losh <term> 6290bf6039f0SWarner Losh <mallctl>stats.mutexes.background_thread.{counter}</mallctl> 6291bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6292bf6039f0SWarner Losh [<option>--enable-stats</option>] 6293bf6039f0SWarner Losh </term> 6294bf6039f0SWarner Losh <listitem><para>Statistics on <varname>background_thread</varname> mutex 6295bf6039f0SWarner Losh (global scope; <link 6296bf6039f0SWarner Losh linkend="background_thread"><mallctl>background_thread</mallctl></link> 6297bf6039f0SWarner Losh related). <mallctl>{counter}</mallctl> is one of the counters in <link 6298bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6299bf6039f0SWarner Losh counters</link>.</para></listitem> 6300bf6039f0SWarner Losh </varlistentry> 6301bf6039f0SWarner Losh 6302bf6039f0SWarner Losh <varlistentry id="stats.mutexes.prof"> 6303bf6039f0SWarner Losh <term> 6304bf6039f0SWarner Losh <mallctl>stats.mutexes.prof.{counter}</mallctl> 6305bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6306bf6039f0SWarner Losh [<option>--enable-stats</option>] 6307bf6039f0SWarner Losh </term> 6308bf6039f0SWarner Losh <listitem><para>Statistics on <varname>prof</varname> mutex (global 6309bf6039f0SWarner Losh scope; profiling related). <mallctl>{counter}</mallctl> is one of the 6310bf6039f0SWarner Losh counters in <link linkend="mutex_counters">mutex profiling 6311bf6039f0SWarner Losh counters</link>.</para></listitem> 6312bf6039f0SWarner Losh </varlistentry> 6313bf6039f0SWarner Losh 6314bf6039f0SWarner Losh <varlistentry id="stats.mutexes.reset"> 6315bf6039f0SWarner Losh <term> 6316bf6039f0SWarner Losh <mallctl>stats.mutexes.reset</mallctl> 6317bf6039f0SWarner Losh (<type>void</type>) <literal>--</literal> 6318bf6039f0SWarner Losh [<option>--enable-stats</option>] 6319bf6039f0SWarner Losh </term> 6320bf6039f0SWarner Losh <listitem><para>Reset all mutex profile statistics, including global 6321bf6039f0SWarner Losh mutexes, arena mutexes and bin mutexes.</para></listitem> 6322bf6039f0SWarner Losh </varlistentry> 6323bf6039f0SWarner Losh 6324bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.dss"> 6325bf6039f0SWarner Losh <term> 6326bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.dss</mallctl> 6327bf6039f0SWarner Losh (<type>const char *</type>) 6328bf6039f0SWarner Losh <literal>r-</literal> 6329bf6039f0SWarner Losh </term> 6330bf6039f0SWarner Losh <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle> 6331bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>) allocation precedence as 6332bf6039f0SWarner Losh related to <citerefentry><refentrytitle>mmap</refentrytitle> 6333bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry> allocation. See <link 6334bf6039f0SWarner Losh linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for details. 6335bf6039f0SWarner Losh </para></listitem> 6336bf6039f0SWarner Losh </varlistentry> 6337bf6039f0SWarner Losh 6338bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.dirty_decay_ms"> 6339bf6039f0SWarner Losh <term> 6340bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.dirty_decay_ms</mallctl> 6341bf6039f0SWarner Losh (<type>ssize_t</type>) 6342bf6039f0SWarner Losh <literal>r-</literal> 6343bf6039f0SWarner Losh </term> 6344bf6039f0SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 6345bf6039f0SWarner Losh set of unused dirty pages until an equivalent set of unused dirty pages 6346bf6039f0SWarner Losh is purged and/or reused. See <link 6347bf6039f0SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 6348bf6039f0SWarner Losh for details.</para></listitem> 6349bf6039f0SWarner Losh </varlistentry> 6350bf6039f0SWarner Losh 6351bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.muzzy_decay_ms"> 6352bf6039f0SWarner Losh <term> 6353bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.muzzy_decay_ms</mallctl> 6354bf6039f0SWarner Losh (<type>ssize_t</type>) 6355bf6039f0SWarner Losh <literal>r-</literal> 6356bf6039f0SWarner Losh </term> 6357bf6039f0SWarner Losh <listitem><para>Approximate time in milliseconds from the creation of a 6358bf6039f0SWarner Losh set of unused muzzy pages until an equivalent set of unused muzzy pages 6359bf6039f0SWarner Losh is purged and/or reused. See <link 6360bf6039f0SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 6361bf6039f0SWarner Losh for details.</para></listitem> 6362bf6039f0SWarner Losh </varlistentry> 6363bf6039f0SWarner Losh 6364bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.nthreads"> 6365bf6039f0SWarner Losh <term> 6366bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.nthreads</mallctl> 6367bf6039f0SWarner Losh (<type>unsigned</type>) 6368bf6039f0SWarner Losh <literal>r-</literal> 6369bf6039f0SWarner Losh </term> 6370bf6039f0SWarner Losh <listitem><para>Number of threads currently assigned to 6371bf6039f0SWarner Losh arena.</para></listitem> 6372bf6039f0SWarner Losh </varlistentry> 6373bf6039f0SWarner Losh 6374bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.uptime"> 6375bf6039f0SWarner Losh <term> 6376bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.uptime</mallctl> 6377bf6039f0SWarner Losh (<type>uint64_t</type>) 6378bf6039f0SWarner Losh <literal>r-</literal> 6379bf6039f0SWarner Losh </term> 6380bf6039f0SWarner Losh <listitem><para>Time elapsed (in nanoseconds) since the arena was 6381bf6039f0SWarner Losh created. If <i> equals <constant>0</constant> or 6382bf6039f0SWarner Losh <constant>MALLCTL_ARENAS_ALL</constant>, this is the uptime since malloc 6383bf6039f0SWarner Losh initialization.</para></listitem> 6384bf6039f0SWarner Losh </varlistentry> 6385bf6039f0SWarner Losh 6386bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.pactive"> 6387bf6039f0SWarner Losh <term> 6388bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.pactive</mallctl> 6389bf6039f0SWarner Losh (<type>size_t</type>) 6390bf6039f0SWarner Losh <literal>r-</literal> 6391bf6039f0SWarner Losh </term> 6392bf6039f0SWarner Losh <listitem><para>Number of pages in active extents.</para></listitem> 6393bf6039f0SWarner Losh </varlistentry> 6394bf6039f0SWarner Losh 6395bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.pdirty"> 6396bf6039f0SWarner Losh <term> 6397bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.pdirty</mallctl> 6398bf6039f0SWarner Losh (<type>size_t</type>) 6399bf6039f0SWarner Losh <literal>r-</literal> 6400bf6039f0SWarner Losh </term> 6401bf6039f0SWarner Losh <listitem><para>Number of pages within unused extents that are 6402bf6039f0SWarner Losh potentially dirty, and for which <function>madvise()</function> or 6403bf6039f0SWarner Losh similar has not been called. See <link 6404bf6039f0SWarner Losh linkend="opt.dirty_decay_ms"><mallctl>opt.dirty_decay_ms</mallctl></link> 6405bf6039f0SWarner Losh for a description of dirty pages.</para></listitem> 6406bf6039f0SWarner Losh </varlistentry> 6407bf6039f0SWarner Losh 6408bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.pmuzzy"> 6409bf6039f0SWarner Losh <term> 6410bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.pmuzzy</mallctl> 6411bf6039f0SWarner Losh (<type>size_t</type>) 6412bf6039f0SWarner Losh <literal>r-</literal> 6413bf6039f0SWarner Losh </term> 6414bf6039f0SWarner Losh <listitem><para>Number of pages within unused extents that are muzzy. 6415bf6039f0SWarner Losh See <link 6416bf6039f0SWarner Losh linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> 6417bf6039f0SWarner Losh for a description of muzzy pages.</para></listitem> 6418bf6039f0SWarner Losh </varlistentry> 6419bf6039f0SWarner Losh 6420bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mapped"> 6421bf6039f0SWarner Losh <term> 6422bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mapped</mallctl> 6423bf6039f0SWarner Losh (<type>size_t</type>) 6424bf6039f0SWarner Losh <literal>r-</literal> 6425bf6039f0SWarner Losh [<option>--enable-stats</option>] 6426bf6039f0SWarner Losh </term> 6427bf6039f0SWarner Losh <listitem><para>Number of mapped bytes.</para></listitem> 6428bf6039f0SWarner Losh </varlistentry> 6429bf6039f0SWarner Losh 6430bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.retained"> 6431bf6039f0SWarner Losh <term> 6432bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.retained</mallctl> 6433bf6039f0SWarner Losh (<type>size_t</type>) 6434bf6039f0SWarner Losh <literal>r-</literal> 6435bf6039f0SWarner Losh [<option>--enable-stats</option>] 6436bf6039f0SWarner Losh </term> 6437bf6039f0SWarner Losh <listitem><para>Number of retained bytes. See <link 6438bf6039f0SWarner Losh linkend="stats.retained"><mallctl>stats.retained</mallctl></link> for 6439bf6039f0SWarner Losh details.</para></listitem> 6440bf6039f0SWarner Losh </varlistentry> 6441bf6039f0SWarner Losh 6442bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.extent_avail"> 6443bf6039f0SWarner Losh <term> 6444bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.extent_avail</mallctl> 6445bf6039f0SWarner Losh (<type>size_t</type>) 6446bf6039f0SWarner Losh <literal>r-</literal> 6447bf6039f0SWarner Losh [<option>--enable-stats</option>] 6448bf6039f0SWarner Losh </term> 6449bf6039f0SWarner Losh <listitem><para>Number of allocated (but unused) extent structs in this 6450bf6039f0SWarner Losh arena.</para></listitem> 6451bf6039f0SWarner Losh </varlistentry> 6452bf6039f0SWarner Losh 6453bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.base"> 6454bf6039f0SWarner Losh <term> 6455bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.base</mallctl> 6456bf6039f0SWarner Losh (<type>size_t</type>) 6457bf6039f0SWarner Losh <literal>r-</literal> 6458bf6039f0SWarner Losh [<option>--enable-stats</option>] 6459bf6039f0SWarner Losh </term> 6460bf6039f0SWarner Losh <listitem><para> 6461bf6039f0SWarner Losh Number of bytes dedicated to bootstrap-sensitive allocator metadata 6462bf6039f0SWarner Losh structures.</para></listitem> 6463bf6039f0SWarner Losh </varlistentry> 6464bf6039f0SWarner Losh 6465bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.internal"> 6466bf6039f0SWarner Losh <term> 6467bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.internal</mallctl> 6468bf6039f0SWarner Losh (<type>size_t</type>) 6469bf6039f0SWarner Losh <literal>r-</literal> 6470bf6039f0SWarner Losh [<option>--enable-stats</option>] 6471bf6039f0SWarner Losh </term> 6472bf6039f0SWarner Losh <listitem><para>Number of bytes dedicated to internal allocations. 6473bf6039f0SWarner Losh Internal allocations differ from application-originated allocations in 6474bf6039f0SWarner Losh that they are for internal use, and that they are omitted from heap 6475bf6039f0SWarner Losh profiles.</para></listitem> 6476bf6039f0SWarner Losh </varlistentry> 6477bf6039f0SWarner Losh 6478bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.metadata_thp"> 6479bf6039f0SWarner Losh <term> 6480bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.metadata_thp</mallctl> 6481bf6039f0SWarner Losh (<type>size_t</type>) 6482bf6039f0SWarner Losh <literal>r-</literal> 6483bf6039f0SWarner Losh [<option>--enable-stats</option>] 6484bf6039f0SWarner Losh </term> 6485bf6039f0SWarner Losh <listitem><para>Number of transparent huge pages (THP) used for 6486bf6039f0SWarner Losh metadata. See <link linkend="opt.metadata_thp">opt.metadata_thp</link> 6487bf6039f0SWarner Losh for details.</para></listitem> 6488bf6039f0SWarner Losh </varlistentry> 6489bf6039f0SWarner Losh 6490bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.resident"> 6491bf6039f0SWarner Losh <term> 6492bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.resident</mallctl> 6493bf6039f0SWarner Losh (<type>size_t</type>) 6494bf6039f0SWarner Losh <literal>r-</literal> 6495bf6039f0SWarner Losh [<option>--enable-stats</option>] 6496bf6039f0SWarner Losh </term> 6497bf6039f0SWarner Losh <listitem><para>Maximum number of bytes in physically resident data 6498bf6039f0SWarner Losh pages mapped by the arena, comprising all pages dedicated to allocator 6499bf6039f0SWarner Losh metadata, pages backing active allocations, and unused dirty pages. 6500bf6039f0SWarner Losh This is a maximum rather than precise because pages may not actually be 6501bf6039f0SWarner Losh physically resident if they correspond to demand-zeroed virtual memory 6502bf6039f0SWarner Losh that has not yet been touched. This is a multiple of the page 6503bf6039f0SWarner Losh size.</para></listitem> 6504bf6039f0SWarner Losh </varlistentry> 6505bf6039f0SWarner Losh 6506bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.dirty_npurge"> 6507bf6039f0SWarner Losh <term> 6508bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.dirty_npurge</mallctl> 6509bf6039f0SWarner Losh (<type>uint64_t</type>) 6510bf6039f0SWarner Losh <literal>r-</literal> 6511bf6039f0SWarner Losh [<option>--enable-stats</option>] 6512bf6039f0SWarner Losh </term> 6513bf6039f0SWarner Losh <listitem><para>Number of dirty page purge sweeps performed. 6514bf6039f0SWarner Losh </para></listitem> 6515bf6039f0SWarner Losh </varlistentry> 6516bf6039f0SWarner Losh 6517bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.dirty_nmadvise"> 6518bf6039f0SWarner Losh <term> 6519bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.dirty_nmadvise</mallctl> 6520bf6039f0SWarner Losh (<type>uint64_t</type>) 6521bf6039f0SWarner Losh <literal>r-</literal> 6522bf6039f0SWarner Losh [<option>--enable-stats</option>] 6523bf6039f0SWarner Losh </term> 6524bf6039f0SWarner Losh <listitem><para>Number of <function>madvise()</function> or similar 6525bf6039f0SWarner Losh calls made to purge dirty pages.</para></listitem> 6526bf6039f0SWarner Losh </varlistentry> 6527bf6039f0SWarner Losh 6528bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.dirty_purged"> 6529bf6039f0SWarner Losh <term> 6530bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.dirty_purged</mallctl> 6531bf6039f0SWarner Losh (<type>uint64_t</type>) 6532bf6039f0SWarner Losh <literal>r-</literal> 6533bf6039f0SWarner Losh [<option>--enable-stats</option>] 6534bf6039f0SWarner Losh </term> 6535bf6039f0SWarner Losh <listitem><para>Number of dirty pages purged.</para></listitem> 6536bf6039f0SWarner Losh </varlistentry> 6537bf6039f0SWarner Losh 6538bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.muzzy_npurge"> 6539bf6039f0SWarner Losh <term> 6540bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.muzzy_npurge</mallctl> 6541bf6039f0SWarner Losh (<type>uint64_t</type>) 6542bf6039f0SWarner Losh <literal>r-</literal> 6543bf6039f0SWarner Losh [<option>--enable-stats</option>] 6544bf6039f0SWarner Losh </term> 6545bf6039f0SWarner Losh <listitem><para>Number of muzzy page purge sweeps performed. 6546bf6039f0SWarner Losh </para></listitem> 6547bf6039f0SWarner Losh </varlistentry> 6548bf6039f0SWarner Losh 6549bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.muzzy_nmadvise"> 6550bf6039f0SWarner Losh <term> 6551bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.muzzy_nmadvise</mallctl> 6552bf6039f0SWarner Losh (<type>uint64_t</type>) 6553bf6039f0SWarner Losh <literal>r-</literal> 6554bf6039f0SWarner Losh [<option>--enable-stats</option>] 6555bf6039f0SWarner Losh </term> 6556bf6039f0SWarner Losh <listitem><para>Number of <function>madvise()</function> or similar 6557bf6039f0SWarner Losh calls made to purge muzzy pages.</para></listitem> 6558bf6039f0SWarner Losh </varlistentry> 6559bf6039f0SWarner Losh 6560bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.muzzy_purged"> 6561bf6039f0SWarner Losh <term> 6562bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.muzzy_purged</mallctl> 6563bf6039f0SWarner Losh (<type>uint64_t</type>) 6564bf6039f0SWarner Losh <literal>r-</literal> 6565bf6039f0SWarner Losh [<option>--enable-stats</option>] 6566bf6039f0SWarner Losh </term> 6567bf6039f0SWarner Losh <listitem><para>Number of muzzy pages purged.</para></listitem> 6568bf6039f0SWarner Losh </varlistentry> 6569bf6039f0SWarner Losh 6570bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.small.allocated"> 6571bf6039f0SWarner Losh <term> 6572bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.small.allocated</mallctl> 6573bf6039f0SWarner Losh (<type>size_t</type>) 6574bf6039f0SWarner Losh <literal>r-</literal> 6575bf6039f0SWarner Losh [<option>--enable-stats</option>] 6576bf6039f0SWarner Losh </term> 6577bf6039f0SWarner Losh <listitem><para>Number of bytes currently allocated by small objects. 6578bf6039f0SWarner Losh </para></listitem> 6579bf6039f0SWarner Losh </varlistentry> 6580bf6039f0SWarner Losh 6581bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.small.nmalloc"> 6582bf6039f0SWarner Losh <term> 6583bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.small.nmalloc</mallctl> 6584bf6039f0SWarner Losh (<type>uint64_t</type>) 6585bf6039f0SWarner Losh <literal>r-</literal> 6586bf6039f0SWarner Losh [<option>--enable-stats</option>] 6587bf6039f0SWarner Losh </term> 6588bf6039f0SWarner Losh <listitem><para>Cumulative number of times a small allocation was 6589bf6039f0SWarner Losh requested from the arena's bins, whether to fill the relevant tcache if 6590bf6039f0SWarner Losh <link linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is 6591bf6039f0SWarner Losh enabled, or to directly satisfy an allocation request 6592bf6039f0SWarner Losh otherwise.</para></listitem> 6593bf6039f0SWarner Losh </varlistentry> 6594bf6039f0SWarner Losh 6595bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.small.ndalloc"> 6596bf6039f0SWarner Losh <term> 6597bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.small.ndalloc</mallctl> 6598bf6039f0SWarner Losh (<type>uint64_t</type>) 6599bf6039f0SWarner Losh <literal>r-</literal> 6600bf6039f0SWarner Losh [<option>--enable-stats</option>] 6601bf6039f0SWarner Losh </term> 6602bf6039f0SWarner Losh <listitem><para>Cumulative number of times a small allocation was 6603bf6039f0SWarner Losh returned to the arena's bins, whether to flush the relevant tcache if 6604bf6039f0SWarner Losh <link linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is 6605bf6039f0SWarner Losh enabled, or to directly deallocate an allocation 6606bf6039f0SWarner Losh otherwise.</para></listitem> 6607bf6039f0SWarner Losh </varlistentry> 6608bf6039f0SWarner Losh 6609bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.small.nrequests"> 6610bf6039f0SWarner Losh <term> 6611bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.small.nrequests</mallctl> 6612bf6039f0SWarner Losh (<type>uint64_t</type>) 6613bf6039f0SWarner Losh <literal>r-</literal> 6614bf6039f0SWarner Losh [<option>--enable-stats</option>] 6615bf6039f0SWarner Losh </term> 6616bf6039f0SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 6617bf6039f0SWarner Losh all bin size classes.</para></listitem> 6618bf6039f0SWarner Losh </varlistentry> 6619bf6039f0SWarner Losh 6620bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.small.nfills"> 6621bf6039f0SWarner Losh <term> 6622bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.small.nfills</mallctl> 6623bf6039f0SWarner Losh (<type>uint64_t</type>) 6624bf6039f0SWarner Losh <literal>r-</literal> 6625bf6039f0SWarner Losh [<option>--enable-stats</option>] 6626bf6039f0SWarner Losh </term> 6627bf6039f0SWarner Losh <listitem><para>Cumulative number of tcache fills by all small size 6628bf6039f0SWarner Losh classes.</para></listitem> 6629bf6039f0SWarner Losh </varlistentry> 6630bf6039f0SWarner Losh 6631bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.small.nflushes"> 6632bf6039f0SWarner Losh <term> 6633bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.small.nflushes</mallctl> 6634bf6039f0SWarner Losh (<type>uint64_t</type>) 6635bf6039f0SWarner Losh <literal>r-</literal> 6636bf6039f0SWarner Losh [<option>--enable-stats</option>] 6637bf6039f0SWarner Losh </term> 6638bf6039f0SWarner Losh <listitem><para>Cumulative number of tcache flushes by all small size 6639bf6039f0SWarner Losh classes.</para></listitem> 6640bf6039f0SWarner Losh </varlistentry> 6641bf6039f0SWarner Losh 6642bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.large.allocated"> 6643bf6039f0SWarner Losh <term> 6644bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.large.allocated</mallctl> 6645bf6039f0SWarner Losh (<type>size_t</type>) 6646bf6039f0SWarner Losh <literal>r-</literal> 6647bf6039f0SWarner Losh [<option>--enable-stats</option>] 6648bf6039f0SWarner Losh </term> 6649bf6039f0SWarner Losh <listitem><para>Number of bytes currently allocated by large objects. 6650bf6039f0SWarner Losh </para></listitem> 6651bf6039f0SWarner Losh </varlistentry> 6652bf6039f0SWarner Losh 6653bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.large.nmalloc"> 6654bf6039f0SWarner Losh <term> 6655bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.large.nmalloc</mallctl> 6656bf6039f0SWarner Losh (<type>uint64_t</type>) 6657bf6039f0SWarner Losh <literal>r-</literal> 6658bf6039f0SWarner Losh [<option>--enable-stats</option>] 6659bf6039f0SWarner Losh </term> 6660bf6039f0SWarner Losh <listitem><para>Cumulative number of times a large extent was allocated 6661bf6039f0SWarner Losh from the arena, whether to fill the relevant tcache if <link 6662bf6039f0SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 6663bf6039f0SWarner Losh the size class is within the range being cached, or to directly satisfy 6664bf6039f0SWarner Losh an allocation request otherwise.</para></listitem> 6665bf6039f0SWarner Losh </varlistentry> 6666bf6039f0SWarner Losh 6667bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.large.ndalloc"> 6668bf6039f0SWarner Losh <term> 6669bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.large.ndalloc</mallctl> 6670bf6039f0SWarner Losh (<type>uint64_t</type>) 6671bf6039f0SWarner Losh <literal>r-</literal> 6672bf6039f0SWarner Losh [<option>--enable-stats</option>] 6673bf6039f0SWarner Losh </term> 6674bf6039f0SWarner Losh <listitem><para>Cumulative number of times a large extent was returned 6675bf6039f0SWarner Losh to the arena, whether to flush the relevant tcache if <link 6676bf6039f0SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 6677bf6039f0SWarner Losh the size class is within the range being cached, or to directly 6678bf6039f0SWarner Losh deallocate an allocation otherwise.</para></listitem> 6679bf6039f0SWarner Losh </varlistentry> 6680bf6039f0SWarner Losh 6681bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.large.nrequests"> 6682bf6039f0SWarner Losh <term> 6683bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.large.nrequests</mallctl> 6684bf6039f0SWarner Losh (<type>uint64_t</type>) 6685bf6039f0SWarner Losh <literal>r-</literal> 6686bf6039f0SWarner Losh [<option>--enable-stats</option>] 6687bf6039f0SWarner Losh </term> 6688bf6039f0SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 6689bf6039f0SWarner Losh all large size classes.</para></listitem> 6690bf6039f0SWarner Losh </varlistentry> 6691bf6039f0SWarner Losh 6692bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.large.nfills"> 6693bf6039f0SWarner Losh <term> 6694bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.large.nfills</mallctl> 6695bf6039f0SWarner Losh (<type>uint64_t</type>) 6696bf6039f0SWarner Losh <literal>r-</literal> 6697bf6039f0SWarner Losh [<option>--enable-stats</option>] 6698bf6039f0SWarner Losh </term> 6699bf6039f0SWarner Losh <listitem><para>Cumulative number of tcache fills by all large size 6700bf6039f0SWarner Losh classes.</para></listitem> 6701bf6039f0SWarner Losh </varlistentry> 6702bf6039f0SWarner Losh 6703bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.large.nflushes"> 6704bf6039f0SWarner Losh <term> 6705bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.large.nflushes</mallctl> 6706bf6039f0SWarner Losh (<type>uint64_t</type>) 6707bf6039f0SWarner Losh <literal>r-</literal> 6708bf6039f0SWarner Losh [<option>--enable-stats</option>] 6709bf6039f0SWarner Losh </term> 6710bf6039f0SWarner Losh <listitem><para>Cumulative number of tcache flushes by all large size 6711bf6039f0SWarner Losh classes.</para></listitem> 6712bf6039f0SWarner Losh </varlistentry> 6713bf6039f0SWarner Losh 6714bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nmalloc"> 6715bf6039f0SWarner Losh <term> 6716bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nmalloc</mallctl> 6717bf6039f0SWarner Losh (<type>uint64_t</type>) 6718bf6039f0SWarner Losh <literal>r-</literal> 6719bf6039f0SWarner Losh [<option>--enable-stats</option>] 6720bf6039f0SWarner Losh </term> 6721bf6039f0SWarner Losh <listitem><para>Cumulative number of times a bin region of the 6722bf6039f0SWarner Losh corresponding size class was allocated from the arena, whether to fill 6723bf6039f0SWarner Losh the relevant tcache if <link 6724bf6039f0SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled, or 6725bf6039f0SWarner Losh to directly satisfy an allocation request otherwise.</para></listitem> 6726bf6039f0SWarner Losh </varlistentry> 6727bf6039f0SWarner Losh 6728bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.ndalloc"> 6729bf6039f0SWarner Losh <term> 6730bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.ndalloc</mallctl> 6731bf6039f0SWarner Losh (<type>uint64_t</type>) 6732bf6039f0SWarner Losh <literal>r-</literal> 6733bf6039f0SWarner Losh [<option>--enable-stats</option>] 6734bf6039f0SWarner Losh </term> 6735bf6039f0SWarner Losh <listitem><para>Cumulative number of times a bin region of the 6736bf6039f0SWarner Losh corresponding size class was returned to the arena, whether to flush the 6737bf6039f0SWarner Losh relevant tcache if <link 6738bf6039f0SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled, or 6739bf6039f0SWarner Losh to directly deallocate an allocation otherwise.</para></listitem> 6740bf6039f0SWarner Losh </varlistentry> 6741bf6039f0SWarner Losh 6742bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nrequests"> 6743bf6039f0SWarner Losh <term> 6744bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nrequests</mallctl> 6745bf6039f0SWarner Losh (<type>uint64_t</type>) 6746bf6039f0SWarner Losh <literal>r-</literal> 6747bf6039f0SWarner Losh [<option>--enable-stats</option>] 6748bf6039f0SWarner Losh </term> 6749bf6039f0SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 6750bf6039f0SWarner Losh bin regions of the corresponding size class.</para></listitem> 6751bf6039f0SWarner Losh </varlistentry> 6752bf6039f0SWarner Losh 6753bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.curregs"> 6754bf6039f0SWarner Losh <term> 6755bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.curregs</mallctl> 6756bf6039f0SWarner Losh (<type>size_t</type>) 6757bf6039f0SWarner Losh <literal>r-</literal> 6758bf6039f0SWarner Losh [<option>--enable-stats</option>] 6759bf6039f0SWarner Losh </term> 6760bf6039f0SWarner Losh <listitem><para>Current number of regions for this size 6761bf6039f0SWarner Losh class.</para></listitem> 6762bf6039f0SWarner Losh </varlistentry> 6763bf6039f0SWarner Losh 6764bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nfills"> 6765bf6039f0SWarner Losh <term> 6766bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nfills</mallctl> 6767bf6039f0SWarner Losh (<type>uint64_t</type>) 6768bf6039f0SWarner Losh <literal>r-</literal> 6769bf6039f0SWarner Losh </term> 6770bf6039f0SWarner Losh <listitem><para>Cumulative number of tcache fills.</para></listitem> 6771bf6039f0SWarner Losh </varlistentry> 6772bf6039f0SWarner Losh 6773bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nflushes"> 6774bf6039f0SWarner Losh <term> 6775bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nflushes</mallctl> 6776bf6039f0SWarner Losh (<type>uint64_t</type>) 6777bf6039f0SWarner Losh <literal>r-</literal> 6778bf6039f0SWarner Losh </term> 6779bf6039f0SWarner Losh <listitem><para>Cumulative number of tcache flushes.</para></listitem> 6780bf6039f0SWarner Losh </varlistentry> 6781bf6039f0SWarner Losh 6782bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nslabs"> 6783bf6039f0SWarner Losh <term> 6784bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nslabs</mallctl> 6785bf6039f0SWarner Losh (<type>uint64_t</type>) 6786bf6039f0SWarner Losh <literal>r-</literal> 6787bf6039f0SWarner Losh [<option>--enable-stats</option>] 6788bf6039f0SWarner Losh </term> 6789bf6039f0SWarner Losh <listitem><para>Cumulative number of slabs created.</para></listitem> 6790bf6039f0SWarner Losh </varlistentry> 6791bf6039f0SWarner Losh 6792bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nreslabs"> 6793bf6039f0SWarner Losh <term> 6794bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nreslabs</mallctl> 6795bf6039f0SWarner Losh (<type>uint64_t</type>) 6796bf6039f0SWarner Losh <literal>r-</literal> 6797bf6039f0SWarner Losh [<option>--enable-stats</option>] 6798bf6039f0SWarner Losh </term> 6799bf6039f0SWarner Losh <listitem><para>Cumulative number of times the current slab from which 6800bf6039f0SWarner Losh to allocate changed.</para></listitem> 6801bf6039f0SWarner Losh </varlistentry> 6802bf6039f0SWarner Losh 6803bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.curslabs"> 6804bf6039f0SWarner Losh <term> 6805bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.curslabs</mallctl> 6806bf6039f0SWarner Losh (<type>size_t</type>) 6807bf6039f0SWarner Losh <literal>r-</literal> 6808bf6039f0SWarner Losh [<option>--enable-stats</option>] 6809bf6039f0SWarner Losh </term> 6810bf6039f0SWarner Losh <listitem><para>Current number of slabs.</para></listitem> 6811bf6039f0SWarner Losh </varlistentry> 6812bf6039f0SWarner Losh 6813bf6039f0SWarner Losh 6814bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.j.nonfull_slabs"> 6815bf6039f0SWarner Losh <term> 6816bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.nonfull_slabs</mallctl> 6817bf6039f0SWarner Losh (<type>size_t</type>) 6818bf6039f0SWarner Losh <literal>r-</literal> 6819bf6039f0SWarner Losh [<option>--enable-stats</option>] 6820bf6039f0SWarner Losh </term> 6821bf6039f0SWarner Losh <listitem><para>Current number of nonfull slabs.</para></listitem> 6822bf6039f0SWarner Losh </varlistentry> 6823bf6039f0SWarner Losh 6824bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.bins.mutex"> 6825bf6039f0SWarner Losh <term> 6826bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.bins.<j>.mutex.{counter}</mallctl> 6827bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6828bf6039f0SWarner Losh [<option>--enable-stats</option>] 6829bf6039f0SWarner Losh </term> 6830bf6039f0SWarner Losh <listitem><para>Statistics on 6831bf6039f0SWarner Losh <varname>arena.<i>.bins.<j></varname> mutex (arena bin 6832bf6039f0SWarner Losh scope; bin operation related). <mallctl>{counter}</mallctl> is one of 6833bf6039f0SWarner Losh the counters in <link linkend="mutex_counters">mutex profiling 6834bf6039f0SWarner Losh counters</link>.</para></listitem> 6835bf6039f0SWarner Losh </varlistentry> 6836bf6039f0SWarner Losh 6837bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.extents.n"> 6838bf6039f0SWarner Losh <term> 6839bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.extents.<j>.n{extent_type}</mallctl> 6840bf6039f0SWarner Losh (<type>size_t</type>) 6841bf6039f0SWarner Losh <literal>r-</literal> 6842bf6039f0SWarner Losh [<option>--enable-stats</option>] 6843bf6039f0SWarner Losh </term> 6844bf6039f0SWarner Losh <listitem><para> Number of extents of the given type in this arena in 6845bf6039f0SWarner Losh the bucket corresponding to page size index <j>. The extent type 6846bf6039f0SWarner Losh is one of dirty, muzzy, or retained.</para></listitem> 6847bf6039f0SWarner Losh </varlistentry> 6848bf6039f0SWarner Losh 6849bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.extents.bytes"> 6850bf6039f0SWarner Losh <term> 6851bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.extents.<j>.{extent_type}_bytes</mallctl> 6852bf6039f0SWarner Losh (<type>size_t</type>) 6853bf6039f0SWarner Losh <literal>r-</literal> 6854bf6039f0SWarner Losh [<option>--enable-stats</option>] 6855bf6039f0SWarner Losh </term> 6856bf6039f0SWarner Losh <listitem><para> Sum of the bytes managed by extents of the given type 6857bf6039f0SWarner Losh in this arena in the bucket corresponding to page size index <j>. 6858bf6039f0SWarner Losh The extent type is one of dirty, muzzy, or retained.</para></listitem> 6859bf6039f0SWarner Losh </varlistentry> 6860bf6039f0SWarner Losh 6861bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.nmalloc"> 6862bf6039f0SWarner Losh <term> 6863bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.nmalloc</mallctl> 6864bf6039f0SWarner Losh (<type>uint64_t</type>) 6865bf6039f0SWarner Losh <literal>r-</literal> 6866bf6039f0SWarner Losh [<option>--enable-stats</option>] 6867bf6039f0SWarner Losh </term> 6868bf6039f0SWarner Losh <listitem><para>Cumulative number of times a large extent of the 6869bf6039f0SWarner Losh corresponding size class was allocated from the arena, whether to fill 6870bf6039f0SWarner Losh the relevant tcache if <link 6871bf6039f0SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 6872bf6039f0SWarner Losh the size class is within the range being cached, or to directly satisfy 6873bf6039f0SWarner Losh an allocation request otherwise.</para></listitem> 6874bf6039f0SWarner Losh </varlistentry> 6875bf6039f0SWarner Losh 6876bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.ndalloc"> 6877bf6039f0SWarner Losh <term> 6878bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.ndalloc</mallctl> 6879bf6039f0SWarner Losh (<type>uint64_t</type>) 6880bf6039f0SWarner Losh <literal>r-</literal> 6881bf6039f0SWarner Losh [<option>--enable-stats</option>] 6882bf6039f0SWarner Losh </term> 6883bf6039f0SWarner Losh <listitem><para>Cumulative number of times a large extent of the 6884bf6039f0SWarner Losh corresponding size class was returned to the arena, whether to flush the 6885bf6039f0SWarner Losh relevant tcache if <link 6886bf6039f0SWarner Losh linkend="opt.tcache"><mallctl>opt.tcache</mallctl></link> is enabled and 6887bf6039f0SWarner Losh the size class is within the range being cached, or to directly 6888bf6039f0SWarner Losh deallocate an allocation otherwise.</para></listitem> 6889bf6039f0SWarner Losh </varlistentry> 6890bf6039f0SWarner Losh 6891bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.nrequests"> 6892bf6039f0SWarner Losh <term> 6893bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.nrequests</mallctl> 6894bf6039f0SWarner Losh (<type>uint64_t</type>) 6895bf6039f0SWarner Losh <literal>r-</literal> 6896bf6039f0SWarner Losh [<option>--enable-stats</option>] 6897bf6039f0SWarner Losh </term> 6898bf6039f0SWarner Losh <listitem><para>Cumulative number of allocation requests satisfied by 6899bf6039f0SWarner Losh large extents of the corresponding size class.</para></listitem> 6900bf6039f0SWarner Losh </varlistentry> 6901bf6039f0SWarner Losh 6902bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.lextents.j.curlextents"> 6903bf6039f0SWarner Losh <term> 6904bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.lextents.<j>.curlextents</mallctl> 6905bf6039f0SWarner Losh (<type>size_t</type>) 6906bf6039f0SWarner Losh <literal>r-</literal> 6907bf6039f0SWarner Losh [<option>--enable-stats</option>] 6908bf6039f0SWarner Losh </term> 6909bf6039f0SWarner Losh <listitem><para>Current number of large allocations for this size class. 6910bf6039f0SWarner Losh </para></listitem> 6911bf6039f0SWarner Losh </varlistentry> 6912bf6039f0SWarner Losh 6913bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.large"> 6914bf6039f0SWarner Losh <term> 6915bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.large.{counter}</mallctl> 6916bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6917bf6039f0SWarner Losh [<option>--enable-stats</option>] 6918bf6039f0SWarner Losh </term> 6919bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.large</varname> 6920bf6039f0SWarner Losh mutex (arena scope; large allocation related). 6921bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 6922bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6923bf6039f0SWarner Losh counters</link>.</para></listitem> 6924bf6039f0SWarner Losh </varlistentry> 6925bf6039f0SWarner Losh 6926bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extent_avail"> 6927bf6039f0SWarner Losh <term> 6928bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extent_avail.{counter}</mallctl> 6929bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6930bf6039f0SWarner Losh [<option>--enable-stats</option>] 6931bf6039f0SWarner Losh </term> 6932bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extent_avail 6933bf6039f0SWarner Losh </varname> mutex (arena scope; extent avail related). 6934bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 6935bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6936bf6039f0SWarner Losh counters</link>.</para></listitem> 6937bf6039f0SWarner Losh </varlistentry> 6938bf6039f0SWarner Losh 6939bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extents_dirty"> 6940bf6039f0SWarner Losh <term> 6941bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extents_dirty.{counter}</mallctl> 6942bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6943bf6039f0SWarner Losh [<option>--enable-stats</option>] 6944bf6039f0SWarner Losh </term> 6945bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extents_dirty 6946bf6039f0SWarner Losh </varname> mutex (arena scope; dirty extents related). 6947bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 6948bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6949bf6039f0SWarner Losh counters</link>.</para></listitem> 6950bf6039f0SWarner Losh </varlistentry> 6951bf6039f0SWarner Losh 6952bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extents_muzzy"> 6953bf6039f0SWarner Losh <term> 6954bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extents_muzzy.{counter}</mallctl> 6955bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6956bf6039f0SWarner Losh [<option>--enable-stats</option>] 6957bf6039f0SWarner Losh </term> 6958bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extents_muzzy 6959bf6039f0SWarner Losh </varname> mutex (arena scope; muzzy extents related). 6960bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 6961bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6962bf6039f0SWarner Losh counters</link>.</para></listitem> 6963bf6039f0SWarner Losh </varlistentry> 6964bf6039f0SWarner Losh 6965bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.extents_retained"> 6966bf6039f0SWarner Losh <term> 6967bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.extents_retained.{counter}</mallctl> 6968bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6969bf6039f0SWarner Losh [<option>--enable-stats</option>] 6970bf6039f0SWarner Losh </term> 6971bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.extents_retained 6972bf6039f0SWarner Losh </varname> mutex (arena scope; retained extents related). 6973bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 6974bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6975bf6039f0SWarner Losh counters</link>.</para></listitem> 6976bf6039f0SWarner Losh </varlistentry> 6977bf6039f0SWarner Losh 6978bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.decay_dirty"> 6979bf6039f0SWarner Losh <term> 6980bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.decay_dirty.{counter}</mallctl> 6981bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6982bf6039f0SWarner Losh [<option>--enable-stats</option>] 6983bf6039f0SWarner Losh </term> 6984bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.decay_dirty 6985bf6039f0SWarner Losh </varname> mutex (arena scope; decay for dirty pages related). 6986bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 6987bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 6988bf6039f0SWarner Losh counters</link>.</para></listitem> 6989bf6039f0SWarner Losh </varlistentry> 6990bf6039f0SWarner Losh 6991bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.decay_muzzy"> 6992bf6039f0SWarner Losh <term> 6993bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.decay_muzzy.{counter}</mallctl> 6994bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 6995bf6039f0SWarner Losh [<option>--enable-stats</option>] 6996bf6039f0SWarner Losh </term> 6997bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.decay_muzzy 6998bf6039f0SWarner Losh </varname> mutex (arena scope; decay for muzzy pages related). 6999bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 7000bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 7001bf6039f0SWarner Losh counters</link>.</para></listitem> 7002bf6039f0SWarner Losh </varlistentry> 7003bf6039f0SWarner Losh 7004bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.base"> 7005bf6039f0SWarner Losh <term> 7006bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.base.{counter}</mallctl> 7007bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 7008bf6039f0SWarner Losh [<option>--enable-stats</option>] 7009bf6039f0SWarner Losh </term> 7010bf6039f0SWarner Losh <listitem><para>Statistics on <varname>arena.<i>.base</varname> 7011bf6039f0SWarner Losh mutex (arena scope; base allocator related). 7012bf6039f0SWarner Losh <mallctl>{counter}</mallctl> is one of the counters in <link 7013bf6039f0SWarner Losh linkend="mutex_counters">mutex profiling 7014bf6039f0SWarner Losh counters</link>.</para></listitem> 7015bf6039f0SWarner Losh </varlistentry> 7016bf6039f0SWarner Losh 7017bf6039f0SWarner Losh <varlistentry id="stats.arenas.i.mutexes.tcache_list"> 7018bf6039f0SWarner Losh <term> 7019bf6039f0SWarner Losh <mallctl>stats.arenas.<i>.mutexes.tcache_list.{counter}</mallctl> 7020bf6039f0SWarner Losh (<type>counter specific type</type>) <literal>r-</literal> 7021bf6039f0SWarner Losh [<option>--enable-stats</option>] 7022bf6039f0SWarner Losh </term> 7023bf6039f0SWarner Losh <listitem><para>Statistics on 7024bf6039f0SWarner Losh <varname>arena.<i>.tcache_list</varname> mutex (arena scope; 7025bf6039f0SWarner Losh tcache to arena association related). This mutex is expected to be 7026bf6039f0SWarner Losh accessed less often. <mallctl>{counter}</mallctl> is one of the 7027bf6039f0SWarner Losh counters in <link linkend="mutex_counters">mutex profiling 7028bf6039f0SWarner Losh counters</link>.</para></listitem> 7029bf6039f0SWarner Losh </varlistentry> 7030bf6039f0SWarner Losh 7031bf6039f0SWarner Losh </variablelist> 7032bf6039f0SWarner Losh </refsect1> 7033bf6039f0SWarner Losh <refsect1 id="heap_profile_format"> 7034bf6039f0SWarner Losh <title>HEAP PROFILE FORMAT</title> 7035bf6039f0SWarner Losh <para>Although the heap profiling functionality was originally designed to 7036bf6039f0SWarner Losh be compatible with the 7037bf6039f0SWarner Losh <command>pprof</command> command that is developed as part of the <ulink 7038bf6039f0SWarner Losh url="http://code.google.com/p/gperftools/">gperftools 7039bf6039f0SWarner Losh package</ulink>, the addition of per thread heap profiling functionality 7040bf6039f0SWarner Losh required a different heap profile format. The <command>jeprof</command> 7041bf6039f0SWarner Losh command is derived from <command>pprof</command>, with enhancements to 7042bf6039f0SWarner Losh support the heap profile format described here.</para> 7043bf6039f0SWarner Losh 7044bf6039f0SWarner Losh <para>In the following hypothetical heap profile, <constant>[...]</constant> 7045bf6039f0SWarner Losh indicates elision for the sake of compactness. <programlisting><![CDATA[ 7046bf6039f0SWarner Loshheap_v2/524288 7047bf6039f0SWarner Losh t*: 28106: 56637512 [0: 0] 7048bf6039f0SWarner Losh [...] 7049bf6039f0SWarner Losh t3: 352: 16777344 [0: 0] 7050bf6039f0SWarner Losh [...] 7051bf6039f0SWarner Losh t99: 17754: 29341640 [0: 0] 7052bf6039f0SWarner Losh [...] 7053bf6039f0SWarner Losh@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...] 7054bf6039f0SWarner Losh t*: 13: 6688 [0: 0] 7055bf6039f0SWarner Losh t3: 12: 6496 [0: ] 7056bf6039f0SWarner Losh t99: 1: 192 [0: 0] 7057bf6039f0SWarner Losh[...] 7058bf6039f0SWarner Losh 7059bf6039f0SWarner LoshMAPPED_LIBRARIES: 7060bf6039f0SWarner Losh[...]]]></programlisting> The following matches the above heap profile, but most 7061bf6039f0SWarner Loshtokens are replaced with <constant><description></constant> to indicate 7062bf6039f0SWarner Loshdescriptions of the corresponding fields. <programlisting><![CDATA[ 7063bf6039f0SWarner Losh<heap_profile_format_version>/<mean_sample_interval> 7064bf6039f0SWarner Losh <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 7065bf6039f0SWarner Losh [...] 7066bf6039f0SWarner Losh <thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>] 7067bf6039f0SWarner Losh [...] 7068bf6039f0SWarner Losh <thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>] 7069bf6039f0SWarner Losh [...] 7070bf6039f0SWarner Losh@ <top_frame> <frame> [...] <frame> <frame> <frame> [...] 7071bf6039f0SWarner Losh <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 7072bf6039f0SWarner Losh <backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 7073bf6039f0SWarner Losh <backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] 7074bf6039f0SWarner Losh[...] 7075bf6039f0SWarner Losh 7076bf6039f0SWarner LoshMAPPED_LIBRARIES: 7077bf6039f0SWarner Losh</proc/<pid>/maps>]]></programlisting></para> 7078bf6039f0SWarner Losh </refsect1> 7079bf6039f0SWarner Losh 7080bf6039f0SWarner Losh <refsect1 id="debugging_malloc_problems"> 7081bf6039f0SWarner Losh <title>DEBUGGING MALLOC PROBLEMS</title> 7082bf6039f0SWarner Losh <para>When debugging, it is a good idea to configure/build jemalloc with 7083bf6039f0SWarner Losh the <option>--enable-debug</option> and <option>--enable-fill</option> 7084bf6039f0SWarner Losh options, and recompile the program with suitable options and symbols for 7085bf6039f0SWarner Losh debugger support. When so configured, jemalloc incorporates a wide variety 7086bf6039f0SWarner Losh of run-time assertions that catch application errors such as double-free, 7087bf6039f0SWarner Losh write-after-free, etc.</para> 7088bf6039f0SWarner Losh 7089bf6039f0SWarner Losh <para>Programs often accidentally depend on <quote>uninitialized</quote> 7090bf6039f0SWarner Losh memory actually being filled with zero bytes. Junk filling 7091bf6039f0SWarner Losh (see the <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link> 7092bf6039f0SWarner Losh option) tends to expose such bugs in the form of obviously incorrect 7093bf6039f0SWarner Losh results and/or coredumps. Conversely, zero 7094bf6039f0SWarner Losh filling (see the <link 7095bf6039f0SWarner Losh linkend="opt.zero"><mallctl>opt.zero</mallctl></link> option) eliminates 7096bf6039f0SWarner Losh the symptoms of such bugs. Between these two options, it is usually 7097bf6039f0SWarner Losh possible to quickly detect, diagnose, and eliminate such bugs.</para> 7098bf6039f0SWarner Losh 7099bf6039f0SWarner Losh <para>This implementation does not provide much detail about the problems 7100bf6039f0SWarner Losh it detects, because the performance impact for storing such information 7101bf6039f0SWarner Losh would be prohibitive.</para> 7102bf6039f0SWarner Losh </refsect1> 7103bf6039f0SWarner Losh <refsect1 id="diagnostic_messages"> 7104bf6039f0SWarner Losh <title>DIAGNOSTIC MESSAGES</title> 7105bf6039f0SWarner Losh <para>If any of the memory allocation/deallocation functions detect an 7106bf6039f0SWarner Losh error or warning condition, a message will be printed to file descriptor 7107bf6039f0SWarner Losh <constant>STDERR_FILENO</constant>. Errors will result in the process 7108bf6039f0SWarner Losh dumping core. If the <link 7109bf6039f0SWarner Losh linkend="opt.abort"><mallctl>opt.abort</mallctl></link> option is set, most 7110bf6039f0SWarner Losh warnings are treated as errors.</para> 7111bf6039f0SWarner Losh 7112bf6039f0SWarner Losh <para>The <varname>malloc_message</varname> variable allows the programmer 7113bf6039f0SWarner Losh to override the function which emits the text strings forming the errors 7114bf6039f0SWarner Losh and warnings if for some reason the <constant>STDERR_FILENO</constant> file 7115bf6039f0SWarner Losh descriptor is not suitable for this. 7116bf6039f0SWarner Losh <function>malloc_message()</function> takes the 7117bf6039f0SWarner Losh <parameter>cbopaque</parameter> pointer argument that is 7118bf6039f0SWarner Losh <constant>NULL</constant> unless overridden by the arguments in a call to 7119bf6039f0SWarner Losh <function>malloc_stats_print()</function>, followed by a string 7120bf6039f0SWarner Losh pointer. Please note that doing anything which tries to allocate memory in 7121bf6039f0SWarner Losh this function is likely to result in a crash or deadlock.</para> 7122bf6039f0SWarner Losh 7123bf6039f0SWarner Losh <para>All messages are prefixed by 7124bf6039f0SWarner Losh <quote><computeroutput><jemalloc>: </computeroutput></quote>.</para> 7125bf6039f0SWarner Losh </refsect1> 7126bf6039f0SWarner Losh <refsect1 id="return_values"> 7127bf6039f0SWarner Losh <title>RETURN VALUES</title> 7128bf6039f0SWarner Losh <refsect2> 7129bf6039f0SWarner Losh <title>Standard API</title> 7130bf6039f0SWarner Losh <para>The <function>malloc()</function> and 7131bf6039f0SWarner Losh <function>calloc()</function> functions return a pointer to the 7132bf6039f0SWarner Losh allocated memory if successful; otherwise a <constant>NULL</constant> 7133bf6039f0SWarner Losh pointer is returned and <varname>errno</varname> is set to 7134bf6039f0SWarner Losh <errorname>ENOMEM</errorname>.</para> 7135bf6039f0SWarner Losh 7136bf6039f0SWarner Losh <para>The <function>posix_memalign()</function> function 7137bf6039f0SWarner Losh returns the value 0 if successful; otherwise it returns an error value. 7138bf6039f0SWarner Losh The <function>posix_memalign()</function> function will fail 7139bf6039f0SWarner Losh if: 7140bf6039f0SWarner Losh <variablelist> 7141bf6039f0SWarner Losh <varlistentry> 7142bf6039f0SWarner Losh <term><errorname>EINVAL</errorname></term> 7143bf6039f0SWarner Losh 7144bf6039f0SWarner Losh <listitem><para>The <parameter>alignment</parameter> parameter is 7145bf6039f0SWarner Losh not a power of 2 at least as large as 7146bf6039f0SWarner Losh <code language="C">sizeof(<type>void *</type>)</code>. 7147bf6039f0SWarner Losh </para></listitem> 7148bf6039f0SWarner Losh </varlistentry> 7149bf6039f0SWarner Losh <varlistentry> 7150bf6039f0SWarner Losh <term><errorname>ENOMEM</errorname></term> 7151bf6039f0SWarner Losh 7152bf6039f0SWarner Losh <listitem><para>Memory allocation error.</para></listitem> 7153bf6039f0SWarner Losh </varlistentry> 7154bf6039f0SWarner Losh </variablelist> 7155bf6039f0SWarner Losh </para> 7156bf6039f0SWarner Losh 7157bf6039f0SWarner Losh <para>The <function>aligned_alloc()</function> function returns 7158bf6039f0SWarner Losh a pointer to the allocated memory if successful; otherwise a 7159bf6039f0SWarner Losh <constant>NULL</constant> pointer is returned and 7160bf6039f0SWarner Losh <varname>errno</varname> is set. The 7161bf6039f0SWarner Losh <function>aligned_alloc()</function> function will fail if: 7162bf6039f0SWarner Losh <variablelist> 7163bf6039f0SWarner Losh <varlistentry> 7164bf6039f0SWarner Losh <term><errorname>EINVAL</errorname></term> 7165bf6039f0SWarner Losh 7166bf6039f0SWarner Losh <listitem><para>The <parameter>alignment</parameter> parameter is 7167bf6039f0SWarner Losh not a power of 2. 7168bf6039f0SWarner Losh </para></listitem> 7169bf6039f0SWarner Losh </varlistentry> 7170bf6039f0SWarner Losh <varlistentry> 7171bf6039f0SWarner Losh <term><errorname>ENOMEM</errorname></term> 7172bf6039f0SWarner Losh 7173bf6039f0SWarner Losh <listitem><para>Memory allocation error.</para></listitem> 7174bf6039f0SWarner Losh </varlistentry> 7175bf6039f0SWarner Losh </variablelist> 7176bf6039f0SWarner Losh </para> 7177bf6039f0SWarner Losh 7178bf6039f0SWarner Losh <para>The <function>realloc()</function> function returns a 7179bf6039f0SWarner Losh pointer, possibly identical to <parameter>ptr</parameter>, to the 7180bf6039f0SWarner Losh allocated memory if successful; otherwise a <constant>NULL</constant> 7181bf6039f0SWarner Losh pointer is returned, and <varname>errno</varname> is set to 7182bf6039f0SWarner Losh <errorname>ENOMEM</errorname> if the error was the result of an 7183bf6039f0SWarner Losh allocation failure. The <function>realloc()</function> 7184bf6039f0SWarner Losh function always leaves the original buffer intact when an error occurs. 7185bf6039f0SWarner Losh </para> 7186bf6039f0SWarner Losh 7187bf6039f0SWarner Losh <para>The <function>free()</function> function returns no 7188bf6039f0SWarner Losh value.</para> 7189bf6039f0SWarner Losh </refsect2> 7190bf6039f0SWarner Losh <refsect2> 7191bf6039f0SWarner Losh <title>Non-standard API</title> 7192bf6039f0SWarner Losh <para>The <function>mallocx()</function> and 7193bf6039f0SWarner Losh <function>rallocx()</function> functions return a pointer to 7194bf6039f0SWarner Losh the allocated memory if successful; otherwise a <constant>NULL</constant> 7195bf6039f0SWarner Losh pointer is returned to indicate insufficient contiguous memory was 7196bf6039f0SWarner Losh available to service the allocation request. </para> 7197bf6039f0SWarner Losh 7198bf6039f0SWarner Losh <para>The <function>xallocx()</function> function returns the 7199bf6039f0SWarner Losh real size of the resulting resized allocation pointed to by 7200bf6039f0SWarner Losh <parameter>ptr</parameter>, which is a value less than 7201bf6039f0SWarner Losh <parameter>size</parameter> if the allocation could not be adequately 7202bf6039f0SWarner Losh grown in place. </para> 7203bf6039f0SWarner Losh 7204bf6039f0SWarner Losh <para>The <function>sallocx()</function> function returns the 7205bf6039f0SWarner Losh real size of the allocation pointed to by <parameter>ptr</parameter>. 7206bf6039f0SWarner Losh </para> 7207bf6039f0SWarner Losh 7208bf6039f0SWarner Losh <para>The <function>nallocx()</function> returns the real size 7209bf6039f0SWarner Losh that would result from a successful equivalent 7210bf6039f0SWarner Losh <function>mallocx()</function> function call, or zero if 7211bf6039f0SWarner Losh insufficient memory is available to perform the size computation. </para> 7212bf6039f0SWarner Losh 7213bf6039f0SWarner Losh <para>The <function>mallctl()</function>, 7214bf6039f0SWarner Losh <function>mallctlnametomib()</function>, and 7215bf6039f0SWarner Losh <function>mallctlbymib()</function> functions return 0 on 7216bf6039f0SWarner Losh success; otherwise they return an error value. The functions will fail 7217bf6039f0SWarner Losh if: 7218bf6039f0SWarner Losh <variablelist> 7219bf6039f0SWarner Losh <varlistentry> 7220bf6039f0SWarner Losh <term><errorname>EINVAL</errorname></term> 7221bf6039f0SWarner Losh 7222bf6039f0SWarner Losh <listitem><para><parameter>newp</parameter> is not 7223bf6039f0SWarner Losh <constant>NULL</constant>, and <parameter>newlen</parameter> is too 7224bf6039f0SWarner Losh large or too small. Alternatively, <parameter>*oldlenp</parameter> 7225bf6039f0SWarner Losh is too large or too small; in this case as much data as possible 7226bf6039f0SWarner Losh are read despite the error.</para></listitem> 7227bf6039f0SWarner Losh </varlistentry> 7228bf6039f0SWarner Losh <varlistentry> 7229bf6039f0SWarner Losh <term><errorname>ENOENT</errorname></term> 7230bf6039f0SWarner Losh 7231bf6039f0SWarner Losh <listitem><para><parameter>name</parameter> or 7232bf6039f0SWarner Losh <parameter>mib</parameter> specifies an unknown/invalid 7233bf6039f0SWarner Losh value.</para></listitem> 7234bf6039f0SWarner Losh </varlistentry> 7235bf6039f0SWarner Losh <varlistentry> 7236bf6039f0SWarner Losh <term><errorname>EPERM</errorname></term> 7237bf6039f0SWarner Losh 7238bf6039f0SWarner Losh <listitem><para>Attempt to read or write void value, or attempt to 7239bf6039f0SWarner Losh write read-only value.</para></listitem> 7240bf6039f0SWarner Losh </varlistentry> 7241bf6039f0SWarner Losh <varlistentry> 7242bf6039f0SWarner Losh <term><errorname>EAGAIN</errorname></term> 7243bf6039f0SWarner Losh 7244bf6039f0SWarner Losh <listitem><para>A memory allocation failure 7245bf6039f0SWarner Losh occurred.</para></listitem> 7246bf6039f0SWarner Losh </varlistentry> 7247bf6039f0SWarner Losh <varlistentry> 7248bf6039f0SWarner Losh <term><errorname>EFAULT</errorname></term> 7249bf6039f0SWarner Losh 7250bf6039f0SWarner Losh <listitem><para>An interface with side effects failed in some way 7251bf6039f0SWarner Losh not directly related to <function>mallctl*()</function> 7252bf6039f0SWarner Losh read/write processing.</para></listitem> 7253bf6039f0SWarner Losh </varlistentry> 7254bf6039f0SWarner Losh </variablelist> 7255bf6039f0SWarner Losh </para> 7256bf6039f0SWarner Losh 7257bf6039f0SWarner Losh <para>The <function>malloc_usable_size()</function> function 7258bf6039f0SWarner Losh returns the usable size of the allocation pointed to by 7259bf6039f0SWarner Losh <parameter>ptr</parameter>. </para> 7260bf6039f0SWarner Losh </refsect2> 7261bf6039f0SWarner Losh </refsect1> 7262bf6039f0SWarner Losh <refsect1 id="environment"> 7263bf6039f0SWarner Losh <title>ENVIRONMENT</title> 7264bf6039f0SWarner Losh <para>The following environment variable affects the execution of the 7265bf6039f0SWarner Losh allocation functions: 7266bf6039f0SWarner Losh <variablelist> 7267bf6039f0SWarner Losh <varlistentry> 7268bf6039f0SWarner Losh <term><envar>MALLOC_CONF</envar></term> 7269bf6039f0SWarner Losh 7270bf6039f0SWarner Losh <listitem><para>If the environment variable 7271bf6039f0SWarner Losh <envar>MALLOC_CONF</envar> is set, the characters it contains 7272bf6039f0SWarner Losh will be interpreted as options.</para></listitem> 7273bf6039f0SWarner Losh </varlistentry> 7274bf6039f0SWarner Losh </variablelist> 7275bf6039f0SWarner Losh </para> 7276bf6039f0SWarner Losh </refsect1> 7277bf6039f0SWarner Losh <refsect1 id="examples"> 7278bf6039f0SWarner Losh <title>EXAMPLES</title> 7279bf6039f0SWarner Losh <para>To dump core whenever a problem occurs: 7280bf6039f0SWarner Losh <screen>ln -s 'abort:true' /etc/malloc.conf</screen> 7281bf6039f0SWarner Losh </para> 7282bf6039f0SWarner Losh <para>To specify in the source that only one arena should be automatically 7283bf6039f0SWarner Losh created: 7284bf6039f0SWarner Losh <programlisting language="C"><![CDATA[ 7285bf6039f0SWarner Loshmalloc_conf = "narenas:1";]]></programlisting></para> 7286bf6039f0SWarner Losh </refsect1> 7287bf6039f0SWarner Losh <refsect1 id="see_also"> 7288bf6039f0SWarner Losh <title>SEE ALSO</title> 7289bf6039f0SWarner Losh <para><citerefentry><refentrytitle>madvise</refentrytitle> 7290bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 7291bf6039f0SWarner Losh <citerefentry><refentrytitle>mmap</refentrytitle> 7292bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 7293bf6039f0SWarner Losh <citerefentry><refentrytitle>sbrk</refentrytitle> 7294bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 7295bf6039f0SWarner Losh <citerefentry><refentrytitle>utrace</refentrytitle> 7296bf6039f0SWarner Losh <manvolnum>2</manvolnum></citerefentry>, 7297bf6039f0SWarner Losh <citerefentry><refentrytitle>alloca</refentrytitle> 7298bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry>, 7299bf6039f0SWarner Losh <citerefentry><refentrytitle>atexit</refentrytitle> 7300bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry>, 7301bf6039f0SWarner Losh <citerefentry><refentrytitle>getpagesize</refentrytitle> 7302bf6039f0SWarner Losh <manvolnum>3</manvolnum></citerefentry></para> 7303bf6039f0SWarner Losh </refsect1> 7304bf6039f0SWarner Losh <refsect1 id="standards"> 7305bf6039f0SWarner Losh <title>STANDARDS</title> 7306bf6039f0SWarner Losh <para>The <function>malloc()</function>, 7307bf6039f0SWarner Losh <function>calloc()</function>, 7308bf6039f0SWarner Losh <function>realloc()</function>, and 7309bf6039f0SWarner Losh <function>free()</function> functions conform to ISO/IEC 7310bf6039f0SWarner Losh 9899:1990 (<quote>ISO C90</quote>).</para> 7311bf6039f0SWarner Losh 7312bf6039f0SWarner Losh <para>The <function>posix_memalign()</function> function conforms 7313bf6039f0SWarner Losh to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para> 7314bf6039f0SWarner Losh </refsect1> 7315a0dfba69SWarner Losh <refsect1 id="history"> 7316a0dfba69SWarner Losh <title>HISTORY</title> 7317a0dfba69SWarner Losh <para>The <function>malloc_usable_size()</function> and 7318a0dfba69SWarner Losh <function>posix_memalign()</function> functions first appeared in FreeBSD 7319a0dfba69SWarner Losh 7.0.</para> 7320a0dfba69SWarner Losh 7321a0dfba69SWarner Losh <para>The <function>aligned_alloc()</function>, 7322a0dfba69SWarner Losh <function>malloc_stats_print()</function>, and 7323a0dfba69SWarner Losh <function>mallctl*()</function> functions first appeared in FreeBSD 7324a0dfba69SWarner Losh 10.0.</para> 7325a0dfba69SWarner Losh 7326a0dfba69SWarner Losh <para>The <function>*allocx()</function> functions first appeared in FreeBSD 7327a0dfba69SWarner Losh 11.0.</para> 7328a0dfba69SWarner Losh </refsect1> 7329bf6039f0SWarner Losh</refentry> 7330*c43cad87SWarner Losh>>>>>>> main 7331