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