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