1*a78e148bSantirez<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>JEMALLOC</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="JEMALLOC"><a name="id2783946"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>jemalloc — general purpose memory allocation functions</p></div><div class="refsect1" title="LIBRARY"><a name="library"></a><h2>LIBRARY</h2><p>This manual describes jemalloc 2.2.1-0-g5ef7abf6d846720fb3fb8c737861c99b5ad1d862. More information 2*a78e148bSantirez can be found at the <a class="ulink" href="http://www.canonware.com/jemalloc/" target="_top">jemalloc website</a>.</p></div><div class="refsynopsisdiv" title="SYNOPSIS"><h2>SYNOPSIS</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <<code class="filename">stdlib.h</code>> 3*a78e148bSantirez#include <<code class="filename">jemalloc/jemalloc.h</code>></pre><div class="refsect2" title="Standard API"><a name="id2830421"></a><h3>Standard API</h3><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void *<b class="fsfunc">malloc</b>(</code></td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void *<b class="fsfunc">calloc</b>(</code></td><td>size_t <var class="pdparam">number</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">posix_memalign</b>(</code></td><td>void **<var class="pdparam">ptr</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">alignment</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void *<b class="fsfunc">realloc</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">size</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">free</b>(</code></td><td>void *<var class="pdparam">ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div></div><div class="refsect2" title="Non-standard API"><a name="id2837717"></a><h3>Non-standard API</h3><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">size_t <b class="fsfunc">malloc_usable_size</b>(</code></td><td>const void *<var class="pdparam">ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">malloc_stats_print</b>(</code></td><td>void <var class="pdparam">(*write_cb)</var> 4*a78e148bSantirez <code>(</code>void *, const char *<code>)</code> 5*a78e148bSantirez , </td></tr><tr><td>�</td><td>void *<var class="pdparam">cbopaque</var>, </td></tr><tr><td>�</td><td>const char *<var class="pdparam">opts</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">mallctl</b>(</code></td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td>�</td><td>void *<var class="pdparam">oldp</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">oldlenp</var>, </td></tr><tr><td>�</td><td>void *<var class="pdparam">newp</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">newlen</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">mallctlnametomib</b>(</code></td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">mibp</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">miblenp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">mallctlbymib</b>(</code></td><td>const size_t *<var class="pdparam">mib</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">miblen</var>, </td></tr><tr><td>�</td><td>void *<var class="pdparam">oldp</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">oldlenp</var>, </td></tr><tr><td>�</td><td>void *<var class="pdparam">newp</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">newlen</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">(*malloc_message)</b>(</code></td><td>void *<var class="pdparam">cbopaque</var>, </td></tr><tr><td>�</td><td>const char *<var class="pdparam">s</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><p><span class="type">const char *</span><code class="varname">malloc_conf</code>;</p></div><div class="refsect2" title="Experimental API"><a name="id2830042"></a><h3>Experimental API</h3><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">allocm</b>(</code></td><td>void **<var class="pdparam">ptr</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">rsize</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td>�</td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">rallocm</b>(</code></td><td>void **<var class="pdparam">ptr</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">rsize</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td>�</td><td>size_t <var class="pdparam">extra</var>, </td></tr><tr><td>�</td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">sallocm</b>(</code></td><td>const void *<var class="pdparam">ptr</var>, </td></tr><tr><td>�</td><td>size_t *<var class="pdparam">rsize</var>, </td></tr><tr><td>�</td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">dallocm</b>(</code></td><td>void *<var class="pdparam">ptr</var>, </td></tr><tr><td>�</td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div></div></div></div><div class="refsect1" title="DESCRIPTION"><a name="description"></a><h2>DESCRIPTION</h2><div class="refsect2" title="Standard API"><a name="id2840968"></a><h3>Standard API</h3><p>The <code class="function">malloc</code>(<em class="parameter"><code></code></em>) function allocates 6*a78e148bSantirez <em class="parameter"><code>size</code></em> bytes of uninitialized memory. The allocated 7*a78e148bSantirez space is suitably aligned (after possible pointer coercion) for storage 8*a78e148bSantirez of any type of object.</p><p>The <code class="function">calloc</code>(<em class="parameter"><code></code></em>) function allocates 9*a78e148bSantirez space for <em class="parameter"><code>number</code></em> objects, each 10*a78e148bSantirez <em class="parameter"><code>size</code></em> bytes in length. The result is identical to 11*a78e148bSantirez calling <code class="function">malloc</code>(<em class="parameter"><code></code></em>) with an argument of 12*a78e148bSantirez <em class="parameter"><code>number</code></em> * <em class="parameter"><code>size</code></em>, with the 13*a78e148bSantirez exception that the allocated memory is explicitly initialized to zero 14*a78e148bSantirez bytes.</p><p>The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function 15*a78e148bSantirez allocates <em class="parameter"><code>size</code></em> bytes of memory such that the 16*a78e148bSantirez allocation's base address is an even multiple of 17*a78e148bSantirez <em class="parameter"><code>alignment</code></em>, and returns the allocation in the value 18*a78e148bSantirez pointed to by <em class="parameter"><code>ptr</code></em>. The requested 19*a78e148bSantirez <em class="parameter"><code>alignment</code></em> must be a power of 2 at least as large 20*a78e148bSantirez as <code class="code">sizeof(<span class="type">void *</span>)</code>.</p><p>The <code class="function">realloc</code>(<em class="parameter"><code></code></em>) function changes the 21*a78e148bSantirez size of the previously allocated memory referenced by 22*a78e148bSantirez <em class="parameter"><code>ptr</code></em> to <em class="parameter"><code>size</code></em> bytes. The 23*a78e148bSantirez contents of the memory are unchanged up to the lesser of the new and old 24*a78e148bSantirez sizes. If the new size is larger, the contents of the newly allocated 25*a78e148bSantirez portion of the memory are undefined. Upon success, the memory referenced 26*a78e148bSantirez by <em class="parameter"><code>ptr</code></em> is freed and a pointer to the newly 27*a78e148bSantirez allocated memory is returned. Note that 28*a78e148bSantirez <code class="function">realloc</code>(<em class="parameter"><code></code></em>) may move the memory allocation, 29*a78e148bSantirez resulting in a different return value than <em class="parameter"><code>ptr</code></em>. 30*a78e148bSantirez If <em class="parameter"><code>ptr</code></em> is <code class="constant">NULL</code>, the 31*a78e148bSantirez <code class="function">realloc</code>(<em class="parameter"><code></code></em>) function behaves identically to 32*a78e148bSantirez <code class="function">malloc</code>(<em class="parameter"><code></code></em>) for the specified size.</p><p>The <code class="function">free</code>(<em class="parameter"><code></code></em>) function causes the 33*a78e148bSantirez allocated memory referenced by <em class="parameter"><code>ptr</code></em> to be made 34*a78e148bSantirez available for future allocations. If <em class="parameter"><code>ptr</code></em> is 35*a78e148bSantirez <code class="constant">NULL</code>, no action occurs.</p></div><div class="refsect2" title="Non-standard API"><a name="id2827225"></a><h3>Non-standard API</h3><p>The <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) function 36*a78e148bSantirez returns the usable size of the allocation pointed to by 37*a78e148bSantirez <em class="parameter"><code>ptr</code></em>. The return value may be larger than the size 38*a78e148bSantirez that was requested during allocation. The 39*a78e148bSantirez <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) function is not a 40*a78e148bSantirez mechanism for in-place <code class="function">realloc</code>(<em class="parameter"><code></code></em>); rather 41*a78e148bSantirez it is provided solely as a tool for introspection purposes. Any 42*a78e148bSantirez discrepancy between the requested allocation size and the size reported 43*a78e148bSantirez by <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) should not be 44*a78e148bSantirez depended on, since such behavior is entirely implementation-dependent. 45*a78e148bSantirez </p><p>The <code class="function">malloc_stats_print</code>(<em class="parameter"><code></code></em>) function 46*a78e148bSantirez writes human-readable summary statistics via the 47*a78e148bSantirez <em class="parameter"><code>write_cb</code></em> callback function pointer and 48*a78e148bSantirez <em class="parameter"><code>cbopaque</code></em> data passed to 49*a78e148bSantirez <em class="parameter"><code>write_cb</code></em>, or 50*a78e148bSantirez <code class="function">malloc_message</code>(<em class="parameter"><code></code></em>) if 51*a78e148bSantirez <em class="parameter"><code>write_cb</code></em> is <code class="constant">NULL</code>. This 52*a78e148bSantirez function can be called repeatedly. General information that never 53*a78e148bSantirez changes during execution can be omitted by specifying "g" as a character 54*a78e148bSantirez within the <em class="parameter"><code>opts</code></em> string. Note that 55*a78e148bSantirez <code class="function">malloc_message</code>(<em class="parameter"><code></code></em>) uses the 56*a78e148bSantirez <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) functions internally, so 57*a78e148bSantirez inconsistent statistics can be reported if multiple threads use these 58*a78e148bSantirez functions simultaneously. If <code class="option">--enable-stats</code> is 59*a78e148bSantirez specified during configuration, “m” and “a” can 60*a78e148bSantirez be specified to omit merged arena and per arena statistics, respectively; 61*a78e148bSantirez “b” and “l” can be specified to omit per size 62*a78e148bSantirez class statistics for bins and large objects, respectively. Unrecognized 63*a78e148bSantirez characters are silently ignored. Note that thread caching may prevent 64*a78e148bSantirez some statistics from being completely up to date, since extra locking 65*a78e148bSantirez would be required to merge counters that track thread cache operations. 66*a78e148bSantirez </p><p>The <code class="function">mallctl</code>(<em class="parameter"><code></code></em>) function provides a 67*a78e148bSantirez general interface for introspecting the memory allocator, as well as 68*a78e148bSantirez setting modifiable parameters and triggering actions. The 69*a78e148bSantirez period-separated <em class="parameter"><code>name</code></em> argument specifies a 70*a78e148bSantirez location in a tree-structured namespace; see the <a class="xref" href="#mallctl_namespace" title="MALLCTL NAMESPACE">MALLCTL NAMESPACE</a> section for 71*a78e148bSantirez documentation on the tree contents. To read a value, pass a pointer via 72*a78e148bSantirez <em class="parameter"><code>oldp</code></em> to adequate space to contain the value, and a 73*a78e148bSantirez pointer to its length via <em class="parameter"><code>oldlenp</code></em>; otherwise pass 74*a78e148bSantirez <code class="constant">NULL</code> and <code class="constant">NULL</code>. Similarly, to 75*a78e148bSantirez write a value, pass a pointer to the value via 76*a78e148bSantirez <em class="parameter"><code>newp</code></em>, and its length via 77*a78e148bSantirez <em class="parameter"><code>newlen</code></em>; otherwise pass <code class="constant">NULL</code> 78*a78e148bSantirez and <code class="constant">0</code>.</p><p>The <code class="function">mallctlnametomib</code>(<em class="parameter"><code></code></em>) function 79*a78e148bSantirez provides a way to avoid repeated name lookups for applications that 80*a78e148bSantirez repeatedly query the same portion of the namespace, by translating a name 81*a78e148bSantirez to a “Management Information Base” (MIB) that can be passed 82*a78e148bSantirez repeatedly to <code class="function">mallctlbymib</code>(<em class="parameter"><code></code></em>). Upon 83*a78e148bSantirez successful return from <code class="function">mallctlnametomib</code>(<em class="parameter"><code></code></em>), 84*a78e148bSantirez <em class="parameter"><code>mibp</code></em> contains an array of 85*a78e148bSantirez <em class="parameter"><code>*miblenp</code></em> integers, where 86*a78e148bSantirez <em class="parameter"><code>*miblenp</code></em> is the lesser of the number of components 87*a78e148bSantirez in <em class="parameter"><code>name</code></em> and the input value of 88*a78e148bSantirez <em class="parameter"><code>*miblenp</code></em>. Thus it is possible to pass a 89*a78e148bSantirez <em class="parameter"><code>*miblenp</code></em> that is smaller than the number of 90*a78e148bSantirez period-separated name components, which results in a partial MIB that can 91*a78e148bSantirez be used as the basis for constructing a complete MIB. For name 92*a78e148bSantirez components that are integers (e.g. the 2 in 93*a78e148bSantirez <a class="link" href="#arenas.bin.i.size"> 94*a78e148bSantirez "<code class="mallctl">arenas.bin.2.size</code>" 95*a78e148bSantirez </a>), 96*a78e148bSantirez the corresponding MIB component will always be that integer. Therefore, 97*a78e148bSantirez it is legitimate to construct code like the following: </p><pre class="programlisting"> 98*a78e148bSantirezunsigned nbins, i; 99*a78e148bSantirez 100*a78e148bSantirezint mib[4]; 101*a78e148bSantirezsize_t len, miblen; 102*a78e148bSantirez 103*a78e148bSantirezlen = sizeof(nbins); 104*a78e148bSantirezmallctl("arenas.nbins", &nbins, &len, NULL, 0); 105*a78e148bSantirez 106*a78e148bSantirezmiblen = 4; 107*a78e148bSantirezmallnametomib("arenas.bin.0.size", mib, &miblen); 108*a78e148bSantirezfor (i = 0; i < nbins; i++) { 109*a78e148bSantirez size_t bin_size; 110*a78e148bSantirez 111*a78e148bSantirez mib[2] = i; 112*a78e148bSantirez len = sizeof(bin_size); 113*a78e148bSantirez mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0); 114*a78e148bSantirez /* Do something with bin_size... */ 115*a78e148bSantirez}</pre></div><div class="refsect2" title="Experimental API"><a name="id2807945"></a><h3>Experimental API</h3><p>The experimental API is subject to change or removal without regard 116*a78e148bSantirez for backward compatibility.</p><p>The <code class="function">allocm</code>(<em class="parameter"><code></code></em>), 117*a78e148bSantirez <code class="function">rallocm</code>(<em class="parameter"><code></code></em>), 118*a78e148bSantirez <code class="function">sallocm</code>(<em class="parameter"><code></code></em>), and 119*a78e148bSantirez <code class="function">dallocm</code>(<em class="parameter"><code></code></em>) functions all have a 120*a78e148bSantirez <em class="parameter"><code>flags</code></em> argument that can be used to specify 121*a78e148bSantirez options. The functions only check the options that are contextually 122*a78e148bSantirez relevant. Use bitwise or (<code class="code">|</code>) operations to 123*a78e148bSantirez specify one or more of the following: 124*a78e148bSantirez </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">ALLOCM_LG_ALIGN(<em class="parameter"><code>la</code></em>) 125*a78e148bSantirez </code></span></dt><dd><p>Align the memory allocation to start at an address 126*a78e148bSantirez that is a multiple of <code class="code">(1 << 127*a78e148bSantirez <em class="parameter"><code>la</code></em>)</code>. This macro does not validate 128*a78e148bSantirez that <em class="parameter"><code>la</code></em> is within the valid 129*a78e148bSantirez range.</p></dd><dt><span class="term"><code class="constant">ALLOCM_ALIGN(<em class="parameter"><code>a</code></em>) 130*a78e148bSantirez </code></span></dt><dd><p>Align the memory allocation to start at an address 131*a78e148bSantirez that is a multiple of <em class="parameter"><code>a</code></em>, where 132*a78e148bSantirez <em class="parameter"><code>a</code></em> is a power of two. This macro does not 133*a78e148bSantirez validate that <em class="parameter"><code>a</code></em> is a power of 2. 134*a78e148bSantirez </p></dd><dt><span class="term"><code class="constant">ALLOCM_ZERO</code></span></dt><dd><p>Initialize newly allocated memory to contain zero 135*a78e148bSantirez bytes. In the growing reallocation case, the real size prior to 136*a78e148bSantirez reallocation defines the boundary between untouched bytes and those 137*a78e148bSantirez that are initialized to contain zero bytes. If this option is 138*a78e148bSantirez absent, newly allocated memory is uninitialized.</p></dd><dt><span class="term"><code class="constant">ALLOCM_NO_MOVE</code></span></dt><dd><p>For reallocation, fail rather than moving the 139*a78e148bSantirez object. This constraint can apply to both growth and 140*a78e148bSantirez shrinkage.</p></dd></dl></div><p> 141*a78e148bSantirez </p><p>The <code class="function">allocm</code>(<em class="parameter"><code></code></em>) function allocates at 142*a78e148bSantirez least <em class="parameter"><code>size</code></em> bytes of memory, sets 143*a78e148bSantirez <em class="parameter"><code>*ptr</code></em> to the base address of the allocation, and 144*a78e148bSantirez sets <em class="parameter"><code>*rsize</code></em> to the real size of the allocation if 145*a78e148bSantirez <em class="parameter"><code>rsize</code></em> is not <code class="constant">NULL</code>.</p><p>The <code class="function">rallocm</code>(<em class="parameter"><code></code></em>) function resizes the 146*a78e148bSantirez allocation at <em class="parameter"><code>*ptr</code></em> to be at least 147*a78e148bSantirez <em class="parameter"><code>size</code></em> bytes, sets <em class="parameter"><code>*ptr</code></em> to 148*a78e148bSantirez the base address of the allocation if it moved, and sets 149*a78e148bSantirez <em class="parameter"><code>*rsize</code></em> to the real size of the allocation if 150*a78e148bSantirez <em class="parameter"><code>rsize</code></em> is not <code class="constant">NULL</code>. If 151*a78e148bSantirez <em class="parameter"><code>extra</code></em> is non-zero, an attempt is made to resize 152*a78e148bSantirez the allocation to be at least <code class="code"><em class="parameter"><code>size</code></em> + 153*a78e148bSantirez <em class="parameter"><code>extra</code></em>)</code> bytes, though inability to allocate 154*a78e148bSantirez the extra byte(s) will not by itself result in failure. Behavior is 155*a78e148bSantirez undefined if <code class="code">(<em class="parameter"><code>size</code></em> + 156*a78e148bSantirez <em class="parameter"><code>extra</code></em> > 157*a78e148bSantirez <code class="constant">SIZE_T_MAX</code>)</code>.</p><p>The <code class="function">sallocm</code>(<em class="parameter"><code></code></em>) function sets 158*a78e148bSantirez <em class="parameter"><code>*rsize</code></em> to the real size of the allocation.</p><p>The <code class="function">dallocm</code>(<em class="parameter"><code></code></em>) function causes the 159*a78e148bSantirez memory referenced by <em class="parameter"><code>ptr</code></em> to be made available for 160*a78e148bSantirez future allocations.</p></div></div><div class="refsect1" title="TUNING"><a name="tuning"></a><h2>TUNING</h2><p>Once, when the first call is made to one of the memory allocation 161*a78e148bSantirez routines, the allocator initializes its internals based in part on various 162*a78e148bSantirez options that can be specified at compile- or run-time.</p><p>The string pointed to by the global variable 163*a78e148bSantirez <code class="varname">malloc_conf</code>, the “name” of the file 164*a78e148bSantirez referenced by the symbolic link named <code class="filename">/etc/malloc.conf</code>, and the value of the 165*a78e148bSantirez environment variable <code class="envar">MALLOC_CONF</code>, will be interpreted, in 166*a78e148bSantirez that order, from left to right as options.</p><p>An options string is a comma-separated list of option:value pairs. 167*a78e148bSantirez There is one key corresponding to each <a class="link" href="#opt.abort"> 168*a78e148bSantirez "<code class="mallctl">opt.*</code>" 169*a78e148bSantirez </a> mallctl (see the <a class="xref" href="#mallctl_namespace" title="MALLCTL NAMESPACE">MALLCTL NAMESPACE</a> section for options 170*a78e148bSantirez documentation). For example, <code class="literal">abort:true,narenas:1</code> sets 171*a78e148bSantirez the <a class="link" href="#opt.abort"> 172*a78e148bSantirez "<code class="mallctl">opt.abort</code>" 173*a78e148bSantirez </a> and <a class="link" href="#opt.narenas"> 174*a78e148bSantirez "<code class="mallctl">opt.narenas</code>" 175*a78e148bSantirez </a> options. Some 176*a78e148bSantirez options have boolean values (true/false), others have integer values (base 177*a78e148bSantirez 8, 10, or 16, depending on prefix), and yet others have raw string 178*a78e148bSantirez values.</p></div><div class="refsect1" title="IMPLEMENTATION NOTES"><a name="implementation_notes"></a><h2>IMPLEMENTATION NOTES</h2><p>Traditionally, allocators have used 179*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> to obtain memory, which is 180*a78e148bSantirez suboptimal for several reasons, including race conditions, increased 181*a78e148bSantirez fragmentation, and artificial limitations on maximum usable memory. If 182*a78e148bSantirez <code class="option">--enable-dss</code> is specified during configuration, this 183*a78e148bSantirez allocator uses both <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> and 184*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span>, in that order of preference; 185*a78e148bSantirez otherwise only <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> is used.</p><p>This allocator uses multiple arenas in order to reduce lock 186*a78e148bSantirez contention for threaded programs on multi-processor systems. This works 187*a78e148bSantirez well with regard to threading scalability, but incurs some costs. There is 188*a78e148bSantirez a small fixed per-arena overhead, and additionally, arenas manage memory 189*a78e148bSantirez completely independently of each other, which means a small fixed increase 190*a78e148bSantirez in overall memory fragmentation. These overheads are not generally an 191*a78e148bSantirez issue, given the number of arenas normally used. Note that using 192*a78e148bSantirez substantially more arenas than the default is not likely to improve 193*a78e148bSantirez performance, mainly due to reduced cache performance. However, it may make 194*a78e148bSantirez sense to reduce the number of arenas if an application does not make much 195*a78e148bSantirez use of the allocation functions.</p><p>In addition to multiple arenas, unless 196*a78e148bSantirez <code class="option">--disable-tcache</code> is specified during configuration, this 197*a78e148bSantirez allocator supports thread-specific caching for small and large objects, in 198*a78e148bSantirez order to make it possible to completely avoid synchronization for most 199*a78e148bSantirez allocation requests. Such caching allows very fast allocation in the 200*a78e148bSantirez common case, but it increases memory usage and fragmentation, since a 201*a78e148bSantirez bounded number of objects can remain allocated in each thread cache.</p><p>Memory is conceptually broken into equal-sized chunks, where the 202*a78e148bSantirez chunk size is a power of two that is greater than the page size. Chunks 203*a78e148bSantirez are always aligned to multiples of the chunk size. This alignment makes it 204*a78e148bSantirez possible to find metadata for user objects very quickly.</p><p>User objects are broken into three categories according to size: 205*a78e148bSantirez small, large, and huge. Small objects are smaller than one page. Large 206*a78e148bSantirez objects are smaller than the chunk size. Huge objects are a multiple of 207*a78e148bSantirez the chunk size. Small and large objects are managed by arenas; huge 208*a78e148bSantirez objects are managed separately in a single data structure that is shared by 209*a78e148bSantirez all threads. Huge objects are used by applications infrequently enough 210*a78e148bSantirez that this single data structure is not a scalability issue.</p><p>Each chunk that is managed by an arena tracks its contents as runs of 211*a78e148bSantirez contiguous pages (unused, backing a set of small objects, or backing one 212*a78e148bSantirez large object). The combination of chunk alignment and chunk page maps 213*a78e148bSantirez makes it possible to determine all metadata regarding small and large 214*a78e148bSantirez allocations in constant time.</p><p>Small objects are managed in groups by page runs. Each run maintains 215*a78e148bSantirez a frontier and free list to track which regions are in use. Unless 216*a78e148bSantirez <code class="option">--disable-tiny</code> is specified during configuration, 217*a78e148bSantirez allocation requests that are no more than half the quantum (8 or 16, 218*a78e148bSantirez depending on architecture) are rounded up to the nearest power of two that 219*a78e148bSantirez is at least <code class="code">sizeof(<span class="type">void *</span>)</code>. 220*a78e148bSantirez Allocation requests that are more than half the quantum, but no more than 221*a78e148bSantirez the minimum cacheline-multiple size class (see the <a class="link" href="#opt.lg_qspace_max"> 222*a78e148bSantirez "<code class="mallctl">opt.lg_qspace_max</code>" 223*a78e148bSantirez </a> 224*a78e148bSantirez option) are rounded up to the nearest multiple of the quantum. Allocation 225*a78e148bSantirez requests that are more than the minimum cacheline-multiple size class, but 226*a78e148bSantirez no more than the minimum subpage-multiple size class (see the <a class="link" href="#opt.lg_cspace_max"> 227*a78e148bSantirez "<code class="mallctl">opt.lg_cspace_max</code>" 228*a78e148bSantirez </a> 229*a78e148bSantirez option) are rounded up to the nearest multiple of the cacheline size (64). 230*a78e148bSantirez Allocation requests that are more than the minimum subpage-multiple size 231*a78e148bSantirez class, but no more than the maximum subpage-multiple size class are rounded 232*a78e148bSantirez up to the nearest multiple of the subpage size (256). Allocation requests 233*a78e148bSantirez that are more than the maximum subpage-multiple size class, but small 234*a78e148bSantirez enough to fit in an arena-managed chunk (see the <a class="link" href="#opt.lg_chunk"> 235*a78e148bSantirez "<code class="mallctl">opt.lg_chunk</code>" 236*a78e148bSantirez </a> option), are 237*a78e148bSantirez rounded up to the nearest run size. Allocation requests that are too large 238*a78e148bSantirez to fit in an arena-managed chunk are rounded up to the nearest multiple of 239*a78e148bSantirez the chunk size.</p><p>Allocations are packed tightly together, which can be an issue for 240*a78e148bSantirez multi-threaded applications. If you need to assure that allocations do not 241*a78e148bSantirez suffer from cacheline sharing, round your allocation requests up to the 242*a78e148bSantirez nearest multiple of the cacheline size, or specify cacheline alignment when 243*a78e148bSantirez allocating.</p><p>Assuming 4 MiB chunks, 4 KiB pages, and a 16-byte quantum on a 64-bit 244*a78e148bSantirez system, the size classes in each category are as shown in <a class="xref" href="#size_classes" title="Table�1.�Size classes">Table 1</a>.</p><div class="table"><a name="size_classes"></a><p class="title"><b>Table�1.�Size classes</b></p><div class="table-contents"><table summary="Size classes" border="1"><colgroup><col align="left"><col align="left"><col align="left"></colgroup><thead><tr><th align="left">Category</th><th align="left">Subcategory</th><th align="left">Size</th></tr></thead><tbody><tr><td rowspan="4" align="left">Small</td><td align="left">Tiny</td><td align="left">[8]</td></tr><tr><td align="left">Quantum-spaced</td><td align="left">[16, 32, 48, ..., 128]</td></tr><tr><td align="left">Cacheline-spaced</td><td align="left">[192, 256, 320, ..., 512]</td></tr><tr><td align="left">Subpage-spaced</td><td align="left">[768, 1024, 1280, ..., 3840]</td></tr><tr><td colspan="2" align="left">Large</td><td align="left">[4 KiB, 8 KiB, 12 KiB, ..., 4072 KiB]</td></tr><tr><td colspan="2" align="left">Huge</td><td align="left">[4 MiB, 8 MiB, 12 MiB, ...]</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1" title="MALLCTL NAMESPACE"><a name="mallctl_namespace"></a><h2>MALLCTL NAMESPACE</h2><p>The following names are defined in the namespace accessible via the 245*a78e148bSantirez <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) functions. Value types are 246*a78e148bSantirez specified in parentheses, their readable/writable statuses are encoded as 247*a78e148bSantirez <code class="literal">rw</code>, <code class="literal">r-</code>, <code class="literal">-w</code>, or 248*a78e148bSantirez <code class="literal">--</code>, and required build configuration flags follow, if 249*a78e148bSantirez any. A name element encoded as <code class="literal"><i></code> or 250*a78e148bSantirez <code class="literal"><j></code> indicates an integer component, where the 251*a78e148bSantirez integer varies from 0 to some upper value that must be determined via 252*a78e148bSantirez introspection. In the case of 253*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.*</code>" 254*a78e148bSantirez , 255*a78e148bSantirez <code class="literal"><i></code> equal to <a class="link" href="#arenas.narenas"> 256*a78e148bSantirez "<code class="mallctl">arenas.narenas</code>" 257*a78e148bSantirez </a> can be 258*a78e148bSantirez used to access the summation of statistics from all arenas. Take special 259*a78e148bSantirez note of the <a class="link" href="#epoch"> 260*a78e148bSantirez "<code class="mallctl">epoch</code>" 261*a78e148bSantirez </a> mallctl, 262*a78e148bSantirez which controls refreshing of cached dynamic statistics.</p><div class="variablelist"><dl><dt><span class="term"> 263*a78e148bSantirez 264*a78e148bSantirez "<code class="mallctl">version</code>" 265*a78e148bSantirez 266*a78e148bSantirez (<span class="type">const char *</span>) 267*a78e148bSantirez <code class="literal">r-</code> 268*a78e148bSantirez </span></dt><dd><p>Return the jemalloc version string.</p></dd><dt><a name="epoch"></a><span class="term"> 269*a78e148bSantirez 270*a78e148bSantirez "<code class="mallctl">epoch</code>" 271*a78e148bSantirez 272*a78e148bSantirez (<span class="type">uint64_t</span>) 273*a78e148bSantirez <code class="literal">rw</code> 274*a78e148bSantirez </span></dt><dd><p>If a value is passed in, refresh the data from which 275*a78e148bSantirez the <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) functions report values, 276*a78e148bSantirez and increment the epoch. Return the current epoch. This is useful for 277*a78e148bSantirez detecting whether another thread caused a refresh.</p></dd><dt><span class="term"> 278*a78e148bSantirez 279*a78e148bSantirez "<code class="mallctl">config.debug</code>" 280*a78e148bSantirez 281*a78e148bSantirez (<span class="type">bool</span>) 282*a78e148bSantirez <code class="literal">r-</code> 283*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-debug</code> was specified during 284*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 285*a78e148bSantirez 286*a78e148bSantirez "<code class="mallctl">config.dss</code>" 287*a78e148bSantirez 288*a78e148bSantirez (<span class="type">bool</span>) 289*a78e148bSantirez <code class="literal">r-</code> 290*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-dss</code> was specified during 291*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 292*a78e148bSantirez 293*a78e148bSantirez "<code class="mallctl">config.dynamic_page_shift</code>" 294*a78e148bSantirez 295*a78e148bSantirez (<span class="type">bool</span>) 296*a78e148bSantirez <code class="literal">r-</code> 297*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-dynamic-page-shift</code> was 298*a78e148bSantirez specified during build configuration.</p></dd><dt><span class="term"> 299*a78e148bSantirez 300*a78e148bSantirez "<code class="mallctl">config.fill</code>" 301*a78e148bSantirez 302*a78e148bSantirez (<span class="type">bool</span>) 303*a78e148bSantirez <code class="literal">r-</code> 304*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-fill</code> was specified during 305*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 306*a78e148bSantirez 307*a78e148bSantirez "<code class="mallctl">config.lazy_lock</code>" 308*a78e148bSantirez 309*a78e148bSantirez (<span class="type">bool</span>) 310*a78e148bSantirez <code class="literal">r-</code> 311*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-lazy-lock</code> was specified 312*a78e148bSantirez during build configuration.</p></dd><dt><span class="term"> 313*a78e148bSantirez 314*a78e148bSantirez "<code class="mallctl">config.prof</code>" 315*a78e148bSantirez 316*a78e148bSantirez (<span class="type">bool</span>) 317*a78e148bSantirez <code class="literal">r-</code> 318*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-prof</code> was specified during 319*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 320*a78e148bSantirez 321*a78e148bSantirez "<code class="mallctl">config.prof_libgcc</code>" 322*a78e148bSantirez 323*a78e148bSantirez (<span class="type">bool</span>) 324*a78e148bSantirez <code class="literal">r-</code> 325*a78e148bSantirez </span></dt><dd><p><code class="option">--disable-prof-libgcc</code> was not 326*a78e148bSantirez specified during build configuration.</p></dd><dt><span class="term"> 327*a78e148bSantirez 328*a78e148bSantirez "<code class="mallctl">config.prof_libunwind</code>" 329*a78e148bSantirez 330*a78e148bSantirez (<span class="type">bool</span>) 331*a78e148bSantirez <code class="literal">r-</code> 332*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-prof-libunwind</code> was specified 333*a78e148bSantirez during build configuration.</p></dd><dt><span class="term"> 334*a78e148bSantirez 335*a78e148bSantirez "<code class="mallctl">config.stats</code>" 336*a78e148bSantirez 337*a78e148bSantirez (<span class="type">bool</span>) 338*a78e148bSantirez <code class="literal">r-</code> 339*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-stats</code> was specified during 340*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 341*a78e148bSantirez 342*a78e148bSantirez "<code class="mallctl">config.swap</code>" 343*a78e148bSantirez 344*a78e148bSantirez (<span class="type">bool</span>) 345*a78e148bSantirez <code class="literal">r-</code> 346*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-swap</code> was specified during 347*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 348*a78e148bSantirez 349*a78e148bSantirez "<code class="mallctl">config.sysv</code>" 350*a78e148bSantirez 351*a78e148bSantirez (<span class="type">bool</span>) 352*a78e148bSantirez <code class="literal">r-</code> 353*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-sysv</code> was specified during 354*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 355*a78e148bSantirez 356*a78e148bSantirez "<code class="mallctl">config.tcache</code>" 357*a78e148bSantirez 358*a78e148bSantirez (<span class="type">bool</span>) 359*a78e148bSantirez <code class="literal">r-</code> 360*a78e148bSantirez </span></dt><dd><p><code class="option">--disable-tcache</code> was not specified 361*a78e148bSantirez during build configuration.</p></dd><dt><span class="term"> 362*a78e148bSantirez 363*a78e148bSantirez "<code class="mallctl">config.tiny</code>" 364*a78e148bSantirez 365*a78e148bSantirez (<span class="type">bool</span>) 366*a78e148bSantirez <code class="literal">r-</code> 367*a78e148bSantirez </span></dt><dd><p><code class="option">--disable-tiny</code> was not specified 368*a78e148bSantirez during build configuration.</p></dd><dt><span class="term"> 369*a78e148bSantirez 370*a78e148bSantirez "<code class="mallctl">config.tls</code>" 371*a78e148bSantirez 372*a78e148bSantirez (<span class="type">bool</span>) 373*a78e148bSantirez <code class="literal">r-</code> 374*a78e148bSantirez </span></dt><dd><p><code class="option">--disable-tls</code> was not specified during 375*a78e148bSantirez build configuration.</p></dd><dt><span class="term"> 376*a78e148bSantirez 377*a78e148bSantirez "<code class="mallctl">config.xmalloc</code>" 378*a78e148bSantirez 379*a78e148bSantirez (<span class="type">bool</span>) 380*a78e148bSantirez <code class="literal">r-</code> 381*a78e148bSantirez </span></dt><dd><p><code class="option">--enable-xmalloc</code> was specified during 382*a78e148bSantirez build configuration.</p></dd><dt><a name="opt.abort"></a><span class="term"> 383*a78e148bSantirez 384*a78e148bSantirez "<code class="mallctl">opt.abort</code>" 385*a78e148bSantirez 386*a78e148bSantirez (<span class="type">bool</span>) 387*a78e148bSantirez <code class="literal">r-</code> 388*a78e148bSantirez </span></dt><dd><p>Abort-on-warning enabled/disabled. If true, most 389*a78e148bSantirez warnings are fatal. The process will call 390*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">abort</span>(3)</span> in these cases. This option is 391*a78e148bSantirez disabled by default unless <code class="option">--enable-debug</code> is 392*a78e148bSantirez specified during configuration, in which case it is enabled by default. 393*a78e148bSantirez </p></dd><dt><a name="opt.lg_qspace_max"></a><span class="term"> 394*a78e148bSantirez 395*a78e148bSantirez "<code class="mallctl">opt.lg_qspace_max</code>" 396*a78e148bSantirez 397*a78e148bSantirez (<span class="type">size_t</span>) 398*a78e148bSantirez <code class="literal">r-</code> 399*a78e148bSantirez </span></dt><dd><p>Size (log base 2) of the maximum size class that is a 400*a78e148bSantirez multiple of the quantum (8 or 16 bytes, depending on architecture). 401*a78e148bSantirez Above this size, cacheline spacing is used for size classes. The 402*a78e148bSantirez default value is 128 bytes (2^7).</p></dd><dt><a name="opt.lg_cspace_max"></a><span class="term"> 403*a78e148bSantirez 404*a78e148bSantirez "<code class="mallctl">opt.lg_cspace_max</code>" 405*a78e148bSantirez 406*a78e148bSantirez (<span class="type">size_t</span>) 407*a78e148bSantirez <code class="literal">r-</code> 408*a78e148bSantirez </span></dt><dd><p>Size (log base 2) of the maximum size class that is a 409*a78e148bSantirez multiple of the cacheline size (64). Above this size, subpage spacing 410*a78e148bSantirez (256 bytes) is used for size classes. The default value is 512 bytes 411*a78e148bSantirez (2^9).</p></dd><dt><a name="opt.lg_chunk"></a><span class="term"> 412*a78e148bSantirez 413*a78e148bSantirez "<code class="mallctl">opt.lg_chunk</code>" 414*a78e148bSantirez 415*a78e148bSantirez (<span class="type">size_t</span>) 416*a78e148bSantirez <code class="literal">r-</code> 417*a78e148bSantirez </span></dt><dd><p>Virtual memory chunk size (log base 2). The default 418*a78e148bSantirez chunk size is 4 MiB (2^22).</p></dd><dt><a name="opt.narenas"></a><span class="term"> 419*a78e148bSantirez 420*a78e148bSantirez "<code class="mallctl">opt.narenas</code>" 421*a78e148bSantirez 422*a78e148bSantirez (<span class="type">size_t</span>) 423*a78e148bSantirez <code class="literal">r-</code> 424*a78e148bSantirez </span></dt><dd><p>Maximum number of arenas to use. The default maximum 425*a78e148bSantirez number of arenas is four times the number of CPUs, or one if there is a 426*a78e148bSantirez single CPU.</p></dd><dt><a name="opt.lg_dirty_mult"></a><span class="term"> 427*a78e148bSantirez 428*a78e148bSantirez "<code class="mallctl">opt.lg_dirty_mult</code>" 429*a78e148bSantirez 430*a78e148bSantirez (<span class="type">ssize_t</span>) 431*a78e148bSantirez <code class="literal">r-</code> 432*a78e148bSantirez </span></dt><dd><p>Per-arena minimum ratio (log base 2) of active to dirty 433*a78e148bSantirez pages. Some dirty unused pages may be allowed to accumulate, within 434*a78e148bSantirez the limit set by the ratio (or one chunk worth of dirty pages, 435*a78e148bSantirez whichever is greater), before informing the kernel about some of those 436*a78e148bSantirez pages via <span class="citerefentry"><span class="refentrytitle">madvise</span>(2)</span> or a similar system call. This 437*a78e148bSantirez provides the kernel with sufficient information to recycle dirty pages 438*a78e148bSantirez if physical memory becomes scarce and the pages remain unused. The 439*a78e148bSantirez default minimum ratio is 32:1 (2^5:1); an option value of -1 will 440*a78e148bSantirez disable dirty page purging.</p></dd><dt><a name="opt.stats_print"></a><span class="term"> 441*a78e148bSantirez 442*a78e148bSantirez "<code class="mallctl">opt.stats_print</code>" 443*a78e148bSantirez 444*a78e148bSantirez (<span class="type">bool</span>) 445*a78e148bSantirez <code class="literal">r-</code> 446*a78e148bSantirez </span></dt><dd><p>Enable/disable statistics printing at exit. If 447*a78e148bSantirez enabled, the <code class="function">malloc_stats_print</code>(<em class="parameter"><code></code></em>) 448*a78e148bSantirez function is called at program exit via an 449*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function. If 450*a78e148bSantirez <code class="option">--enable-stats</code> is specified during configuration, this 451*a78e148bSantirez has the potential to cause deadlock for a multi-threaded process that 452*a78e148bSantirez exits while one or more threads are executing in the memory allocation 453*a78e148bSantirez functions. Therefore, this option should only be used with care; it is 454*a78e148bSantirez primarily intended as a performance tuning aid during application 455*a78e148bSantirez development. This option is disabled by default.</p></dd><dt><a name="opt.junk"></a><span class="term"> 456*a78e148bSantirez 457*a78e148bSantirez "<code class="mallctl">opt.junk</code>" 458*a78e148bSantirez 459*a78e148bSantirez (<span class="type">bool</span>) 460*a78e148bSantirez <code class="literal">r-</code> 461*a78e148bSantirez [<code class="option">--enable-fill</code>] 462*a78e148bSantirez </span></dt><dd><p>Junk filling enabled/disabled. If enabled, each byte 463*a78e148bSantirez of uninitialized allocated memory will be initialized to 464*a78e148bSantirez <code class="literal">0xa5</code>. All deallocated memory will be initialized to 465*a78e148bSantirez <code class="literal">0x5a</code>. This is intended for debugging and will 466*a78e148bSantirez impact performance negatively. This option is disabled by default 467*a78e148bSantirez unless <code class="option">--enable-debug</code> is specified during 468*a78e148bSantirez configuration, in which case it is enabled by default.</p></dd><dt><a name="opt.zero"></a><span class="term"> 469*a78e148bSantirez 470*a78e148bSantirez "<code class="mallctl">opt.zero</code>" 471*a78e148bSantirez 472*a78e148bSantirez (<span class="type">bool</span>) 473*a78e148bSantirez <code class="literal">r-</code> 474*a78e148bSantirez [<code class="option">--enable-fill</code>] 475*a78e148bSantirez </span></dt><dd><p>Zero filling enabled/disabled. If enabled, each byte 476*a78e148bSantirez of uninitialized allocated memory will be initialized to 0. Note that 477*a78e148bSantirez this initialization only happens once for each byte, so 478*a78e148bSantirez <code class="function">realloc</code>(<em class="parameter"><code></code></em>) and 479*a78e148bSantirez <code class="function">rallocm</code>(<em class="parameter"><code></code></em>) calls do not zero memory that 480*a78e148bSantirez was previously allocated. This is intended for debugging and will 481*a78e148bSantirez impact performance negatively. This option is disabled by default. 482*a78e148bSantirez </p></dd><dt><a name="opt.sysv"></a><span class="term"> 483*a78e148bSantirez 484*a78e148bSantirez "<code class="mallctl">opt.sysv</code>" 485*a78e148bSantirez 486*a78e148bSantirez (<span class="type">bool</span>) 487*a78e148bSantirez <code class="literal">r-</code> 488*a78e148bSantirez [<code class="option">--enable-sysv</code>] 489*a78e148bSantirez </span></dt><dd><p>If enabled, attempting to allocate zero bytes will 490*a78e148bSantirez return a <code class="constant">NULL</code> pointer instead of a valid pointer. 491*a78e148bSantirez (The default behavior is to make a minimal allocation and return a 492*a78e148bSantirez pointer to it.) This option is provided for System V compatibility. 493*a78e148bSantirez This option is incompatible with the <a class="link" href="#opt.xmalloc"> 494*a78e148bSantirez "<code class="mallctl">opt.xmalloc</code>" 495*a78e148bSantirez </a> option. 496*a78e148bSantirez This option is disabled by default.</p></dd><dt><a name="opt.xmalloc"></a><span class="term"> 497*a78e148bSantirez 498*a78e148bSantirez "<code class="mallctl">opt.xmalloc</code>" 499*a78e148bSantirez 500*a78e148bSantirez (<span class="type">bool</span>) 501*a78e148bSantirez <code class="literal">r-</code> 502*a78e148bSantirez [<code class="option">--enable-xmalloc</code>] 503*a78e148bSantirez </span></dt><dd><p>Abort-on-out-of-memory enabled/disabled. If enabled, 504*a78e148bSantirez rather than returning failure for any allocation function, display a 505*a78e148bSantirez diagnostic message on <code class="constant">STDERR_FILENO</code> and cause the 506*a78e148bSantirez program to drop core (using 507*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">abort</span>(3)</span>). If an application is 508*a78e148bSantirez designed to depend on this behavior, set the option at compile time by 509*a78e148bSantirez including the following in the source code: 510*a78e148bSantirez </p><pre class="programlisting"> 511*a78e148bSantirezmalloc_conf = "xmalloc:true";</pre><p> 512*a78e148bSantirez This option is disabled by default.</p></dd><dt><a name="opt.tcache"></a><span class="term"> 513*a78e148bSantirez 514*a78e148bSantirez "<code class="mallctl">opt.tcache</code>" 515*a78e148bSantirez 516*a78e148bSantirez (<span class="type">bool</span>) 517*a78e148bSantirez <code class="literal">r-</code> 518*a78e148bSantirez [<code class="option">--enable-tcache</code>] 519*a78e148bSantirez </span></dt><dd><p>Thread-specific caching enabled/disabled. When there 520*a78e148bSantirez are multiple threads, each thread uses a thread-specific cache for 521*a78e148bSantirez objects up to a certain size. Thread-specific caching allows many 522*a78e148bSantirez allocations to be satisfied without performing any thread 523*a78e148bSantirez synchronization, at the cost of increased memory use. See the 524*a78e148bSantirez <a class="link" href="#opt.lg_tcache_gc_sweep"> 525*a78e148bSantirez "<code class="mallctl">opt.lg_tcache_gc_sweep</code>" 526*a78e148bSantirez </a> 527*a78e148bSantirez and <a class="link" href="#opt.lg_tcache_max"> 528*a78e148bSantirez "<code class="mallctl">opt.lg_tcache_max</code>" 529*a78e148bSantirez </a> 530*a78e148bSantirez options for related tuning information. This option is enabled by 531*a78e148bSantirez default.</p></dd><dt><a name="opt.lg_tcache_gc_sweep"></a><span class="term"> 532*a78e148bSantirez 533*a78e148bSantirez "<code class="mallctl">opt.lg_tcache_gc_sweep</code>" 534*a78e148bSantirez 535*a78e148bSantirez (<span class="type">ssize_t</span>) 536*a78e148bSantirez <code class="literal">r-</code> 537*a78e148bSantirez [<code class="option">--enable-tcache</code>] 538*a78e148bSantirez </span></dt><dd><p>Approximate interval (log base 2) between full 539*a78e148bSantirez thread-specific cache garbage collection sweeps, counted in terms of 540*a78e148bSantirez thread-specific cache allocation/deallocation events. Garbage 541*a78e148bSantirez collection is actually performed incrementally, one size class at a 542*a78e148bSantirez time, in order to avoid large collection pauses. The default sweep 543*a78e148bSantirez interval is 8192 (2^13); setting this option to -1 will disable garbage 544*a78e148bSantirez collection.</p></dd><dt><a name="opt.lg_tcache_max"></a><span class="term"> 545*a78e148bSantirez 546*a78e148bSantirez "<code class="mallctl">opt.lg_tcache_max</code>" 547*a78e148bSantirez 548*a78e148bSantirez (<span class="type">size_t</span>) 549*a78e148bSantirez <code class="literal">r-</code> 550*a78e148bSantirez [<code class="option">--enable-tcache</code>] 551*a78e148bSantirez </span></dt><dd><p>Maximum size class (log base 2) to cache in the 552*a78e148bSantirez thread-specific cache. At a minimum, all small size classes are 553*a78e148bSantirez cached, and at a maximum all large size classes are cached. The 554*a78e148bSantirez default maximum is 32 KiB (2^15).</p></dd><dt><a name="opt.prof"></a><span class="term"> 555*a78e148bSantirez 556*a78e148bSantirez "<code class="mallctl">opt.prof</code>" 557*a78e148bSantirez 558*a78e148bSantirez (<span class="type">bool</span>) 559*a78e148bSantirez <code class="literal">r-</code> 560*a78e148bSantirez [<code class="option">--enable-prof</code>] 561*a78e148bSantirez </span></dt><dd><p>Memory profiling enabled/disabled. If enabled, profile 562*a78e148bSantirez memory allocation activity, and use an 563*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function to dump final memory 564*a78e148bSantirez usage to a file named according to the pattern 565*a78e148bSantirez <code class="filename"><prefix>.<pid>.<seq>.f.heap</code>, 566*a78e148bSantirez where <code class="literal"><prefix></code> is controlled by the <a class="link" href="#opt.prof_prefix"> 567*a78e148bSantirez "<code class="mallctl">opt.prof_prefix</code>" 568*a78e148bSantirez </a> 569*a78e148bSantirez option. See the <a class="link" href="#opt.lg_prof_bt_max"> 570*a78e148bSantirez "<code class="mallctl">opt.lg_prof_bt_max</code>" 571*a78e148bSantirez </a> 572*a78e148bSantirez option for backtrace depth control. See the <a class="link" href="#opt.prof_active"> 573*a78e148bSantirez "<code class="mallctl">opt.prof_active</code>" 574*a78e148bSantirez </a> 575*a78e148bSantirez option for on-the-fly activation/deactivation. See the <a class="link" href="#opt.lg_prof_sample"> 576*a78e148bSantirez "<code class="mallctl">opt.lg_prof_sample</code>" 577*a78e148bSantirez </a> 578*a78e148bSantirez option for probabilistic sampling control. See the <a class="link" href="#opt.prof_accum"> 579*a78e148bSantirez "<code class="mallctl">opt.prof_accum</code>" 580*a78e148bSantirez </a> 581*a78e148bSantirez option for control of cumulative sample reporting. See the <a class="link" href="#opt.lg_prof_tcmax"> 582*a78e148bSantirez "<code class="mallctl">opt.lg_prof_tcmax</code>" 583*a78e148bSantirez </a> 584*a78e148bSantirez option for control of per thread backtrace caching. See the <a class="link" href="#opt.lg_prof_interval"> 585*a78e148bSantirez "<code class="mallctl">opt.lg_prof_interval</code>" 586*a78e148bSantirez </a> 587*a78e148bSantirez option for information on interval-triggered profile dumping, and the 588*a78e148bSantirez <a class="link" href="#opt.prof_gdump"> 589*a78e148bSantirez "<code class="mallctl">opt.prof_gdump</code>" 590*a78e148bSantirez </a> 591*a78e148bSantirez option for information on high-water-triggered profile dumping. 592*a78e148bSantirez Profile output is compatible with the included <span class="command"><strong>pprof</strong></span> 593*a78e148bSantirez Perl script, which originates from the <a class="ulink" href="http://code.google.com/p/google-perftools/" target="_top">google-perftools 594*a78e148bSantirez package</a>.</p></dd><dt><a name="opt.prof_prefix"></a><span class="term"> 595*a78e148bSantirez 596*a78e148bSantirez "<code class="mallctl">opt.prof_prefix</code>" 597*a78e148bSantirez 598*a78e148bSantirez (<span class="type">const char *</span>) 599*a78e148bSantirez <code class="literal">r-</code> 600*a78e148bSantirez [<code class="option">--enable-prof</code>] 601*a78e148bSantirez </span></dt><dd><p>Filename prefix for profile dumps. If the prefix is 602*a78e148bSantirez set to the empty string, no automatic dumps will occur; this is 603*a78e148bSantirez primarily useful for disabling the automatic final heap dump (which 604*a78e148bSantirez also disables leak reporting, if enabled). The default prefix is 605*a78e148bSantirez <code class="filename">jeprof</code>.</p></dd><dt><a name="opt.lg_prof_bt_max"></a><span class="term"> 606*a78e148bSantirez 607*a78e148bSantirez "<code class="mallctl">opt.lg_prof_bt_max</code>" 608*a78e148bSantirez 609*a78e148bSantirez (<span class="type">size_t</span>) 610*a78e148bSantirez <code class="literal">r-</code> 611*a78e148bSantirez [<code class="option">--enable-prof</code>] 612*a78e148bSantirez </span></dt><dd><p>Maximum backtrace depth (log base 2) when profiling 613*a78e148bSantirez memory allocation activity. The default is 128 (2^7).</p></dd><dt><a name="opt.prof_active"></a><span class="term"> 614*a78e148bSantirez 615*a78e148bSantirez "<code class="mallctl">opt.prof_active</code>" 616*a78e148bSantirez 617*a78e148bSantirez (<span class="type">bool</span>) 618*a78e148bSantirez <code class="literal">r-</code> 619*a78e148bSantirez [<code class="option">--enable-prof</code>] 620*a78e148bSantirez </span></dt><dd><p>Profiling activated/deactivated. This is a secondary 621*a78e148bSantirez control mechanism that makes it possible to start the application with 622*a78e148bSantirez profiling enabled (see the <a class="link" href="#opt.prof"> 623*a78e148bSantirez "<code class="mallctl">opt.prof</code>" 624*a78e148bSantirez </a> option) but 625*a78e148bSantirez inactive, then toggle profiling at any time during program execution 626*a78e148bSantirez with the <a class="link" href="#prof.active"> 627*a78e148bSantirez "<code class="mallctl">prof.active</code>" 628*a78e148bSantirez </a> mallctl. 629*a78e148bSantirez This option is enabled by default.</p></dd><dt><a name="opt.lg_prof_sample"></a><span class="term"> 630*a78e148bSantirez 631*a78e148bSantirez "<code class="mallctl">opt.lg_prof_sample</code>" 632*a78e148bSantirez 633*a78e148bSantirez (<span class="type">ssize_t</span>) 634*a78e148bSantirez <code class="literal">r-</code> 635*a78e148bSantirez [<code class="option">--enable-prof</code>] 636*a78e148bSantirez </span></dt><dd><p>Average interval (log base 2) between allocation 637*a78e148bSantirez samples, as measured in bytes of allocation activity. Increasing the 638*a78e148bSantirez sampling interval decreases profile fidelity, but also decreases the 639*a78e148bSantirez computational overhead. The default sample interval is 1 (2^0) (i.e. 640*a78e148bSantirez all allocations are sampled).</p></dd><dt><a name="opt.prof_accum"></a><span class="term"> 641*a78e148bSantirez 642*a78e148bSantirez "<code class="mallctl">opt.prof_accum</code>" 643*a78e148bSantirez 644*a78e148bSantirez (<span class="type">bool</span>) 645*a78e148bSantirez <code class="literal">r-</code> 646*a78e148bSantirez [<code class="option">--enable-prof</code>] 647*a78e148bSantirez </span></dt><dd><p>Reporting of cumulative object/byte counts in profile 648*a78e148bSantirez dumps enabled/disabled. If this option is enabled, every unique 649*a78e148bSantirez backtrace must be stored for the duration of execution. Depending on 650*a78e148bSantirez the application, this can impose a large memory overhead, and the 651*a78e148bSantirez cumulative counts are not always of interest. See the 652*a78e148bSantirez <a class="link" href="#opt.lg_prof_tcmax"> 653*a78e148bSantirez "<code class="mallctl">opt.lg_prof_tcmax</code>" 654*a78e148bSantirez </a> 655*a78e148bSantirez option for control of per thread backtrace caching, which has important 656*a78e148bSantirez interactions. This option is enabled by default.</p></dd><dt><a name="opt.lg_prof_tcmax"></a><span class="term"> 657*a78e148bSantirez 658*a78e148bSantirez "<code class="mallctl">opt.lg_prof_tcmax</code>" 659*a78e148bSantirez 660*a78e148bSantirez (<span class="type">ssize_t</span>) 661*a78e148bSantirez <code class="literal">r-</code> 662*a78e148bSantirez [<code class="option">--enable-prof</code>] 663*a78e148bSantirez </span></dt><dd><p>Maximum per thread backtrace cache (log base 2) used 664*a78e148bSantirez for heap profiling. A backtrace can only be discarded if the 665*a78e148bSantirez <a class="link" href="#opt.prof_accum"> 666*a78e148bSantirez "<code class="mallctl">opt.prof_accum</code>" 667*a78e148bSantirez </a> 668*a78e148bSantirez option is disabled, and no thread caches currently refer to the 669*a78e148bSantirez backtrace. Therefore, a backtrace cache limit should be imposed if the 670*a78e148bSantirez intention is to limit how much memory is used by backtraces. By 671*a78e148bSantirez default, no limit is imposed (encoded as -1). 672*a78e148bSantirez </p></dd><dt><a name="opt.lg_prof_interval"></a><span class="term"> 673*a78e148bSantirez 674*a78e148bSantirez "<code class="mallctl">opt.lg_prof_interval</code>" 675*a78e148bSantirez 676*a78e148bSantirez (<span class="type">ssize_t</span>) 677*a78e148bSantirez <code class="literal">r-</code> 678*a78e148bSantirez [<code class="option">--enable-prof</code>] 679*a78e148bSantirez </span></dt><dd><p>Average interval (log base 2) between memory profile 680*a78e148bSantirez dumps, as measured in bytes of allocation activity. The actual 681*a78e148bSantirez interval between dumps may be sporadic because decentralized allocation 682*a78e148bSantirez counters are used to avoid synchronization bottlenecks. Profiles are 683*a78e148bSantirez dumped to files named according to the pattern 684*a78e148bSantirez <code class="filename"><prefix>.<pid>.<seq>.i<iseq>.heap</code>, 685*a78e148bSantirez where <code class="literal"><prefix></code> is controlled by the 686*a78e148bSantirez <a class="link" href="#opt.prof_prefix"> 687*a78e148bSantirez "<code class="mallctl">opt.prof_prefix</code>" 688*a78e148bSantirez </a> 689*a78e148bSantirez option. By default, interval-triggered profile dumping is disabled 690*a78e148bSantirez (encoded as -1). 691*a78e148bSantirez </p></dd><dt><a name="opt.prof_gdump"></a><span class="term"> 692*a78e148bSantirez 693*a78e148bSantirez "<code class="mallctl">opt.prof_gdump</code>" 694*a78e148bSantirez 695*a78e148bSantirez (<span class="type">bool</span>) 696*a78e148bSantirez <code class="literal">r-</code> 697*a78e148bSantirez [<code class="option">--enable-prof</code>] 698*a78e148bSantirez </span></dt><dd><p>Trigger a memory profile dump every time the total 699*a78e148bSantirez virtual memory exceeds the previous maximum. Profiles are dumped to 700*a78e148bSantirez files named according to the pattern 701*a78e148bSantirez <code class="filename"><prefix>.<pid>.<seq>.u<useq>.heap</code>, 702*a78e148bSantirez where <code class="literal"><prefix></code> is controlled by the <a class="link" href="#opt.prof_prefix"> 703*a78e148bSantirez "<code class="mallctl">opt.prof_prefix</code>" 704*a78e148bSantirez </a> 705*a78e148bSantirez option. This option is disabled by default.</p></dd><dt><a name="opt.prof_leak"></a><span class="term"> 706*a78e148bSantirez 707*a78e148bSantirez "<code class="mallctl">opt.prof_leak</code>" 708*a78e148bSantirez 709*a78e148bSantirez (<span class="type">bool</span>) 710*a78e148bSantirez <code class="literal">r-</code> 711*a78e148bSantirez [<code class="option">--enable-prof</code>] 712*a78e148bSantirez </span></dt><dd><p>Leak reporting enabled/disabled. If enabled, use an 713*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span> function to report memory leaks 714*a78e148bSantirez detected by allocation sampling. See the 715*a78e148bSantirez <a class="link" href="#opt.lg_prof_bt_max"> 716*a78e148bSantirez "<code class="mallctl">opt.lg_prof_bt_max</code>" 717*a78e148bSantirez </a> 718*a78e148bSantirez option for backtrace depth control. See the 719*a78e148bSantirez <a class="link" href="#opt.prof"> 720*a78e148bSantirez "<code class="mallctl">opt.prof</code>" 721*a78e148bSantirez </a> option for 722*a78e148bSantirez information on analyzing heap profile output. This option is disabled 723*a78e148bSantirez by default.</p></dd><dt><a name="opt.overcommit"></a><span class="term"> 724*a78e148bSantirez 725*a78e148bSantirez "<code class="mallctl">opt.overcommit</code>" 726*a78e148bSantirez 727*a78e148bSantirez (<span class="type">bool</span>) 728*a78e148bSantirez <code class="literal">r-</code> 729*a78e148bSantirez [<code class="option">--enable-swap</code>] 730*a78e148bSantirez </span></dt><dd><p>Over-commit enabled/disabled. If enabled, over-commit 731*a78e148bSantirez memory as a side effect of using anonymous 732*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> or 733*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> for virtual memory allocation. 734*a78e148bSantirez In order for overcommit to be disabled, the <a class="link" href="#swap.fds"> 735*a78e148bSantirez "<code class="mallctl">swap.fds</code>" 736*a78e148bSantirez </a> mallctl must have 737*a78e148bSantirez been successfully written to. This option is enabled by 738*a78e148bSantirez default.</p></dd><dt><span class="term"> 739*a78e148bSantirez 740*a78e148bSantirez "<code class="mallctl">tcache.flush</code>" 741*a78e148bSantirez 742*a78e148bSantirez (<span class="type">void</span>) 743*a78e148bSantirez <code class="literal">--</code> 744*a78e148bSantirez [<code class="option">--enable-tcache</code>] 745*a78e148bSantirez </span></dt><dd><p>Flush calling thread's tcache. This interface releases 746*a78e148bSantirez all cached objects and internal data structures associated with the 747*a78e148bSantirez calling thread's thread-specific cache. Ordinarily, this interface 748*a78e148bSantirez need not be called, since automatic periodic incremental garbage 749*a78e148bSantirez collection occurs, and the thread cache is automatically discarded when 750*a78e148bSantirez a thread exits. However, garbage collection is triggered by allocation 751*a78e148bSantirez activity, so it is possible for a thread that stops 752*a78e148bSantirez allocating/deallocating to retain its cache indefinitely, in which case 753*a78e148bSantirez the developer may find manual flushing useful.</p></dd><dt><span class="term"> 754*a78e148bSantirez 755*a78e148bSantirez "<code class="mallctl">thread.arena</code>" 756*a78e148bSantirez 757*a78e148bSantirez (<span class="type">unsigned</span>) 758*a78e148bSantirez <code class="literal">rw</code> 759*a78e148bSantirez </span></dt><dd><p>Get or set the arena associated with the calling 760*a78e148bSantirez thread. The arena index must be less than the maximum number of arenas 761*a78e148bSantirez (see the <a class="link" href="#arenas.narenas"> 762*a78e148bSantirez "<code class="mallctl">arenas.narenas</code>" 763*a78e148bSantirez </a> 764*a78e148bSantirez mallctl). If the specified arena was not initialized beforehand (see 765*a78e148bSantirez the <a class="link" href="#arenas.initialized"> 766*a78e148bSantirez "<code class="mallctl">arenas.initialized</code>" 767*a78e148bSantirez </a> 768*a78e148bSantirez mallctl), it will be automatically initialized as a side effect of 769*a78e148bSantirez calling this interface.</p></dd><dt><a name="thread.allocated"></a><span class="term"> 770*a78e148bSantirez 771*a78e148bSantirez "<code class="mallctl">thread.allocated</code>" 772*a78e148bSantirez 773*a78e148bSantirez (<span class="type">uint64_t</span>) 774*a78e148bSantirez <code class="literal">r-</code> 775*a78e148bSantirez [<code class="option">--enable-stats</code>] 776*a78e148bSantirez </span></dt><dd><p>Get the total number of bytes ever allocated by the 777*a78e148bSantirez calling thread. This counter has the potential to wrap around; it is 778*a78e148bSantirez up to the application to appropriately interpret the counter in such 779*a78e148bSantirez cases.</p></dd><dt><span class="term"> 780*a78e148bSantirez 781*a78e148bSantirez "<code class="mallctl">thread.allocatedp</code>" 782*a78e148bSantirez 783*a78e148bSantirez (<span class="type">uint64_t *</span>) 784*a78e148bSantirez <code class="literal">r-</code> 785*a78e148bSantirez [<code class="option">--enable-stats</code>] 786*a78e148bSantirez </span></dt><dd><p>Get a pointer to the the value that is returned by the 787*a78e148bSantirez <a class="link" href="#thread.allocated"> 788*a78e148bSantirez "<code class="mallctl">thread.allocated</code>" 789*a78e148bSantirez </a> 790*a78e148bSantirez mallctl. This is useful for avoiding the overhead of repeated 791*a78e148bSantirez <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) calls.</p></dd><dt><a name="thread.deallocated"></a><span class="term"> 792*a78e148bSantirez 793*a78e148bSantirez "<code class="mallctl">thread.deallocated</code>" 794*a78e148bSantirez 795*a78e148bSantirez (<span class="type">uint64_t</span>) 796*a78e148bSantirez <code class="literal">r-</code> 797*a78e148bSantirez [<code class="option">--enable-stats</code>] 798*a78e148bSantirez </span></dt><dd><p>Get the total number of bytes ever deallocated by the 799*a78e148bSantirez calling thread. This counter has the potential to wrap around; it is 800*a78e148bSantirez up to the application to appropriately interpret the counter in such 801*a78e148bSantirez cases.</p></dd><dt><span class="term"> 802*a78e148bSantirez 803*a78e148bSantirez "<code class="mallctl">thread.deallocatedp</code>" 804*a78e148bSantirez 805*a78e148bSantirez (<span class="type">uint64_t *</span>) 806*a78e148bSantirez <code class="literal">r-</code> 807*a78e148bSantirez [<code class="option">--enable-stats</code>] 808*a78e148bSantirez </span></dt><dd><p>Get a pointer to the the value that is returned by the 809*a78e148bSantirez <a class="link" href="#thread.deallocated"> 810*a78e148bSantirez "<code class="mallctl">thread.deallocated</code>" 811*a78e148bSantirez </a> 812*a78e148bSantirez mallctl. This is useful for avoiding the overhead of repeated 813*a78e148bSantirez <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) calls.</p></dd><dt><a name="arenas.narenas"></a><span class="term"> 814*a78e148bSantirez 815*a78e148bSantirez "<code class="mallctl">arenas.narenas</code>" 816*a78e148bSantirez 817*a78e148bSantirez (<span class="type">unsigned</span>) 818*a78e148bSantirez <code class="literal">r-</code> 819*a78e148bSantirez </span></dt><dd><p>Maximum number of arenas.</p></dd><dt><a name="arenas.initialized"></a><span class="term"> 820*a78e148bSantirez 821*a78e148bSantirez "<code class="mallctl">arenas.initialized</code>" 822*a78e148bSantirez 823*a78e148bSantirez (<span class="type">bool *</span>) 824*a78e148bSantirez <code class="literal">r-</code> 825*a78e148bSantirez </span></dt><dd><p>An array of <a class="link" href="#arenas.narenas"> 826*a78e148bSantirez "<code class="mallctl">arenas.narenas</code>" 827*a78e148bSantirez </a> 828*a78e148bSantirez booleans. Each boolean indicates whether the corresponding arena is 829*a78e148bSantirez initialized.</p></dd><dt><span class="term"> 830*a78e148bSantirez 831*a78e148bSantirez "<code class="mallctl">arenas.quantum</code>" 832*a78e148bSantirez 833*a78e148bSantirez (<span class="type">size_t</span>) 834*a78e148bSantirez <code class="literal">r-</code> 835*a78e148bSantirez </span></dt><dd><p>Quantum size.</p></dd><dt><span class="term"> 836*a78e148bSantirez 837*a78e148bSantirez "<code class="mallctl">arenas.cacheline</code>" 838*a78e148bSantirez 839*a78e148bSantirez (<span class="type">size_t</span>) 840*a78e148bSantirez <code class="literal">r-</code> 841*a78e148bSantirez </span></dt><dd><p>Assumed cacheline size.</p></dd><dt><span class="term"> 842*a78e148bSantirez 843*a78e148bSantirez "<code class="mallctl">arenas.subpage</code>" 844*a78e148bSantirez 845*a78e148bSantirez (<span class="type">size_t</span>) 846*a78e148bSantirez <code class="literal">r-</code> 847*a78e148bSantirez </span></dt><dd><p>Subpage size class interval.</p></dd><dt><span class="term"> 848*a78e148bSantirez 849*a78e148bSantirez "<code class="mallctl">arenas.pagesize</code>" 850*a78e148bSantirez 851*a78e148bSantirez (<span class="type">size_t</span>) 852*a78e148bSantirez <code class="literal">r-</code> 853*a78e148bSantirez </span></dt><dd><p>Page size.</p></dd><dt><span class="term"> 854*a78e148bSantirez 855*a78e148bSantirez "<code class="mallctl">arenas.chunksize</code>" 856*a78e148bSantirez 857*a78e148bSantirez (<span class="type">size_t</span>) 858*a78e148bSantirez <code class="literal">r-</code> 859*a78e148bSantirez </span></dt><dd><p>Chunk size.</p></dd><dt><span class="term"> 860*a78e148bSantirez 861*a78e148bSantirez "<code class="mallctl">arenas.tspace_min</code>" 862*a78e148bSantirez 863*a78e148bSantirez (<span class="type">size_t</span>) 864*a78e148bSantirez <code class="literal">r-</code> 865*a78e148bSantirez </span></dt><dd><p>Minimum tiny size class. Tiny size classes are powers 866*a78e148bSantirez of two.</p></dd><dt><span class="term"> 867*a78e148bSantirez 868*a78e148bSantirez "<code class="mallctl">arenas.tspace_max</code>" 869*a78e148bSantirez 870*a78e148bSantirez (<span class="type">size_t</span>) 871*a78e148bSantirez <code class="literal">r-</code> 872*a78e148bSantirez </span></dt><dd><p>Maximum tiny size class. Tiny size classes are powers 873*a78e148bSantirez of two.</p></dd><dt><span class="term"> 874*a78e148bSantirez 875*a78e148bSantirez "<code class="mallctl">arenas.qspace_min</code>" 876*a78e148bSantirez 877*a78e148bSantirez (<span class="type">size_t</span>) 878*a78e148bSantirez <code class="literal">r-</code> 879*a78e148bSantirez </span></dt><dd><p>Minimum quantum-spaced size class.</p></dd><dt><span class="term"> 880*a78e148bSantirez 881*a78e148bSantirez "<code class="mallctl">arenas.qspace_max</code>" 882*a78e148bSantirez 883*a78e148bSantirez (<span class="type">size_t</span>) 884*a78e148bSantirez <code class="literal">r-</code> 885*a78e148bSantirez </span></dt><dd><p>Maximum quantum-spaced size class.</p></dd><dt><span class="term"> 886*a78e148bSantirez 887*a78e148bSantirez "<code class="mallctl">arenas.cspace_min</code>" 888*a78e148bSantirez 889*a78e148bSantirez (<span class="type">size_t</span>) 890*a78e148bSantirez <code class="literal">r-</code> 891*a78e148bSantirez </span></dt><dd><p>Minimum cacheline-spaced size class.</p></dd><dt><span class="term"> 892*a78e148bSantirez 893*a78e148bSantirez "<code class="mallctl">arenas.cspace_max</code>" 894*a78e148bSantirez 895*a78e148bSantirez (<span class="type">size_t</span>) 896*a78e148bSantirez <code class="literal">r-</code> 897*a78e148bSantirez </span></dt><dd><p>Maximum cacheline-spaced size class.</p></dd><dt><span class="term"> 898*a78e148bSantirez 899*a78e148bSantirez "<code class="mallctl">arenas.sspace_min</code>" 900*a78e148bSantirez 901*a78e148bSantirez (<span class="type">size_t</span>) 902*a78e148bSantirez <code class="literal">r-</code> 903*a78e148bSantirez </span></dt><dd><p>Minimum subpage-spaced size class.</p></dd><dt><span class="term"> 904*a78e148bSantirez 905*a78e148bSantirez "<code class="mallctl">arenas.sspace_max</code>" 906*a78e148bSantirez 907*a78e148bSantirez (<span class="type">size_t</span>) 908*a78e148bSantirez <code class="literal">r-</code> 909*a78e148bSantirez </span></dt><dd><p>Maximum subpage-spaced size class.</p></dd><dt><span class="term"> 910*a78e148bSantirez 911*a78e148bSantirez "<code class="mallctl">arenas.tcache_max</code>" 912*a78e148bSantirez 913*a78e148bSantirez (<span class="type">size_t</span>) 914*a78e148bSantirez <code class="literal">r-</code> 915*a78e148bSantirez [<code class="option">--enable-tcache</code>] 916*a78e148bSantirez </span></dt><dd><p>Maximum thread-cached size class.</p></dd><dt><span class="term"> 917*a78e148bSantirez 918*a78e148bSantirez "<code class="mallctl">arenas.ntbins</code>" 919*a78e148bSantirez 920*a78e148bSantirez (<span class="type">unsigned</span>) 921*a78e148bSantirez <code class="literal">r-</code> 922*a78e148bSantirez </span></dt><dd><p>Number of tiny bin size classes.</p></dd><dt><span class="term"> 923*a78e148bSantirez 924*a78e148bSantirez "<code class="mallctl">arenas.nqbins</code>" 925*a78e148bSantirez 926*a78e148bSantirez (<span class="type">unsigned</span>) 927*a78e148bSantirez <code class="literal">r-</code> 928*a78e148bSantirez </span></dt><dd><p>Number of quantum-spaced bin size 929*a78e148bSantirez classes.</p></dd><dt><span class="term"> 930*a78e148bSantirez 931*a78e148bSantirez "<code class="mallctl">arenas.ncbins</code>" 932*a78e148bSantirez 933*a78e148bSantirez (<span class="type">unsigned</span>) 934*a78e148bSantirez <code class="literal">r-</code> 935*a78e148bSantirez </span></dt><dd><p>Number of cacheline-spaced bin size 936*a78e148bSantirez classes.</p></dd><dt><span class="term"> 937*a78e148bSantirez 938*a78e148bSantirez "<code class="mallctl">arenas.nsbins</code>" 939*a78e148bSantirez 940*a78e148bSantirez (<span class="type">unsigned</span>) 941*a78e148bSantirez <code class="literal">r-</code> 942*a78e148bSantirez </span></dt><dd><p>Number of subpage-spaced bin size 943*a78e148bSantirez classes.</p></dd><dt><span class="term"> 944*a78e148bSantirez 945*a78e148bSantirez "<code class="mallctl">arenas.nbins</code>" 946*a78e148bSantirez 947*a78e148bSantirez (<span class="type">unsigned</span>) 948*a78e148bSantirez <code class="literal">r-</code> 949*a78e148bSantirez </span></dt><dd><p>Total number of bin size classes.</p></dd><dt><span class="term"> 950*a78e148bSantirez 951*a78e148bSantirez "<code class="mallctl">arenas.nhbins</code>" 952*a78e148bSantirez 953*a78e148bSantirez (<span class="type">unsigned</span>) 954*a78e148bSantirez <code class="literal">r-</code> 955*a78e148bSantirez [<code class="option">--enable-tcache</code>] 956*a78e148bSantirez </span></dt><dd><p>Total number of thread cache bin size 957*a78e148bSantirez classes.</p></dd><dt><a name="arenas.bin.i.size"></a><span class="term"> 958*a78e148bSantirez 959*a78e148bSantirez "<code class="mallctl">arenas.bin.<i>.size</code>" 960*a78e148bSantirez 961*a78e148bSantirez (<span class="type">size_t</span>) 962*a78e148bSantirez <code class="literal">r-</code> 963*a78e148bSantirez </span></dt><dd><p>Maximum size supported by size class.</p></dd><dt><span class="term"> 964*a78e148bSantirez 965*a78e148bSantirez "<code class="mallctl">arenas.bin.<i>.nregs</code>" 966*a78e148bSantirez 967*a78e148bSantirez (<span class="type">uint32_t</span>) 968*a78e148bSantirez <code class="literal">r-</code> 969*a78e148bSantirez </span></dt><dd><p>Number of regions per page run.</p></dd><dt><span class="term"> 970*a78e148bSantirez 971*a78e148bSantirez "<code class="mallctl">arenas.bin.<i>.run_size</code>" 972*a78e148bSantirez 973*a78e148bSantirez (<span class="type">size_t</span>) 974*a78e148bSantirez <code class="literal">r-</code> 975*a78e148bSantirez </span></dt><dd><p>Number of bytes per page run.</p></dd><dt><span class="term"> 976*a78e148bSantirez 977*a78e148bSantirez "<code class="mallctl">arenas.nlruns</code>" 978*a78e148bSantirez 979*a78e148bSantirez (<span class="type">size_t</span>) 980*a78e148bSantirez <code class="literal">r-</code> 981*a78e148bSantirez </span></dt><dd><p>Total number of large size classes.</p></dd><dt><span class="term"> 982*a78e148bSantirez 983*a78e148bSantirez "<code class="mallctl">arenas.lrun.<i>.size</code>" 984*a78e148bSantirez 985*a78e148bSantirez (<span class="type">size_t</span>) 986*a78e148bSantirez <code class="literal">r-</code> 987*a78e148bSantirez </span></dt><dd><p>Maximum size supported by this large size 988*a78e148bSantirez class.</p></dd><dt><span class="term"> 989*a78e148bSantirez 990*a78e148bSantirez "<code class="mallctl">arenas.purge</code>" 991*a78e148bSantirez 992*a78e148bSantirez (<span class="type">unsigned</span>) 993*a78e148bSantirez <code class="literal">-w</code> 994*a78e148bSantirez </span></dt><dd><p>Purge unused dirty pages for the specified arena, or 995*a78e148bSantirez for all arenas if none is specified.</p></dd><dt><a name="prof.active"></a><span class="term"> 996*a78e148bSantirez 997*a78e148bSantirez "<code class="mallctl">prof.active</code>" 998*a78e148bSantirez 999*a78e148bSantirez (<span class="type">bool</span>) 1000*a78e148bSantirez <code class="literal">rw</code> 1001*a78e148bSantirez [<code class="option">--enable-prof</code>] 1002*a78e148bSantirez </span></dt><dd><p>Control whether sampling is currently active. See the 1003*a78e148bSantirez <a class="link" href="#opt.prof_active"> 1004*a78e148bSantirez "<code class="mallctl">opt.prof_active</code>" 1005*a78e148bSantirez </a> 1006*a78e148bSantirez option for additional information. 1007*a78e148bSantirez </p></dd><dt><span class="term"> 1008*a78e148bSantirez 1009*a78e148bSantirez "<code class="mallctl">prof.dump</code>" 1010*a78e148bSantirez 1011*a78e148bSantirez (<span class="type">const char *</span>) 1012*a78e148bSantirez <code class="literal">-w</code> 1013*a78e148bSantirez [<code class="option">--enable-prof</code>] 1014*a78e148bSantirez </span></dt><dd><p>Dump a memory profile to the specified file, or if NULL 1015*a78e148bSantirez is specified, to a file according to the pattern 1016*a78e148bSantirez <code class="filename"><prefix>.<pid>.<seq>.m<mseq>.heap</code>, 1017*a78e148bSantirez where <code class="literal"><prefix></code> is controlled by the 1018*a78e148bSantirez <a class="link" href="#opt.prof_prefix"> 1019*a78e148bSantirez "<code class="mallctl">opt.prof_prefix</code>" 1020*a78e148bSantirez </a> 1021*a78e148bSantirez option.</p></dd><dt><span class="term"> 1022*a78e148bSantirez 1023*a78e148bSantirez "<code class="mallctl">prof.interval</code>" 1024*a78e148bSantirez 1025*a78e148bSantirez (<span class="type">uint64_t</span>) 1026*a78e148bSantirez <code class="literal">r-</code> 1027*a78e148bSantirez [<code class="option">--enable-prof</code>] 1028*a78e148bSantirez </span></dt><dd><p>Average number of bytes allocated between 1029*a78e148bSantirez inverval-based profile dumps. See the 1030*a78e148bSantirez <a class="link" href="#opt.lg_prof_interval"> 1031*a78e148bSantirez "<code class="mallctl">opt.lg_prof_interval</code>" 1032*a78e148bSantirez </a> 1033*a78e148bSantirez option for additional information.</p></dd><dt><a name="stats.cactive"></a><span class="term"> 1034*a78e148bSantirez 1035*a78e148bSantirez "<code class="mallctl">stats.cactive</code>" 1036*a78e148bSantirez 1037*a78e148bSantirez (<span class="type">size_t *</span>) 1038*a78e148bSantirez <code class="literal">r-</code> 1039*a78e148bSantirez [<code class="option">--enable-stats</code>] 1040*a78e148bSantirez </span></dt><dd><p>Pointer to a counter that contains an approximate count 1041*a78e148bSantirez of the current number of bytes in active pages. The estimate may be 1042*a78e148bSantirez high, but never low, because each arena rounds up to the nearest 1043*a78e148bSantirez multiple of the chunk size when computing its contribution to the 1044*a78e148bSantirez counter. Note that the <a class="link" href="#epoch"> 1045*a78e148bSantirez "<code class="mallctl">epoch</code>" 1046*a78e148bSantirez </a> mallctl has no bearing 1047*a78e148bSantirez on this counter. Furthermore, counter consistency is maintained via 1048*a78e148bSantirez atomic operations, so it is necessary to use an atomic operation in 1049*a78e148bSantirez order to guarantee a consistent read when dereferencing the pointer. 1050*a78e148bSantirez </p></dd><dt><a name="stats.allocated"></a><span class="term"> 1051*a78e148bSantirez 1052*a78e148bSantirez "<code class="mallctl">stats.allocated</code>" 1053*a78e148bSantirez 1054*a78e148bSantirez (<span class="type">size_t</span>) 1055*a78e148bSantirez <code class="literal">r-</code> 1056*a78e148bSantirez [<code class="option">--enable-stats</code>] 1057*a78e148bSantirez </span></dt><dd><p>Total number of bytes allocated by the 1058*a78e148bSantirez application.</p></dd><dt><a name="stats.active"></a><span class="term"> 1059*a78e148bSantirez 1060*a78e148bSantirez "<code class="mallctl">stats.active</code>" 1061*a78e148bSantirez 1062*a78e148bSantirez (<span class="type">size_t</span>) 1063*a78e148bSantirez <code class="literal">r-</code> 1064*a78e148bSantirez [<code class="option">--enable-stats</code>] 1065*a78e148bSantirez </span></dt><dd><p>Total number of bytes in active pages allocated by the 1066*a78e148bSantirez application. This is a multiple of the page size, and greater than or 1067*a78e148bSantirez equal to <a class="link" href="#stats.allocated"> 1068*a78e148bSantirez "<code class="mallctl">stats.allocated</code>" 1069*a78e148bSantirez </a>. 1070*a78e148bSantirez </p></dd><dt><span class="term"> 1071*a78e148bSantirez 1072*a78e148bSantirez "<code class="mallctl">stats.mapped</code>" 1073*a78e148bSantirez 1074*a78e148bSantirez (<span class="type">size_t</span>) 1075*a78e148bSantirez <code class="literal">r-</code> 1076*a78e148bSantirez [<code class="option">--enable-stats</code>] 1077*a78e148bSantirez </span></dt><dd><p>Total number of bytes in chunks mapped on behalf of the 1078*a78e148bSantirez application. This is a multiple of the chunk size, and is at least as 1079*a78e148bSantirez large as <a class="link" href="#stats.active"> 1080*a78e148bSantirez "<code class="mallctl">stats.active</code>" 1081*a78e148bSantirez </a>. This 1082*a78e148bSantirez does not include inactive chunks backed by swap files. his does not 1083*a78e148bSantirez include inactive chunks embedded in the DSS.</p></dd><dt><span class="term"> 1084*a78e148bSantirez 1085*a78e148bSantirez "<code class="mallctl">stats.chunks.current</code>" 1086*a78e148bSantirez 1087*a78e148bSantirez (<span class="type">size_t</span>) 1088*a78e148bSantirez <code class="literal">r-</code> 1089*a78e148bSantirez [<code class="option">--enable-stats</code>] 1090*a78e148bSantirez </span></dt><dd><p>Total number of chunks actively mapped on behalf of the 1091*a78e148bSantirez application. This does not include inactive chunks backed by swap 1092*a78e148bSantirez files. This does not include inactive chunks embedded in the DSS. 1093*a78e148bSantirez </p></dd><dt><span class="term"> 1094*a78e148bSantirez 1095*a78e148bSantirez "<code class="mallctl">stats.chunks.total</code>" 1096*a78e148bSantirez 1097*a78e148bSantirez (<span class="type">uint64_t</span>) 1098*a78e148bSantirez <code class="literal">r-</code> 1099*a78e148bSantirez [<code class="option">--enable-stats</code>] 1100*a78e148bSantirez </span></dt><dd><p>Cumulative number of chunks allocated.</p></dd><dt><span class="term"> 1101*a78e148bSantirez 1102*a78e148bSantirez "<code class="mallctl">stats.chunks.high</code>" 1103*a78e148bSantirez 1104*a78e148bSantirez (<span class="type">size_t</span>) 1105*a78e148bSantirez <code class="literal">r-</code> 1106*a78e148bSantirez [<code class="option">--enable-stats</code>] 1107*a78e148bSantirez </span></dt><dd><p>Maximum number of active chunks at any time thus far. 1108*a78e148bSantirez </p></dd><dt><span class="term"> 1109*a78e148bSantirez 1110*a78e148bSantirez "<code class="mallctl">stats.huge.allocated</code>" 1111*a78e148bSantirez 1112*a78e148bSantirez (<span class="type">size_t</span>) 1113*a78e148bSantirez <code class="literal">r-</code> 1114*a78e148bSantirez [<code class="option">--enable-stats</code>] 1115*a78e148bSantirez </span></dt><dd><p>Number of bytes currently allocated by huge objects. 1116*a78e148bSantirez </p></dd><dt><span class="term"> 1117*a78e148bSantirez 1118*a78e148bSantirez "<code class="mallctl">stats.huge.nmalloc</code>" 1119*a78e148bSantirez 1120*a78e148bSantirez (<span class="type">uint64_t</span>) 1121*a78e148bSantirez <code class="literal">r-</code> 1122*a78e148bSantirez [<code class="option">--enable-stats</code>] 1123*a78e148bSantirez </span></dt><dd><p>Cumulative number of huge allocation requests. 1124*a78e148bSantirez </p></dd><dt><span class="term"> 1125*a78e148bSantirez 1126*a78e148bSantirez "<code class="mallctl">stats.huge.ndalloc</code>" 1127*a78e148bSantirez 1128*a78e148bSantirez (<span class="type">uint64_t</span>) 1129*a78e148bSantirez <code class="literal">r-</code> 1130*a78e148bSantirez [<code class="option">--enable-stats</code>] 1131*a78e148bSantirez </span></dt><dd><p>Cumulative number of huge deallocation requests. 1132*a78e148bSantirez </p></dd><dt><span class="term"> 1133*a78e148bSantirez 1134*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.nthreads</code>" 1135*a78e148bSantirez 1136*a78e148bSantirez (<span class="type">unsigned</span>) 1137*a78e148bSantirez <code class="literal">r-</code> 1138*a78e148bSantirez </span></dt><dd><p>Number of threads currently assigned to 1139*a78e148bSantirez arena.</p></dd><dt><span class="term"> 1140*a78e148bSantirez 1141*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.pactive</code>" 1142*a78e148bSantirez 1143*a78e148bSantirez (<span class="type">size_t</span>) 1144*a78e148bSantirez <code class="literal">r-</code> 1145*a78e148bSantirez </span></dt><dd><p>Number of pages in active runs.</p></dd><dt><span class="term"> 1146*a78e148bSantirez 1147*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.pdirty</code>" 1148*a78e148bSantirez 1149*a78e148bSantirez (<span class="type">size_t</span>) 1150*a78e148bSantirez <code class="literal">r-</code> 1151*a78e148bSantirez </span></dt><dd><p>Number of pages within unused runs that are potentially 1152*a78e148bSantirez dirty, and for which <code class="function">madvise</code>(<em class="parameter"><code>...</code></em>, 1153*a78e148bSantirez <em class="parameter"><code><code class="constant">MADV_DONTNEED</code></code></em>) or 1154*a78e148bSantirez similar has not been called.</p></dd><dt><span class="term"> 1155*a78e148bSantirez 1156*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.mapped</code>" 1157*a78e148bSantirez 1158*a78e148bSantirez (<span class="type">size_t</span>) 1159*a78e148bSantirez <code class="literal">r-</code> 1160*a78e148bSantirez [<code class="option">--enable-stats</code>] 1161*a78e148bSantirez </span></dt><dd><p>Number of mapped bytes.</p></dd><dt><span class="term"> 1162*a78e148bSantirez 1163*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.npurge</code>" 1164*a78e148bSantirez 1165*a78e148bSantirez (<span class="type">uint64_t</span>) 1166*a78e148bSantirez <code class="literal">r-</code> 1167*a78e148bSantirez [<code class="option">--enable-stats</code>] 1168*a78e148bSantirez </span></dt><dd><p>Number of dirty page purge sweeps performed. 1169*a78e148bSantirez </p></dd><dt><span class="term"> 1170*a78e148bSantirez 1171*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.nmadvise</code>" 1172*a78e148bSantirez 1173*a78e148bSantirez (<span class="type">uint64_t</span>) 1174*a78e148bSantirez <code class="literal">r-</code> 1175*a78e148bSantirez [<code class="option">--enable-stats</code>] 1176*a78e148bSantirez </span></dt><dd><p>Number of <code class="function">madvise</code>(<em class="parameter"><code>...</code></em>, 1177*a78e148bSantirez <em class="parameter"><code><code class="constant">MADV_DONTNEED</code></code></em>) or 1178*a78e148bSantirez similar calls made to purge dirty pages.</p></dd><dt><span class="term"> 1179*a78e148bSantirez 1180*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.npurged</code>" 1181*a78e148bSantirez 1182*a78e148bSantirez (<span class="type">uint64_t</span>) 1183*a78e148bSantirez <code class="literal">r-</code> 1184*a78e148bSantirez [<code class="option">--enable-stats</code>] 1185*a78e148bSantirez </span></dt><dd><p>Number of pages purged.</p></dd><dt><span class="term"> 1186*a78e148bSantirez 1187*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.small.allocated</code>" 1188*a78e148bSantirez 1189*a78e148bSantirez (<span class="type">size_t</span>) 1190*a78e148bSantirez <code class="literal">r-</code> 1191*a78e148bSantirez [<code class="option">--enable-stats</code>] 1192*a78e148bSantirez </span></dt><dd><p>Number of bytes currently allocated by small objects. 1193*a78e148bSantirez </p></dd><dt><span class="term"> 1194*a78e148bSantirez 1195*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.small.nmalloc</code>" 1196*a78e148bSantirez 1197*a78e148bSantirez (<span class="type">uint64_t</span>) 1198*a78e148bSantirez <code class="literal">r-</code> 1199*a78e148bSantirez [<code class="option">--enable-stats</code>] 1200*a78e148bSantirez </span></dt><dd><p>Cumulative number of allocation requests served by 1201*a78e148bSantirez small bins.</p></dd><dt><span class="term"> 1202*a78e148bSantirez 1203*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.small.ndalloc</code>" 1204*a78e148bSantirez 1205*a78e148bSantirez (<span class="type">uint64_t</span>) 1206*a78e148bSantirez <code class="literal">r-</code> 1207*a78e148bSantirez [<code class="option">--enable-stats</code>] 1208*a78e148bSantirez </span></dt><dd><p>Cumulative number of small objects returned to bins. 1209*a78e148bSantirez </p></dd><dt><span class="term"> 1210*a78e148bSantirez 1211*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.small.nrequests</code>" 1212*a78e148bSantirez 1213*a78e148bSantirez (<span class="type">uint64_t</span>) 1214*a78e148bSantirez <code class="literal">r-</code> 1215*a78e148bSantirez [<code class="option">--enable-stats</code>] 1216*a78e148bSantirez </span></dt><dd><p>Cumulative number of small allocation requests. 1217*a78e148bSantirez </p></dd><dt><span class="term"> 1218*a78e148bSantirez 1219*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.large.allocated</code>" 1220*a78e148bSantirez 1221*a78e148bSantirez (<span class="type">size_t</span>) 1222*a78e148bSantirez <code class="literal">r-</code> 1223*a78e148bSantirez [<code class="option">--enable-stats</code>] 1224*a78e148bSantirez </span></dt><dd><p>Number of bytes currently allocated by large objects. 1225*a78e148bSantirez </p></dd><dt><span class="term"> 1226*a78e148bSantirez 1227*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.large.nmalloc</code>" 1228*a78e148bSantirez 1229*a78e148bSantirez (<span class="type">uint64_t</span>) 1230*a78e148bSantirez <code class="literal">r-</code> 1231*a78e148bSantirez [<code class="option">--enable-stats</code>] 1232*a78e148bSantirez </span></dt><dd><p>Cumulative number of large allocation requests served 1233*a78e148bSantirez directly by the arena.</p></dd><dt><span class="term"> 1234*a78e148bSantirez 1235*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.large.ndalloc</code>" 1236*a78e148bSantirez 1237*a78e148bSantirez (<span class="type">uint64_t</span>) 1238*a78e148bSantirez <code class="literal">r-</code> 1239*a78e148bSantirez [<code class="option">--enable-stats</code>] 1240*a78e148bSantirez </span></dt><dd><p>Cumulative number of large deallocation requests served 1241*a78e148bSantirez directly by the arena.</p></dd><dt><span class="term"> 1242*a78e148bSantirez 1243*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.large.nrequests</code>" 1244*a78e148bSantirez 1245*a78e148bSantirez (<span class="type">uint64_t</span>) 1246*a78e148bSantirez <code class="literal">r-</code> 1247*a78e148bSantirez [<code class="option">--enable-stats</code>] 1248*a78e148bSantirez </span></dt><dd><p>Cumulative number of large allocation requests. 1249*a78e148bSantirez </p></dd><dt><span class="term"> 1250*a78e148bSantirez 1251*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.allocated</code>" 1252*a78e148bSantirez 1253*a78e148bSantirez (<span class="type">size_t</span>) 1254*a78e148bSantirez <code class="literal">r-</code> 1255*a78e148bSantirez [<code class="option">--enable-stats</code>] 1256*a78e148bSantirez </span></dt><dd><p>Current number of bytes allocated by 1257*a78e148bSantirez bin.</p></dd><dt><span class="term"> 1258*a78e148bSantirez 1259*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.nmalloc</code>" 1260*a78e148bSantirez 1261*a78e148bSantirez (<span class="type">uint64_t</span>) 1262*a78e148bSantirez <code class="literal">r-</code> 1263*a78e148bSantirez [<code class="option">--enable-stats</code>] 1264*a78e148bSantirez </span></dt><dd><p>Cumulative number of allocations served by bin. 1265*a78e148bSantirez </p></dd><dt><span class="term"> 1266*a78e148bSantirez 1267*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.ndalloc</code>" 1268*a78e148bSantirez 1269*a78e148bSantirez (<span class="type">uint64_t</span>) 1270*a78e148bSantirez <code class="literal">r-</code> 1271*a78e148bSantirez [<code class="option">--enable-stats</code>] 1272*a78e148bSantirez </span></dt><dd><p>Cumulative number of allocations returned to bin. 1273*a78e148bSantirez </p></dd><dt><span class="term"> 1274*a78e148bSantirez 1275*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.nrequests</code>" 1276*a78e148bSantirez 1277*a78e148bSantirez (<span class="type">uint64_t</span>) 1278*a78e148bSantirez <code class="literal">r-</code> 1279*a78e148bSantirez [<code class="option">--enable-stats</code>] 1280*a78e148bSantirez </span></dt><dd><p>Cumulative number of allocation 1281*a78e148bSantirez requests.</p></dd><dt><span class="term"> 1282*a78e148bSantirez 1283*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.nfills</code>" 1284*a78e148bSantirez 1285*a78e148bSantirez (<span class="type">uint64_t</span>) 1286*a78e148bSantirez <code class="literal">r-</code> 1287*a78e148bSantirez [<code class="option">--enable-stats</code> <code class="option">--enable-tcache</code>] 1288*a78e148bSantirez </span></dt><dd><p>Cumulative number of tcache fills.</p></dd><dt><span class="term"> 1289*a78e148bSantirez 1290*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.nflushes</code>" 1291*a78e148bSantirez 1292*a78e148bSantirez (<span class="type">uint64_t</span>) 1293*a78e148bSantirez <code class="literal">r-</code> 1294*a78e148bSantirez [<code class="option">--enable-stats</code> <code class="option">--enable-tcache</code>] 1295*a78e148bSantirez </span></dt><dd><p>Cumulative number of tcache flushes.</p></dd><dt><span class="term"> 1296*a78e148bSantirez 1297*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.nruns</code>" 1298*a78e148bSantirez 1299*a78e148bSantirez (<span class="type">uint64_t</span>) 1300*a78e148bSantirez <code class="literal">r-</code> 1301*a78e148bSantirez [<code class="option">--enable-stats</code>] 1302*a78e148bSantirez </span></dt><dd><p>Cumulative number of runs created.</p></dd><dt><span class="term"> 1303*a78e148bSantirez 1304*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.nreruns</code>" 1305*a78e148bSantirez 1306*a78e148bSantirez (<span class="type">uint64_t</span>) 1307*a78e148bSantirez <code class="literal">r-</code> 1308*a78e148bSantirez [<code class="option">--enable-stats</code>] 1309*a78e148bSantirez </span></dt><dd><p>Cumulative number of times the current run from which 1310*a78e148bSantirez to allocate changed.</p></dd><dt><span class="term"> 1311*a78e148bSantirez 1312*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.highruns</code>" 1313*a78e148bSantirez 1314*a78e148bSantirez (<span class="type">size_t</span>) 1315*a78e148bSantirez <code class="literal">r-</code> 1316*a78e148bSantirez [<code class="option">--enable-stats</code>] 1317*a78e148bSantirez </span></dt><dd><p>Maximum number of runs at any time thus far. 1318*a78e148bSantirez </p></dd><dt><span class="term"> 1319*a78e148bSantirez 1320*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.bins.<j>.curruns</code>" 1321*a78e148bSantirez 1322*a78e148bSantirez (<span class="type">size_t</span>) 1323*a78e148bSantirez <code class="literal">r-</code> 1324*a78e148bSantirez [<code class="option">--enable-stats</code>] 1325*a78e148bSantirez </span></dt><dd><p>Current number of runs.</p></dd><dt><span class="term"> 1326*a78e148bSantirez 1327*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.lruns.<j>.nmalloc</code>" 1328*a78e148bSantirez 1329*a78e148bSantirez (<span class="type">uint64_t</span>) 1330*a78e148bSantirez <code class="literal">r-</code> 1331*a78e148bSantirez [<code class="option">--enable-stats</code>] 1332*a78e148bSantirez </span></dt><dd><p>Cumulative number of allocation requests for this size 1333*a78e148bSantirez class served directly by the arena.</p></dd><dt><span class="term"> 1334*a78e148bSantirez 1335*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.lruns.<j>.ndalloc</code>" 1336*a78e148bSantirez 1337*a78e148bSantirez (<span class="type">uint64_t</span>) 1338*a78e148bSantirez <code class="literal">r-</code> 1339*a78e148bSantirez [<code class="option">--enable-stats</code>] 1340*a78e148bSantirez </span></dt><dd><p>Cumulative number of deallocation requests for this 1341*a78e148bSantirez size class served directly by the arena.</p></dd><dt><span class="term"> 1342*a78e148bSantirez 1343*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.lruns.<j>.nrequests</code>" 1344*a78e148bSantirez 1345*a78e148bSantirez (<span class="type">uint64_t</span>) 1346*a78e148bSantirez <code class="literal">r-</code> 1347*a78e148bSantirez [<code class="option">--enable-stats</code>] 1348*a78e148bSantirez </span></dt><dd><p>Cumulative number of allocation requests for this size 1349*a78e148bSantirez class.</p></dd><dt><span class="term"> 1350*a78e148bSantirez 1351*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.lruns.<j>.highruns</code>" 1352*a78e148bSantirez 1353*a78e148bSantirez (<span class="type">size_t</span>) 1354*a78e148bSantirez <code class="literal">r-</code> 1355*a78e148bSantirez [<code class="option">--enable-stats</code>] 1356*a78e148bSantirez </span></dt><dd><p>Maximum number of runs at any time thus far for this 1357*a78e148bSantirez size class.</p></dd><dt><span class="term"> 1358*a78e148bSantirez 1359*a78e148bSantirez "<code class="mallctl">stats.arenas.<i>.lruns.<j>.curruns</code>" 1360*a78e148bSantirez 1361*a78e148bSantirez (<span class="type">size_t</span>) 1362*a78e148bSantirez <code class="literal">r-</code> 1363*a78e148bSantirez [<code class="option">--enable-stats</code>] 1364*a78e148bSantirez </span></dt><dd><p>Current number of runs for this size class. 1365*a78e148bSantirez </p></dd><dt><span class="term"> 1366*a78e148bSantirez 1367*a78e148bSantirez "<code class="mallctl">swap.avail</code>" 1368*a78e148bSantirez 1369*a78e148bSantirez (<span class="type">size_t</span>) 1370*a78e148bSantirez <code class="literal">r-</code> 1371*a78e148bSantirez [<code class="option">--enable-stats --enable-swap</code>] 1372*a78e148bSantirez </span></dt><dd><p>Number of swap file bytes that are currently not 1373*a78e148bSantirez associated with any chunk (i.e. mapped, but otherwise completely 1374*a78e148bSantirez unmanaged).</p></dd><dt><a name="swap.prezeroed"></a><span class="term"> 1375*a78e148bSantirez 1376*a78e148bSantirez "<code class="mallctl">swap.prezeroed</code>" 1377*a78e148bSantirez 1378*a78e148bSantirez (<span class="type">bool</span>) 1379*a78e148bSantirez <code class="literal">rw</code> 1380*a78e148bSantirez [<code class="option">--enable-swap</code>] 1381*a78e148bSantirez </span></dt><dd><p>If true, the allocator assumes that the swap file(s) 1382*a78e148bSantirez contain nothing but nil bytes. If this assumption is violated, 1383*a78e148bSantirez allocator behavior is undefined. This value becomes read-only after 1384*a78e148bSantirez <a class="link" href="#swap.fds"> 1385*a78e148bSantirez "<code class="mallctl">swap.fds</code>" 1386*a78e148bSantirez </a> is 1387*a78e148bSantirez successfully written to.</p></dd><dt><span class="term"> 1388*a78e148bSantirez 1389*a78e148bSantirez "<code class="mallctl">swap.nfds</code>" 1390*a78e148bSantirez 1391*a78e148bSantirez (<span class="type">size_t</span>) 1392*a78e148bSantirez <code class="literal">r-</code> 1393*a78e148bSantirez [<code class="option">--enable-swap</code>] 1394*a78e148bSantirez </span></dt><dd><p>Number of file descriptors in use for swap. 1395*a78e148bSantirez </p></dd><dt><a name="swap.fds"></a><span class="term"> 1396*a78e148bSantirez 1397*a78e148bSantirez "<code class="mallctl">swap.fds</code>" 1398*a78e148bSantirez 1399*a78e148bSantirez (<span class="type">int *</span>) 1400*a78e148bSantirez <code class="literal">r-</code> 1401*a78e148bSantirez [<code class="option">--enable-swap</code>] 1402*a78e148bSantirez </span></dt><dd><p>When written to, the files associated with the 1403*a78e148bSantirez specified file descriptors are contiguously mapped via 1404*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span>. The resulting virtual memory 1405*a78e148bSantirez region is preferred over anonymous 1406*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span> and 1407*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span> memory. Note that if a file's 1408*a78e148bSantirez size is not a multiple of the page size, it is automatically truncated 1409*a78e148bSantirez to the nearest page size multiple. See the 1410*a78e148bSantirez <a class="link" href="#swap.prezeroed"> 1411*a78e148bSantirez "<code class="mallctl">swap.prezeroed</code>" 1412*a78e148bSantirez </a> 1413*a78e148bSantirez mallctl for specifying that the files are pre-zeroed.</p></dd></dl></div></div><div class="refsect1" title="DEBUGGING MALLOC PROBLEMS"><a name="debugging_malloc_problems"></a><h2>DEBUGGING MALLOC PROBLEMS</h2><p>When debugging, it is a good idea to configure/build jemalloc with 1414*a78e148bSantirez the <code class="option">--enable-debug</code> and <code class="option">--enable-fill</code> 1415*a78e148bSantirez options, and recompile the program with suitable options and symbols for 1416*a78e148bSantirez debugger support. When so configured, jemalloc incorporates a wide variety 1417*a78e148bSantirez of run-time assertions that catch application errors such as double-free, 1418*a78e148bSantirez write-after-free, etc.</p><p>Programs often accidentally depend on “uninitialized” 1419*a78e148bSantirez memory actually being filled with zero bytes. Junk filling 1420*a78e148bSantirez (see the <a class="link" href="#opt.junk"> 1421*a78e148bSantirez "<code class="mallctl">opt.junk</code>" 1422*a78e148bSantirez </a> 1423*a78e148bSantirez option) tends to expose such bugs in the form of obviously incorrect 1424*a78e148bSantirez results and/or coredumps. Conversely, zero 1425*a78e148bSantirez filling (see the <a class="link" href="#opt.zero"> 1426*a78e148bSantirez "<code class="mallctl">opt.zero</code>" 1427*a78e148bSantirez </a> option) eliminates 1428*a78e148bSantirez the symptoms of such bugs. Between these two options, it is usually 1429*a78e148bSantirez possible to quickly detect, diagnose, and eliminate such bugs.</p><p>This implementation does not provide much detail about the problems 1430*a78e148bSantirez it detects, because the performance impact for storing such information 1431*a78e148bSantirez would be prohibitive. There are a number of allocator implementations 1432*a78e148bSantirez available on the Internet which focus on detecting and pinpointing problems 1433*a78e148bSantirez by trading performance for extra sanity checks and detailed 1434*a78e148bSantirez diagnostics.</p></div><div class="refsect1" title="DIAGNOSTIC MESSAGES"><a name="diagnostic_messages"></a><h2>DIAGNOSTIC MESSAGES</h2><p>If any of the memory allocation/deallocation functions detect an 1435*a78e148bSantirez error or warning condition, a message will be printed to file descriptor 1436*a78e148bSantirez <code class="constant">STDERR_FILENO</code>. Errors will result in the process 1437*a78e148bSantirez dumping core. If the <a class="link" href="#opt.abort"> 1438*a78e148bSantirez "<code class="mallctl">opt.abort</code>" 1439*a78e148bSantirez </a> option is set, most 1440*a78e148bSantirez warnings are treated as errors.</p><p>The <code class="varname">malloc_message</code> variable allows the programmer 1441*a78e148bSantirez to override the function which emits the text strings forming the errors 1442*a78e148bSantirez and warnings if for some reason the <code class="constant">STDERR_FILENO</code> file 1443*a78e148bSantirez descriptor is not suitable for this. 1444*a78e148bSantirez <code class="function">malloc_message</code>(<em class="parameter"><code></code></em>) takes the 1445*a78e148bSantirez <em class="parameter"><code>cbopaque</code></em> pointer argument that is 1446*a78e148bSantirez <code class="constant">NULL</code> unless overridden by the arguments in a call to 1447*a78e148bSantirez <code class="function">malloc_stats_print</code>(<em class="parameter"><code></code></em>), followed by a string 1448*a78e148bSantirez pointer. Please note that doing anything which tries to allocate memory in 1449*a78e148bSantirez this function is likely to result in a crash or deadlock.</p><p>All messages are prefixed by 1450*a78e148bSantirez “<code class="computeroutput"><jemalloc>: </code>”.</p></div><div class="refsect1" title="RETURN VALUES"><a name="return_values"></a><h2>RETURN VALUES</h2><div class="refsect2" title="Standard API"><a name="id2844722"></a><h3>Standard API</h3><p>The <code class="function">malloc</code>(<em class="parameter"><code></code></em>) and 1451*a78e148bSantirez <code class="function">calloc</code>(<em class="parameter"><code></code></em>) functions return a pointer to the 1452*a78e148bSantirez allocated memory if successful; otherwise a <code class="constant">NULL</code> 1453*a78e148bSantirez pointer is returned and <code class="varname">errno</code> is set to 1454*a78e148bSantirez <span class="errorname">ENOMEM</span>.</p><p>The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function 1455*a78e148bSantirez returns the value 0 if successful; otherwise it returns an error value. 1456*a78e148bSantirez The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function will fail 1457*a78e148bSantirez if: 1458*a78e148bSantirez </p><div class="variablelist"><dl><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p>The <em class="parameter"><code>alignment</code></em> parameter is 1459*a78e148bSantirez not a power of 2 at least as large as 1460*a78e148bSantirez <code class="code">sizeof(<span class="type">void *</span>)</code>. 1461*a78e148bSantirez </p></dd><dt><span class="term"><span class="errorname">ENOMEM</span></span></dt><dd><p>Memory allocation error.</p></dd></dl></div><p> 1462*a78e148bSantirez </p><p>The <code class="function">realloc</code>(<em class="parameter"><code></code></em>) function returns a 1463*a78e148bSantirez pointer, possibly identical to <em class="parameter"><code>ptr</code></em>, to the 1464*a78e148bSantirez allocated memory if successful; otherwise a <code class="constant">NULL</code> 1465*a78e148bSantirez pointer is returned, and <code class="varname">errno</code> is set to 1466*a78e148bSantirez <span class="errorname">ENOMEM</span> if the error was the result of an 1467*a78e148bSantirez allocation failure. The <code class="function">realloc</code>(<em class="parameter"><code></code></em>) 1468*a78e148bSantirez function always leaves the original buffer intact when an error occurs. 1469*a78e148bSantirez </p><p>The <code class="function">free</code>(<em class="parameter"><code></code></em>) function returns no 1470*a78e148bSantirez value.</p></div><div class="refsect2" title="Non-standard API"><a name="id2844875"></a><h3>Non-standard API</h3><p>The <code class="function">malloc_usable_size</code>(<em class="parameter"><code></code></em>) function 1471*a78e148bSantirez returns the usable size of the allocation pointed to by 1472*a78e148bSantirez <em class="parameter"><code>ptr</code></em>. </p><p>The <code class="function">mallctl</code>(<em class="parameter"><code></code></em>), 1473*a78e148bSantirez <code class="function">mallctlnametomib</code>(<em class="parameter"><code></code></em>), and 1474*a78e148bSantirez <code class="function">mallctlbymib</code>(<em class="parameter"><code></code></em>) functions return 0 on 1475*a78e148bSantirez success; otherwise they return an error value. The functions will fail 1476*a78e148bSantirez if: 1477*a78e148bSantirez </p><div class="variablelist"><dl><dt><span class="term"><span class="errorname">EINVAL</span></span></dt><dd><p><em class="parameter"><code>newp</code></em> is not 1478*a78e148bSantirez <code class="constant">NULL</code>, and <em class="parameter"><code>newlen</code></em> is too 1479*a78e148bSantirez large or too small. Alternatively, <em class="parameter"><code>*oldlenp</code></em> 1480*a78e148bSantirez is too large or too small; in this case as much data as possible 1481*a78e148bSantirez are read despite the error.</p></dd><dt><span class="term"><span class="errorname">ENOMEM</span></span></dt><dd><p><em class="parameter"><code>*oldlenp</code></em> is too short to 1482*a78e148bSantirez hold the requested value.</p></dd><dt><span class="term"><span class="errorname">ENOENT</span></span></dt><dd><p><em class="parameter"><code>name</code></em> or 1483*a78e148bSantirez <em class="parameter"><code>mib</code></em> specifies an unknown/invalid 1484*a78e148bSantirez value.</p></dd><dt><span class="term"><span class="errorname">EPERM</span></span></dt><dd><p>Attempt to read or write void value, or attempt to 1485*a78e148bSantirez write read-only value.</p></dd><dt><span class="term"><span class="errorname">EAGAIN</span></span></dt><dd><p>A memory allocation failure 1486*a78e148bSantirez occurred.</p></dd><dt><span class="term"><span class="errorname">EFAULT</span></span></dt><dd><p>An interface with side effects failed in some way 1487*a78e148bSantirez not directly related to <code class="function">mallctl*</code>(<em class="parameter"><code></code></em>) 1488*a78e148bSantirez read/write processing.</p></dd></dl></div><p> 1489*a78e148bSantirez </p></div><div class="refsect2" title="Experimental API"><a name="id2845053"></a><h3>Experimental API</h3><p>The <code class="function">allocm</code>(<em class="parameter"><code></code></em>), 1490*a78e148bSantirez <code class="function">rallocm</code>(<em class="parameter"><code></code></em>), 1491*a78e148bSantirez <code class="function">sallocm</code>(<em class="parameter"><code></code></em>), and 1492*a78e148bSantirez <code class="function">dallocm</code>(<em class="parameter"><code></code></em>) functions return 1493*a78e148bSantirez <code class="constant">ALLOCM_SUCCESS</code> on success; otherwise they return an 1494*a78e148bSantirez error value. The <code class="function">allocm</code>(<em class="parameter"><code></code></em>) and 1495*a78e148bSantirez <code class="function">rallocm</code>(<em class="parameter"><code></code></em>) functions will fail if: 1496*a78e148bSantirez </p><div class="variablelist"><dl><dt><span class="term"><span class="errorname">ALLOCM_ERR_OOM</span></span></dt><dd><p>Out of memory. Insufficient contiguous memory was 1497*a78e148bSantirez available to service the allocation request. The 1498*a78e148bSantirez <code class="function">allocm</code>(<em class="parameter"><code></code></em>) function additionally sets 1499*a78e148bSantirez <em class="parameter"><code>*ptr</code></em> to <code class="constant">NULL</code>, whereas 1500*a78e148bSantirez the <code class="function">rallocm</code>(<em class="parameter"><code></code></em>) function leaves 1501*a78e148bSantirez <code class="constant">*ptr</code> unmodified.</p></dd></dl></div><p> 1502*a78e148bSantirez The <code class="function">rallocm</code>(<em class="parameter"><code></code></em>) function will also 1503*a78e148bSantirez fail if: 1504*a78e148bSantirez </p><div class="variablelist"><dl><dt><span class="term"><span class="errorname">ALLOCM_ERR_NOT_MOVED</span></span></dt><dd><p><code class="constant">ALLOCM_NO_MOVE</code> was specified, 1505*a78e148bSantirez but the reallocation request could not be serviced without moving 1506*a78e148bSantirez the object.</p></dd></dl></div><p> 1507*a78e148bSantirez </p></div></div><div class="refsect1" title="ENVIRONMENT"><a name="environment"></a><h2>ENVIRONMENT</h2><p>The following environment variable affects the execution of the 1508*a78e148bSantirez allocation functions: 1509*a78e148bSantirez </p><div class="variablelist"><dl><dt><span class="term"><code class="envar">MALLOC_CONF</code></span></dt><dd><p>If the environment variable 1510*a78e148bSantirez <code class="envar">MALLOC_CONF</code> is set, the characters it contains 1511*a78e148bSantirez will be interpreted as options.</p></dd></dl></div><p> 1512*a78e148bSantirez </p></div><div class="refsect1" title="EXAMPLES"><a name="examples"></a><h2>EXAMPLES</h2><p>To dump core whenever a problem occurs: 1513*a78e148bSantirez </p><pre class="screen">ln -s 'abort:true' /etc/malloc.conf</pre><p> 1514*a78e148bSantirez </p><p>To specify in the source a chunk size that is 16 MiB: 1515*a78e148bSantirez </p><pre class="programlisting"> 1516*a78e148bSantirezmalloc_conf = "lg_chunk:24";</pre></div><div class="refsect1" title="SEE ALSO"><a name="see_also"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">madvise</span>(2)</span>, 1517*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">mmap</span>(2)</span>, 1518*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">sbrk</span>(2)</span>, 1519*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">alloca</span>(3)</span>, 1520*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">atexit</span>(3)</span>, 1521*a78e148bSantirez <span class="citerefentry"><span class="refentrytitle">getpagesize</span>(3)</span></p></div><div class="refsect1" title="STANDARDS"><a name="standards"></a><h2>STANDARDS</h2><p>The <code class="function">malloc</code>(<em class="parameter"><code></code></em>), 1522*a78e148bSantirez <code class="function">calloc</code>(<em class="parameter"><code></code></em>), 1523*a78e148bSantirez <code class="function">realloc</code>(<em class="parameter"><code></code></em>), and 1524*a78e148bSantirez <code class="function">free</code>(<em class="parameter"><code></code></em>) functions conform to ISO/IEC 1525*a78e148bSantirez 9899:1990 (“ISO C90”).</p><p>The <code class="function">posix_memalign</code>(<em class="parameter"><code></code></em>) function conforms 1526*a78e148bSantirez to IEEE Std 1003.1-2001 (“POSIX.1”).</p></div></div></body></html> 1527