3 .\" Author: Jason Evans
4 .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
6 .\" Manual: User Manual
7 .\" Source: jemalloc 5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4
10 .TH "JEMALLOC" "3" "05/08/2018" "jemalloc 5.1.0-0-g61efbda7098d" "User Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 jemalloc \- general purpose memory allocation functions
34 This manual describes jemalloc 5\&.1\&.0\-0\-g61efbda7098de6fe64c362d309824864308c36d4\&. More information can be found at the
35 \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&.
37 The following configuration options are enabled in libc\*(Aqs built\-in jemalloc:
38 \fB\-\-enable\-fill\fR,
39 \fB\-\-enable\-lazy\-lock\fR,
40 \fB\-\-enable\-stats\fR,
41 \fB\-\-enable\-utrace\fR,
42 \fB\-\-enable\-xmalloc\fR, and
43 \fB\-\-with\-malloc\-conf=abort_conf:false\fR\&. Additionally,
44 \fB\-\-enable\-debug\fR
45 is enabled in development versions of FreeBSD (controlled by the
46 \fBMALLOC_PRODUCTION\fR
53 #include <malloc_np\&.h>
57 .HP \w'void\ *malloc('u
58 .BI "void *malloc(size_t\ " "size" ");"
59 .HP \w'void\ *calloc('u
60 .BI "void *calloc(size_t\ " "number" ", size_t\ " "size" ");"
61 .HP \w'int\ posix_memalign('u
62 .BI "int posix_memalign(void\ **" "ptr" ", size_t\ " "alignment" ", size_t\ " "size" ");"
63 .HP \w'void\ *aligned_alloc('u
64 .BI "void *aligned_alloc(size_t\ " "alignment" ", size_t\ " "size" ");"
65 .HP \w'void\ *realloc('u
66 .BI "void *realloc(void\ *" "ptr" ", size_t\ " "size" ");"
68 .BI "void free(void\ *" "ptr" ");"
69 .SS "Non\-standard API"
70 .HP \w'void\ *mallocx('u
71 .BI "void *mallocx(size_t\ " "size" ", int\ " "flags" ");"
72 .HP \w'void\ *rallocx('u
73 .BI "void *rallocx(void\ *" "ptr" ", size_t\ " "size" ", int\ " "flags" ");"
74 .HP \w'size_t\ xallocx('u
75 .BI "size_t xallocx(void\ *" "ptr" ", size_t\ " "size" ", size_t\ " "extra" ", int\ " "flags" ");"
76 .HP \w'size_t\ sallocx('u
77 .BI "size_t sallocx(void\ *" "ptr" ", int\ " "flags" ");"
78 .HP \w'void\ dallocx('u
79 .BI "void dallocx(void\ *" "ptr" ", int\ " "flags" ");"
80 .HP \w'void\ sdallocx('u
81 .BI "void sdallocx(void\ *" "ptr" ", size_t\ " "size" ", int\ " "flags" ");"
82 .HP \w'size_t\ nallocx('u
83 .BI "size_t nallocx(size_t\ " "size" ", int\ " "flags" ");"
84 .HP \w'int\ mallctl('u
85 .BI "int mallctl(const\ char\ *" "name" ", void\ *" "oldp" ", size_t\ *" "oldlenp" ", void\ *" "newp" ", size_t\ " "newlen" ");"
86 .HP \w'int\ mallctlnametomib('u
87 .BI "int mallctlnametomib(const\ char\ *" "name" ", size_t\ *" "mibp" ", size_t\ *" "miblenp" ");"
88 .HP \w'int\ mallctlbymib('u
89 .BI "int mallctlbymib(const\ size_t\ *" "mib" ", size_t\ " "miblen" ", void\ *" "oldp" ", size_t\ *" "oldlenp" ", void\ *" "newp" ", size_t\ " "newlen" ");"
90 .HP \w'void\ malloc_stats_print('u
91 .BI "void malloc_stats_print(void\ " "(*write_cb)" "\ (void\ *,\ const\ char\ *), void\ *" "cbopaque" ", const\ char\ *" "opts" ");"
92 .HP \w'size_t\ malloc_usable_size('u
93 .BI "size_t malloc_usable_size(const\ void\ *" "ptr" ");"
94 .HP \w'void\ (*malloc_message)('u
95 .BI "void (*malloc_message)(void\ *" "cbopaque" ", const\ char\ *" "s" ");"
97 const char *\fImalloc_conf\fR;
105 bytes of uninitialized memory\&. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object\&.
109 function allocates space for
113 bytes in length\&. The result is identical to calling
118 \fIsize\fR, with the exception that the allocated memory is explicitly initialized to zero bytes\&.
124 bytes of memory such that the allocation\*(Aqs base address is a multiple of
125 \fIalignment\fR, and returns the allocation in the value pointed to by
126 \fIptr\fR\&. The requested
128 must be a power of 2 at least as large as
129 sizeof(\fBvoid *\fR)\&.
135 bytes of memory such that the allocation\*(Aqs base address is a multiple of
136 \fIalignment\fR\&. The requested
138 must be a power of 2\&. Behavior is undefined if
140 is not an integral multiple of
145 function changes the size of the previously allocated memory referenced by
149 bytes\&. The contents of the memory are unchanged up to the lesser of the new and old sizes\&. If the new size is larger, the contents of the newly allocated portion of the memory are undefined\&. Upon success, the memory referenced by
151 is freed and a pointer to the newly allocated memory is returned\&. Note that
153 may move the memory allocation, resulting in a different return value than
159 function behaves identically to
161 for the specified size\&.
165 function causes the allocated memory referenced by
167 to be made available for future allocations\&. If
170 \fBNULL\fR, no action occurs\&.
171 .SS "Non\-standard API"
183 argument that can be used to specify options\&. The functions only check the options that are contextually relevant\&. Use bitwise or (|) operations to specify one or more of the following:
185 \fBMALLOCX_LG_ALIGN(\fR\fB\fIla\fR\fR\fB) \fR
187 Align the memory allocation to start at an address that is a multiple of
188 (1 << \fIla\fR)\&. This macro does not validate that
190 is within the valid range\&.
193 \fBMALLOCX_ALIGN(\fR\fB\fIa\fR\fR\fB) \fR
195 Align the memory allocation to start at an address that is a multiple of
198 is a power of two\&. This macro does not validate that
205 Initialize newly allocated memory to contain zero bytes\&. In the growing reallocation case, the real size prior to reallocation defines the boundary between untouched bytes and those that are initialized to contain zero bytes\&. If this macro is absent, newly allocated memory is uninitialized\&.
208 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB) \fR
210 Use the thread\-specific cache (tcache) specified by the identifier
211 \fItc\fR, which must have been acquired via the
213 mallctl\&. This macro does not validate that
215 specifies a valid identifier\&.
218 \fBMALLOCX_TCACHE_NONE\fR
220 Do not use a thread\-specific cache (tcache)\&. Unless
221 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR
223 \fBMALLOCX_TCACHE_NONE\fR
224 is specified, an automatically managed tcache will be used under many circumstances\&. This macro cannot be used in the same
227 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR\&.
230 \fBMALLOCX_ARENA(\fR\fB\fIa\fR\fR\fB) \fR
232 Use the arena specified by the index
233 \fIa\fR\&. This macro has no effect for regions that were allocated via an arena other than the one specified\&. This macro does not validate that
235 specifies an arena index in the valid range\&.
240 function allocates at least
242 bytes of memory, and returns a pointer to the base address of the allocation\&. Behavior is undefined if
249 function resizes the allocation at
253 bytes, and returns a pointer to the base address of the resulting allocation, which may or may not have moved from its original location\&. Behavior is undefined if
260 function resizes the allocation at
262 in place to be at least
264 bytes, and returns the real size of the allocation\&. If
266 is non\-zero, an attempt is made to resize the allocation to be at least
267 (\fIsize\fR + \fIextra\fR)
268 bytes, though inability to allocate the extra byte(s) will not by itself result in failure to resize\&. Behavior is undefined if
272 (\fIsize\fR + \fIextra\fR > \fBSIZE_T_MAX\fR)\&.
276 function returns the real size of the allocation at
281 function causes the memory referenced by
283 to be made available for future allocations\&.
287 function is an extension of
291 parameter to allow the caller to pass in the allocation size as an optimization\&. The minimum valid input size is the original requested size of the allocation, and the maximum valid input size is the corresponding value returned by
298 function allocates no memory, but it performs the same size computation as the
300 function, and returns the real size of the allocation that would result from the equivalent
304 if the inputs exceed the maximum supported size class and/or alignment\&. Behavior is undefined if
311 function provides a general interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions\&. The period\-separated
313 argument specifies a location in a tree\-structured namespace; see the
315 section for documentation on the tree contents\&. To read a value, pass a pointer via
317 to adequate space to contain the value, and a pointer to its length via
318 \fIoldlenp\fR; otherwise pass
321 \fBNULL\fR\&. Similarly, to write a value, pass a pointer to the value via
322 \fInewp\fR, and its length via
323 \fInewlen\fR; otherwise pass
330 function provides a way to avoid repeated name lookups for applications that repeatedly query the same portion of the namespace, by translating a name to a
331 \(lqManagement Information Base\(rq
332 (MIB) that can be passed repeatedly to
333 mallctlbymib()\&. Upon successful return from
340 is the lesser of the number of components in
342 and the input value of
343 \fI*miblenp\fR\&. Thus it is possible to pass a
345 that is smaller than the number of period\-separated name components, which results in a partial MIB that can be used as the basis for constructing a complete MIB\&. For name components that are integers (e\&.g\&. the 2 in
346 arenas\&.bin\&.2\&.size), the corresponding MIB component will always be that integer\&. Therefore, it is legitimate to construct code like the following:
357 mallctl("arenas\&.nbins", &nbins, &len, NULL, 0);
360 mallctlnametomib("arenas\&.bin\&.0\&.size", mib, &miblen);
361 for (i = 0; i < nbins; i++) {
365 len = sizeof(bin_size);
366 mallctlbymib(mib, miblen, (void *)&bin_size, &len, NULL, 0);
367 /* Do something with bin_size\&.\&.\&. */
379 function writes summary statistics via the
381 callback function pointer and
389 \fBNULL\fR\&. The statistics are presented in human\-readable form unless
391 is specified as a character within the
393 string, in which case the statistics are presented in
394 \m[blue]\fBJSON format\fR\m[]\&\s-2\u[2]\d\s+2\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying
396 as a character within the
402 functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If
403 \fB\-\-enable\-stats\fR
404 is specified during configuration,
408 can be specified to omit merged arena, destroyed merged arena, and per arena statistics, respectively;
412 can be specified to omit per size class statistics for bins and large objects, respectively;
414 can be specified to omit all mutex statistics\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&.
418 function returns the usable size of the allocation pointed to by
419 \fIptr\fR\&. The return value may be larger than the size that was requested during allocation\&. The
421 function is not a mechanism for in\-place
422 realloc(); rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by
424 should not be depended on, since such behavior is entirely implementation\-dependent\&.
427 Once, when the first call is made to one of the memory allocation routines, the allocator initializes its internals based in part on various options that can be specified at compile\- or run\-time\&.
429 The string specified via
430 \fB\-\-with\-malloc\-conf\fR, the string pointed to by the global variable
431 \fImalloc_conf\fR, the
433 of the file referenced by the symbolic link named
434 /etc/malloc\&.conf, and the value of the environment variable
435 \fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. Note that
439 is entered, so the declaration of
441 should specify an initializer that contains the final value to be read by jemalloc\&.
442 \fB\-\-with\-malloc\-conf\fR
445 are compile\-time mechanisms, whereas
449 can be safely set any time prior to program invocation\&.
451 An options string is a comma\-separated list of option:value pairs\&. There is one key corresponding to each
455 section for options documentation)\&. For example,
461 options\&. Some options have boolean values (true/false), others have integer values (base 8, 10, or 16, depending on prefix), and yet others have raw string values\&.
462 .SH "IMPLEMENTATION NOTES"
464 Traditionally, allocators have used
466 to obtain memory, which is suboptimal for several reasons, including race conditions, increased fragmentation, and artificial limitations on maximum usable memory\&. If
468 is supported by the operating system, this allocator uses both
471 \fBsbrk\fR(2), in that order of preference; otherwise only
475 This allocator uses multiple arenas in order to reduce lock contention for threaded programs on multi\-processor systems\&. This works well with regard to threading scalability, but incurs some costs\&. There is a small fixed per\-arena overhead, and additionally, arenas manage memory completely independently of each other, which means a small fixed increase in overall memory fragmentation\&. These overheads are not generally an issue, given the number of arenas normally used\&. Note that using substantially more arenas than the default is not likely to improve performance, mainly due to reduced cache performance\&. However, it may make sense to reduce the number of arenas if an application does not make much use of the allocation functions\&.
477 In addition to multiple arenas, this allocator supports thread\-specific caching, in order to make it possible to completely avoid synchronization for most allocation requests\&. Such caching allows very fast allocation in the common case, but it increases memory usage and fragmentation, since a bounded number of objects can remain allocated in each thread cache\&.
479 Memory is conceptually broken into extents\&. Extents are always aligned to multiples of the page size\&. This alignment makes it possible to find metadata for user objects quickly\&. User objects are broken into two categories according to size: small and large\&. Contiguous small objects comprise a slab, which resides within a single extent, whereas large objects each have their own extents backing them\&.
481 Small objects are managed in groups by slabs\&. Each slab maintains a bitmap to track which regions are in use\&. Allocation requests that are no more than half the quantum (8 or 16, depending on architecture) are rounded up to the nearest power of two that is at least
482 sizeof(\fBdouble\fR)\&. All other object size classes are multiples of the quantum, spaced such that there are four size classes for each doubling in size, which limits internal fragmentation to approximately 20% for all but the smallest size classes\&. Small size classes are smaller than four times the page size, and large size classes extend from four times the page size up to the largest size class that does not exceed
485 Allocations are packed tightly together, which can be an issue for multi\-threaded applications\&. If you need to assure that allocations do not suffer from cacheline sharing, round your allocation requests up to the nearest multiple of the cacheline size, or specify cacheline alignment when allocating\&.
491 functions may resize allocations without moving them under limited circumstances\&. Unlike the
493 API, the standard API does not officially round up the usable size of an allocation to the nearest size class, so technically it is necessary to call
495 to grow e\&.g\&. a 9\-byte allocation to 16 bytes, or shrink a 16\-byte allocation to 9 bytes\&. Growth and shrinkage trivially succeeds in place as long as the pre\-size and post\-size both round up to the same size class\&. No other API guarantees are made regarding in\-place resizing, but the current implementation also tries to resize large allocations in place, as long as the pre\-size and post\-size are both large\&. For shrinkage to succeed, the extent allocator must support splitting (see
496 arena\&.<i>\&.extent_hooks)\&. Growth only succeeds if the trailing memory is currently available, and the extent allocator supports merging\&.
498 Assuming 4 KiB pages and a 16\-byte quantum on a 64\-bit system, the size classes in each category are as shown in
502 .nr an-no-space-flag 1
505 .B Table\ \&1.\ \&Size classes
552 [16, 32, 48, 64, 80, 96, 112, 128]
567 [640, 768, 896, 1024]
572 [1280, 1536, 1792, 2048]
577 [2560, 3072, 3584, 4096]
582 [5 KiB, 6 KiB, 7 KiB, 8 KiB]
587 [10 KiB, 12 KiB, 14 KiB]
599 [20 KiB, 24 KiB, 28 KiB, 32 KiB]
604 [40 KiB, 48 KiB, 54 KiB, 64 KiB]
609 [80 KiB, 96 KiB, 112 KiB, 128 KiB]
614 [160 KiB, 192 KiB, 224 KiB, 256 KiB]
619 [320 KiB, 384 KiB, 448 KiB, 512 KiB]
624 [640 KiB, 768 KiB, 896 KiB, 1 MiB]
629 [1280 KiB, 1536 KiB, 1792 KiB, 2 MiB]
634 [2560 KiB, 3 MiB, 3584 KiB, 4 MiB]
639 [5 MiB, 6 MiB, 7 MiB, 8 MiB]
644 [10 MiB, 12 MiB, 14 MiB, 16 MiB]
649 [20 MiB, 24 MiB, 28 MiB, 32 MiB]
654 [40 MiB, 48 MiB, 56 MiB, 64 MiB]
664 [2560 PiB, 3 EiB, 3584 PiB, 4 EiB]
669 [5 EiB, 6 EiB, 7 EiB]
673 .SH "MALLCTL NAMESPACE"
675 The following names are defined in the namespace accessible via the
677 functions\&. Value types are specified in parentheses, their readable/writable statuses are encoded as
681 \-\-, and required build configuration flags follow, if any\&. A name element encoded as
685 indicates an integer component, where the integer varies from 0 to some upper value that must be determined via introspection\&. In the case of
686 stats\&.arenas\&.<i>\&.*
688 arena\&.<i>\&.{initialized,purge,decay,dss},
691 \fBMALLCTL_ARENAS_ALL\fR
692 can be used to operate on all arenas or access the summation of statistics from all arenas; similarly
695 \fBMALLCTL_ARENAS_DESTROYED\fR
696 can be used to access the summation of statistics from all destroyed arenas\&. These constants can be utilized either via
699 mallctlbymib(), or via code such as the following:
705 #define STRINGIFY_HELPER(x) #x
706 #define STRINGIFY(x) STRINGIFY_HELPER(x)
708 mallctl("arena\&." STRINGIFY(MALLCTL_ARENAS_ALL) "\&.decay",
709 NULL, NULL, NULL, 0);
715 Take special note of the
717 mallctl, which controls refreshing of cached dynamic statistics\&.
719 version (\fBconst char *\fR) r\-
721 Return the jemalloc version string\&.
724 epoch (\fBuint64_t\fR) rw
726 If a value is passed in, refresh the data from which the
728 functions report values, and increment the epoch\&. Return the current epoch\&. This is useful for detecting whether another thread caused a refresh\&.
731 background_thread (\fBbool\fR) rw
733 Enable/disable internal background worker threads\&. When set to true, background threads are created on demand (the number of background threads will be no more than the number of CPUs or active arenas)\&. Threads run periodically, and handle
735 asynchronously\&. When switching off, background threads are terminated synchronously\&. Note that after
737 function, the state in the child process will be disabled regardless the state in parent process\&. See
738 stats\&.background_thread
740 opt\&.background_thread
741 can be used to set the default option\&. This option is only available on selected pthread\-based platforms\&.
744 max_background_threads (\fBsize_t\fR) rw
746 Maximum number of background worker threads that will be created\&. This value is capped at
747 opt\&.max_background_threads
751 config\&.cache_oblivious (\fBbool\fR) r\-
753 \fB\-\-enable\-cache\-oblivious\fR
754 was specified during build configuration\&.
757 config\&.debug (\fBbool\fR) r\-
759 \fB\-\-enable\-debug\fR
760 was specified during build configuration\&.
763 config\&.fill (\fBbool\fR) r\-
765 \fB\-\-enable\-fill\fR
766 was specified during build configuration\&.
769 config\&.lazy_lock (\fBbool\fR) r\-
771 \fB\-\-enable\-lazy\-lock\fR
772 was specified during build configuration\&.
775 config\&.malloc_conf (\fBconst char *\fR) r\-
777 Embedded configure\-time\-specified run\-time options string, empty unless
778 \fB\-\-with\-malloc\-conf\fR
779 was specified during build configuration\&.
782 config\&.prof (\fBbool\fR) r\-
784 \fB\-\-enable\-prof\fR
785 was specified during build configuration\&.
788 config\&.prof_libgcc (\fBbool\fR) r\-
790 \fB\-\-disable\-prof\-libgcc\fR
791 was not specified during build configuration\&.
794 config\&.prof_libunwind (\fBbool\fR) r\-
796 \fB\-\-enable\-prof\-libunwind\fR
797 was specified during build configuration\&.
800 config\&.stats (\fBbool\fR) r\-
802 \fB\-\-enable\-stats\fR
803 was specified during build configuration\&.
806 config\&.utrace (\fBbool\fR) r\-
808 \fB\-\-enable\-utrace\fR
809 was specified during build configuration\&.
812 config\&.xmalloc (\fBbool\fR) r\-
814 \fB\-\-enable\-xmalloc\fR
815 was specified during build configuration\&.
818 opt\&.abort (\fBbool\fR) r\-
820 Abort\-on\-warning enabled/disabled\&. If true, most warnings are fatal\&. Note that runtime option warnings are not included (see
822 for that)\&. The process will call
824 in these cases\&. This option is disabled by default unless
825 \fB\-\-enable\-debug\fR
826 is specified during configuration, in which case it is enabled by default\&.
829 opt\&.abort_conf (\fBbool\fR) r\-
831 Abort\-on\-invalid\-configuration enabled/disabled\&. If true, invalid runtime options are fatal\&. The process will call
833 in these cases\&. This option is disabled by default unless
834 \fB\-\-enable\-debug\fR
835 is specified during configuration, in which case it is enabled by default\&.
838 opt\&.metadata_thp (\fBconst char *\fR) r\-
840 Controls whether to allow jemalloc to use transparent huge page (THP) for internal metadata (see
845 uses no THP initially, but may begin to do so when metadata usage reaches certain level\&. The default is
849 opt\&.retain (\fBbool\fR) r\-
851 If true, retain unused virtual memory for later reuse rather than discarding it by calling
855 for related details)\&. This option is disabled by default unless discarding virtual memory is known to trigger platform\-specific performance problems, e\&.g\&. for [64\-bit] Linux, which has a quirk in its virtual memory allocation algorithm that causes semi\-permanent VM map holes under normal jemalloc operation\&. Although
857 causes issues on 32\-bit Linux as well, retaining virtual memory for 32\-bit Linux is disabled by default due to the practical possibility of address space exhaustion\&.
860 opt\&.dss (\fBconst char *\fR) r\-
862 dss (\fBsbrk\fR(2)) allocation precedence as related to
864 allocation\&. The following settings are supported if
866 is supported by the operating system:
869 \(lqsecondary\(rq; otherwise only
871 is supported\&. The default is
875 is supported by the operating system;
880 opt\&.narenas (\fBunsigned\fR) r\-
882 Maximum number of arenas to use for automatic multiplexing of threads and arenas\&. The default is four times the number of CPUs, or one if there is a single CPU\&.
885 opt\&.percpu_arena (\fBconst char *\fR) r\-
887 Per CPU arena mode\&. Use the
889 setting to enable this feature, which uses number of CPUs to determine number of arenas, and bind threads to arenas dynamically based on the CPU the thread runs on currently\&.
891 setting uses one arena per physical CPU, which means the two hyper threads on the same CPU share one arena\&. Note that no runtime checking regarding the availability of hyper threading is done at the moment\&. When set to
892 \(lqdisabled\(rq, narenas and thread to arena association will not be impacted by this option\&. The default is
896 opt\&.background_thread (\fBconst bool\fR) r\-
898 Internal background worker threads enabled/disabled\&. Because of potential circular dependencies, enabling background thread using this option may cause crash or deadlock during initialization\&. For a reliable way to use this feature, see
900 for dynamic control options and details\&. This option is disabled by default\&.
903 opt\&.max_background_threads (\fBconst size_t\fR) r\-
905 Maximum number of background threads that will be created if
907 is set\&. Defaults to number of cpus\&.
910 opt\&.dirty_decay_ms (\fBssize_t\fR) r\-
912 Approximate time in milliseconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged (i\&.e\&. converted to muzzy via e\&.g\&.
913 madvise(\fI\&.\&.\&.\fR\fI\fBMADV_FREE\fR\fR)
914 if supported by the operating system, or converted to clean otherwise) and/or reused\&. Dirty pages are defined as previously having been potentially written to by the application, and therefore consuming physical memory, yet having no current use\&. The pages are incrementally purged according to a sigmoidal decay curve that starts and ends with zero purge rate\&. A decay time of 0 causes all unused dirty pages to be purged immediately upon creation\&. A decay time of \-1 disables purging\&. The default decay time is 10 seconds\&. See
915 arenas\&.dirty_decay_ms
917 arena\&.<i>\&.dirty_decay_ms
918 for related dynamic control options\&. See
920 for a description of muzzy pages\&.
923 opt\&.muzzy_decay_ms (\fBssize_t\fR) r\-
925 Approximate time in milliseconds from the creation of a set of unused muzzy pages until an equivalent set of unused muzzy pages is purged (i\&.e\&. converted to clean) and/or reused\&. Muzzy pages are defined as previously having been unused dirty pages that were subsequently purged in a manner that left them subject to the reclamation whims of the operating system (e\&.g\&.
926 madvise(\fI\&.\&.\&.\fR\fI\fBMADV_FREE\fR\fR)), and therefore in an indeterminate state\&. The pages are incrementally purged according to a sigmoidal decay curve that starts and ends with zero purge rate\&. A decay time of 0 causes all unused muzzy pages to be purged immediately upon creation\&. A decay time of \-1 disables purging\&. The default decay time is 10 seconds\&. See
927 arenas\&.muzzy_decay_ms
929 arena\&.<i>\&.muzzy_decay_ms
930 for related dynamic control options\&.
933 opt\&.lg_extent_max_active_fit (\fBsize_t\fR) r\-
935 When reusing dirty extents, this determines the (log base 2 of the) maximum ratio between the size of the active extent selected (to split off from) and the size of the requested allocation\&. This prevents the splitting of large active extents for smaller allocations, which can reduce fragmentation over the long run (especially for non\-active extents)\&. Lower value may reduce fragmentation, at the cost of extra active extents\&. The default value is 6, which gives a maximum ratio of 64 (2^6)\&.
938 opt\&.stats_print (\fBbool\fR) r\-
940 Enable/disable statistics printing at exit\&. If enabled, the
942 function is called at program exit via an
945 opt\&.stats_print_opts
946 can be combined to specify output options\&. If
947 \fB\-\-enable\-stats\fR
948 is specified during configuration, this has the potential to cause deadlock for a multi\-threaded process that exits while one or more threads are executing in the memory allocation functions\&. Furthermore,
950 may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls
951 atexit(), so this option is not universally usable (though the application can register its own
953 function with equivalent functionality)\&. Therefore, this option should only be used with care; it is primarily intended as a performance tuning aid during application development\&. This option is disabled by default\&.
956 opt\&.stats_print_opts (\fBconst char *\fR) r\-
960 string) to pass to the
962 at exit (enabled through
963 opt\&.stats_print)\&. See available options in
964 malloc_stats_print()\&. Has no effect unless
966 is enabled\&. The default is
970 opt\&.junk (\fBconst char *\fR) r\- [\fB\-\-enable\-fill\fR]
972 Junk filling\&. If set to
973 \(lqalloc\(rq, each byte of uninitialized allocated memory will be initialized to
975 \(lqfree\(rq, all deallocated memory will be initialized to
977 \(lqtrue\(rq, both allocated and deallocated memory will be initialized, and if set to
978 \(lqfalse\(rq, junk filling be disabled entirely\&. This is intended for debugging and will impact performance negatively\&. This option is
981 \fB\-\-enable\-debug\fR
982 is specified during configuration, in which case it is
987 opt\&.zero (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR]
989 Zero filling enabled/disabled\&. If enabled, each byte of uninitialized allocated memory will be initialized to 0\&. Note that this initialization only happens once for each byte, so
993 calls do not zero memory that was previously allocated\&. This is intended for debugging and will impact performance negatively\&. This option is disabled by default\&.
996 opt\&.utrace (\fBbool\fR) r\- [\fB\-\-enable\-utrace\fR]
998 Allocation tracing based on
1000 enabled/disabled\&. This option is disabled by default\&.
1003 opt\&.xmalloc (\fBbool\fR) r\- [\fB\-\-enable\-xmalloc\fR]
1005 Abort\-on\-out\-of\-memory enabled/disabled\&. If enabled, rather than returning failure for any allocation function, display a diagnostic message on
1007 and cause the program to drop core (using
1008 \fBabort\fR(3))\&. If an application is designed to depend on this behavior, set the option at compile time by including the following in the source code:
1014 malloc_conf = "xmalloc:true";
1020 This option is disabled by default\&.
1023 opt\&.tcache (\fBbool\fR) r\-
1025 Thread\-specific caching (tcache) enabled/disabled\&. When there are multiple threads, each thread uses a tcache for objects up to a certain size\&. Thread\-specific caching allows many allocations to be satisfied without performing any thread synchronization, at the cost of increased memory use\&. See the
1027 option for related tuning information\&. This option is enabled by default\&.
1030 opt\&.lg_tcache_max (\fBsize_t\fR) r\-
1032 Maximum size class (log base 2) to cache in the thread\-specific cache (tcache)\&. At a minimum, all small size classes are cached, and at a maximum all large size classes are cached\&. The default maximum is 32 KiB (2^15)\&.
1035 opt\&.thp (\fBconst char *\fR) r\-
1037 Transparent hugepage (THP) mode\&. Settings "always", "never" and "default" are available if THP is supported by the operating system\&. The "always" setting enables transparent hugepage for all user memory mappings with
1038 \fI\fBMADV_HUGEPAGE\fR\fR; "never" ensures no transparent hugepage with
1039 \fI\fBMADV_NOHUGEPAGE\fR\fR; the default setting "default" makes no changes\&. Note that: this option does not affect THP for jemalloc internal metadata (see
1040 opt\&.metadata_thp); in addition, for arenas with customized
1041 extent_hooks, this option is bypassed as it is implemented as part of the default extent hooks\&.
1044 opt\&.prof (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1046 Memory profiling enabled/disabled\&. If enabled, profile memory allocation activity\&. See the
1048 option for on\-the\-fly activation/deactivation\&. See the
1049 opt\&.lg_prof_sample
1050 option for probabilistic sampling control\&. See the
1052 option for control of cumulative sample reporting\&. See the
1053 opt\&.lg_prof_interval
1054 option for information on interval\-triggered profile dumping, the
1056 option for information on high\-water\-triggered profile dumping, and the
1058 option for final profile dumping\&. Profile output is compatible with the
1060 command, which is based on the
1062 that is developed as part of the
1063 \m[blue]\fBgperftools package\fR\m[]\&\s-2\u[3]\d\s+2\&. See
1065 for heap profile format documentation\&.
1068 opt\&.prof_prefix (\fBconst char *\fR) r\- [\fB\-\-enable\-prof\fR]
1070 Filename prefix for profile dumps\&. If the prefix is set to the empty string, no automatic dumps will occur; this is primarily useful for disabling the automatic final heap dump (which also disables leak reporting, if enabled)\&. The default prefix is
1074 opt\&.prof_active (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1076 Profiling activated/deactivated\&. This is a secondary control mechanism that makes it possible to start the application with profiling enabled (see the
1078 option) but inactive, then toggle profiling at any time during program execution with the
1080 mallctl\&. This option is enabled by default\&.
1083 opt\&.prof_thread_active_init (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1086 thread\&.prof\&.active
1087 in newly created threads\&. The initial setting for newly created threads can also be changed during execution via the
1088 prof\&.thread_active_init
1089 mallctl\&. This option is enabled by default\&.
1092 opt\&.lg_prof_sample (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR]
1094 Average interval (log base 2) between allocation samples, as measured in bytes of allocation activity\&. Increasing the sampling interval decreases profile fidelity, but also decreases the computational overhead\&. The default sample interval is 512 KiB (2^19 B)\&.
1097 opt\&.prof_accum (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1099 Reporting of cumulative object/byte counts in profile dumps enabled/disabled\&. If this option is enabled, every unique backtrace must be stored for the duration of execution\&. Depending on the application, this can impose a large memory overhead, and the cumulative counts are not always of interest\&. This option is disabled by default\&.
1102 opt\&.lg_prof_interval (\fBssize_t\fR) r\- [\fB\-\-enable\-prof\fR]
1104 Average interval (log base 2) between memory profile dumps, as measured in bytes of allocation activity\&. The actual interval between dumps may be sporadic because decentralized allocation counters are used to avoid synchronization bottlenecks\&. Profiles are dumped to files named according to the pattern
1105 <prefix>\&.<pid>\&.<seq>\&.i<iseq>\&.heap, where
1107 is controlled by the
1109 option\&. By default, interval\-triggered profile dumping is disabled (encoded as \-1)\&.
1112 opt\&.prof_gdump (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1114 Set the initial state of
1115 prof\&.gdump, which when enabled triggers a memory profile dump every time the total virtual memory exceeds the previous maximum\&. This option is disabled by default\&.
1118 opt\&.prof_final (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1122 function to dump final memory usage to a file named according to the pattern
1123 <prefix>\&.<pid>\&.<seq>\&.f\&.heap, where
1125 is controlled by the
1129 may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls
1130 atexit(), so this option is not universally usable (though the application can register its own
1132 function with equivalent functionality)\&. This option is disabled by default\&.
1135 opt\&.prof_leak (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1137 Leak reporting enabled/disabled\&. If enabled, use an
1139 function to report memory leaks detected by allocation sampling\&. See the
1141 option for information on analyzing heap profile output\&. This option is disabled by default\&.
1144 thread\&.arena (\fBunsigned\fR) rw
1146 Get or set the arena associated with the calling thread\&. If the specified arena was not initialized beforehand (see the
1147 arena\&.i\&.initialized
1148 mallctl), it will be automatically initialized as a side effect of calling this interface\&.
1151 thread\&.allocated (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1153 Get the total number of bytes ever allocated by the calling thread\&. This counter has the potential to wrap around; it is up to the application to appropriately interpret the counter in such cases\&.
1156 thread\&.allocatedp (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR]
1158 Get a pointer to the the value that is returned by the
1160 mallctl\&. This is useful for avoiding the overhead of repeated
1165 thread\&.deallocated (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1167 Get the total number of bytes ever deallocated by the calling thread\&. This counter has the potential to wrap around; it is up to the application to appropriately interpret the counter in such cases\&.
1170 thread\&.deallocatedp (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR]
1172 Get a pointer to the the value that is returned by the
1173 thread\&.deallocated
1174 mallctl\&. This is useful for avoiding the overhead of repeated
1179 thread\&.tcache\&.enabled (\fBbool\fR) rw
1181 Enable/disable calling thread\*(Aqs tcache\&. The tcache is implicitly flushed as a side effect of becoming disabled (see
1182 thread\&.tcache\&.flush)\&.
1185 thread\&.tcache\&.flush (\fBvoid\fR) \-\-
1187 Flush calling thread\*(Aqs thread\-specific cache (tcache)\&. This interface releases all cached objects and internal data structures associated with the calling thread\*(Aqs tcache\&. Ordinarily, this interface need not be called, since automatic periodic incremental garbage collection occurs, and the thread cache is automatically discarded when a thread exits\&. However, garbage collection is triggered by allocation activity, so it is possible for a thread that stops allocating/deallocating to retain its cache indefinitely, in which case the developer may find manual flushing useful\&.
1190 thread\&.prof\&.name (\fBconst char *\fR) r\- or \-w [\fB\-\-enable\-prof\fR]
1192 Get/set the descriptive name associated with the calling thread in memory profile dumps\&. An internal copy of the name string is created, so the input string need not be maintained after this interface completes execution\&. The output string of this interface should be copied for non\-ephemeral uses, because multiple implementation details can cause asynchronous string deallocation\&. Furthermore, each invocation of this interface can only read or write; simultaneous read/write is not supported due to string lifetime limitations\&. The name string must be nil\-terminated and comprised only of characters in the sets recognized by
1198 thread\&.prof\&.active (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1200 Control whether sampling is currently active for the calling thread\&. This is an activation mechanism in addition to
1201 prof\&.active; both must be active for the calling thread to sample\&. This flag is enabled by default\&.
1204 tcache\&.create (\fBunsigned\fR) r\-
1206 Create an explicit thread\-specific cache (tcache) and return an identifier that can be passed to the
1207 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR
1208 macro to explicitly use the specified cache rather than the automatically managed one that is used by default\&. Each explicit cache can be used by only one thread at a time; the application must assure that this constraint holds\&.
1211 tcache\&.flush (\fBunsigned\fR) \-w
1213 Flush the specified thread\-specific cache (tcache)\&. The same considerations apply to this interface as to
1214 thread\&.tcache\&.flush, except that the tcache will never be automatically discarded\&.
1217 tcache\&.destroy (\fBunsigned\fR) \-w
1219 Flush the specified thread\-specific cache (tcache) and make the identifier available for use during a future tcache creation\&.
1222 arena\&.<i>\&.initialized (\fBbool\fR) r\-
1224 Get whether the specified arena\*(Aqs statistics are initialized (i\&.e\&. the arena was initialized prior to the current epoch)\&. This interface can also be nominally used to query whether the merged statistics corresponding to
1225 \fBMALLCTL_ARENAS_ALL\fR
1226 are initialized (always true)\&.
1229 arena\&.<i>\&.decay (\fBvoid\fR) \-\-
1231 Trigger decay\-based purging of unused dirty/muzzy pages for arena <i>, or for all arenas if <i> equals
1232 \fBMALLCTL_ARENAS_ALL\fR\&. The proportion of unused dirty/muzzy pages to be purged depends on the current time; see
1233 opt\&.dirty_decay_ms
1239 arena\&.<i>\&.purge (\fBvoid\fR) \-\-
1241 Purge all unused dirty pages for arena <i>, or for all arenas if <i> equals
1242 \fBMALLCTL_ARENAS_ALL\fR\&.
1245 arena\&.<i>\&.reset (\fBvoid\fR) \-\-
1247 Discard all of the arena\*(Aqs extant allocations\&. This interface can only be used with arenas explicitly created via
1248 arenas\&.create\&. None of the arena\*(Aqs discarded/cached allocations may accessed afterward\&. As part of this requirement, all thread caches which were used to allocate/deallocate in conjunction with the arena must be flushed beforehand\&.
1251 arena\&.<i>\&.destroy (\fBvoid\fR) \-\-
1253 Destroy the arena\&. Discard all of the arena\*(Aqs extant allocations using the same mechanism as for
1255 (with all the same constraints and side effects), merge the arena stats into those accessible at arena index
1256 \fBMALLCTL_ARENAS_DESTROYED\fR, and then completely discard all metadata associated with the arena\&. Future calls to
1258 may recycle the arena index\&. Destruction will fail if any threads are currently associated with the arena as a result of calls to
1262 arena\&.<i>\&.dss (\fBconst char *\fR) rw
1264 Set the precedence of dss allocation as related to mmap allocation for arena <i>, or for all arenas if <i> equals
1265 \fBMALLCTL_ARENAS_ALL\fR\&. See
1267 for supported settings\&.
1270 arena\&.<i>\&.dirty_decay_ms (\fBssize_t\fR) rw
1272 Current per\-arena approximate time in milliseconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. Each time this interface is set, all currently unused dirty pages are considered to have fully decayed, which causes immediate purging of all unused dirty pages unless the decay time is set to \-1 (i\&.e\&. purging disabled)\&. See
1273 opt\&.dirty_decay_ms
1274 for additional information\&.
1277 arena\&.<i>\&.muzzy_decay_ms (\fBssize_t\fR) rw
1279 Current per\-arena approximate time in milliseconds from the creation of a set of unused muzzy pages until an equivalent set of unused muzzy pages is purged and/or reused\&. Each time this interface is set, all currently unused muzzy pages are considered to have fully decayed, which causes immediate purging of all unused muzzy pages unless the decay time is set to \-1 (i\&.e\&. purging disabled)\&. See
1280 opt\&.muzzy_decay_ms
1281 for additional information\&.
1284 arena\&.<i>\&.retain_grow_limit (\fBsize_t\fR) rw
1286 Maximum size to grow retained region (only relevant when
1288 is enabled)\&. This controls the maximum increment to expand virtual memory, or allocation through
1289 arena\&.<i>extent_hooks\&. In particular, if customized extent hooks reserve physical memory (e\&.g\&. 1G huge pages), this is useful to control the allocation hook\*(Aqs input size\&. The default is no limit\&.
1292 arena\&.<i>\&.extent_hooks (\fBextent_hooks_t *\fR) rw
1294 Get or set the extent management hook functions for arena <i>\&. The functions must be capable of operating on all extant extents associated with arena <i>, usually by passing unknown extents to the replaced functions\&. In practice, it is feasible to control allocation for arenas explicitly created via
1296 such that all extents originate from an application\-supplied extent allocator (by specifying the custom extent hook functions during arena creation), but the automatically created arenas will have already created extents prior to the application having an opportunity to take over extent allocation\&.
1302 typedef extent_hooks_s extent_hooks_t;
1303 struct extent_hooks_s {
1304 extent_alloc_t *alloc;
1305 extent_dalloc_t *dalloc;
1306 extent_destroy_t *destroy;
1307 extent_commit_t *commit;
1308 extent_decommit_t *decommit;
1309 extent_purge_t *purge_lazy;
1310 extent_purge_t *purge_forced;
1311 extent_split_t *split;
1312 extent_merge_t *merge;
1320 \fBextent_hooks_t\fR
1321 structure comprises function pointers which are described individually below\&. jemalloc uses these functions to manage extent lifetime, which starts off with allocation of mapped committed memory, in the simplest case followed by deallocation\&. However, there are performance and platform reasons to retain extents for later reuse\&. Cleanup attempts cascade from deallocation to decommit to forced purging to lazy purging, which gives the extent management functions opportunities to reject the most permanent cleanup operations in favor of less permanent (and often less costly) operations\&. All operations except allocation can be universally opted out of by setting the hook pointers to
1322 \fBNULL\fR, or selectively opted out of by returning failure\&. Note that once the extent hook is set, the structure is accessed directly by the associated arenas, so it must remain valid for the entire lifetime of the arenas\&.
1323 .HP \w'typedef\ void\ *(extent_alloc_t)('u
1324 .BI "typedef void *(extent_alloc_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "new_addr" ", size_t\ " "size" ", size_t\ " "alignment" ", bool\ *" "zero" ", bool\ *" "commit" ", unsigned\ " "arena_ind" ");"
1335 An extent allocation function conforms to the
1336 \fBextent_alloc_t\fR
1337 type and upon success returns a pointer to
1339 bytes of mapped memory on behalf of arena
1341 such that the extent\*(Aqs base address is a multiple of
1342 \fIalignment\fR, as well as setting
1344 to indicate whether the extent is zeroed and
1346 to indicate whether the extent is committed\&. Upon error the function returns
1354 parameter is always a multiple of the page size\&. The
1356 parameter is always a power of two at least as large as the page size\&. Zeroing is mandatory if
1358 is true upon function entry\&. Committing is mandatory if
1360 is true upon function entry\&. If
1363 \fBNULL\fR, the returned pointer must be
1367 on error\&. Committed memory may be committed in absolute terms as on a system that does not overcommit, or in implicit terms as on a system that overcommits and satisfies physical memory needs on demand via soft page faults\&. Note that replacing the default extent allocation function makes the arena\*(Aqs
1369 setting irrelevant\&.
1370 .HP \w'typedef\ bool\ (extent_dalloc_t)('u
1371 .BI "typedef bool (extent_dalloc_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr" ", size_t\ " "size" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1382 An extent deallocation function conforms to the
1383 \fBextent_dalloc_t\fR
1384 type and deallocates an extent at given
1389 \fIcommitted\fR/decommited memory as indicated, on behalf of arena
1390 \fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates opt\-out from deallocation; the virtual memory mapping associated with the extent remains mapped, in the same commit state, and available for future use, in which case it will be automatically retained for later reuse\&.
1391 .HP \w'typedef\ void\ (extent_destroy_t)('u
1392 .BI "typedef void (extent_destroy_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr" ", size_t\ " "size" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1403 An extent destruction function conforms to the
1404 \fBextent_destroy_t\fR
1405 type and unconditionally destroys an extent at given
1410 \fIcommitted\fR/decommited memory as indicated, on behalf of arena
1411 \fIarena_ind\fR\&. This function may be called to destroy retained extents during arena destruction (see
1412 arena\&.<i>\&.destroy)\&.
1413 .HP \w'typedef\ bool\ (extent_commit_t)('u
1414 .BI "typedef bool (extent_commit_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr" ", size_t\ " "size" ", size_t\ " "offset" ", size_t\ " "length" ", unsigned\ " "arena_ind" ");"
1425 An extent commit function conforms to the
1426 \fBextent_commit_t\fR
1427 type and commits zeroed physical memory to back pages within an extent at given
1433 bytes, extending for
1436 \fIarena_ind\fR, returning false upon success\&. Committed memory may be committed in absolute terms as on a system that does not overcommit, or in implicit terms as on a system that overcommits and satisfies physical memory needs on demand via soft page faults\&. If the function returns true, this indicates insufficient physical memory to satisfy the request\&.
1437 .HP \w'typedef\ bool\ (extent_decommit_t)('u
1438 .BI "typedef bool (extent_decommit_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr" ", size_t\ " "size" ", size_t\ " "offset" ", size_t\ " "length" ", unsigned\ " "arena_ind" ");"
1449 An extent decommit function conforms to the
1450 \fBextent_decommit_t\fR
1451 type and decommits any physical memory that is backing pages within an extent at given
1457 bytes, extending for
1460 \fIarena_ind\fR, returning false upon success, in which case the pages will be committed via the extent commit function before being reused\&. If the function returns true, this indicates opt\-out from decommit; the memory remains committed and available for future use, in which case it will be automatically retained for later reuse\&.
1461 .HP \w'typedef\ bool\ (extent_purge_t)('u
1462 .BI "typedef bool (extent_purge_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr" ", size_t\ " "size" ", size_t\ " "offset" ", size_t\ " "length" ", unsigned\ " "arena_ind" ");"
1473 An extent purge function conforms to the
1474 \fBextent_purge_t\fR
1475 type and discards physical pages within the virtual memory mapping associated with an extent at given
1481 bytes, extending for
1484 \fIarena_ind\fR\&. A lazy extent purge function (e\&.g\&. implemented via
1485 madvise(\fI\&.\&.\&.\fR\fI\fBMADV_FREE\fR\fR)) can delay purging indefinitely and leave the pages within the purged virtual memory range in an indeterminite state, whereas a forced extent purge function immediately purges, and the pages within the virtual memory range will be zero\-filled the next time they are accessed\&. If the function returns true, this indicates failure to purge\&.
1486 .HP \w'typedef\ bool\ (extent_split_t)('u
1487 .BI "typedef bool (extent_split_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr" ", size_t\ " "size" ", size_t\ " "size_a" ", size_t\ " "size_b" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1498 An extent split function conforms to the
1499 \fBextent_split_t\fR
1500 type and optionally splits an extent at given
1504 into two adjacent extents, the first of
1506 bytes, and the second of
1509 \fIcommitted\fR/decommitted memory as indicated, on behalf of arena
1510 \fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates that the extent remains unsplit and therefore should continue to be operated on as a whole\&.
1511 .HP \w'typedef\ bool\ (extent_merge_t)('u
1512 .BI "typedef bool (extent_merge_t)(extent_hooks_t\ *" "extent_hooks" ", void\ *" "addr_a" ", size_t\ " "size_a" ", void\ *" "addr_b" ", size_t\ " "size_b" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1523 An extent merge function conforms to the
1524 \fBextent_merge_t\fR
1525 type and optionally merges adjacent extents, at given
1533 into one contiguous extent, operating on
1534 \fIcommitted\fR/decommitted memory as indicated, on behalf of arena
1535 \fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates that the extents remain distinct mappings and therefore should continue to be operated on independently\&.
1538 arenas\&.narenas (\fBunsigned\fR) r\-
1540 Current limit on number of arenas\&.
1543 arenas\&.dirty_decay_ms (\fBssize_t\fR) rw
1545 Current default per\-arena approximate time in milliseconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused, used to initialize
1546 arena\&.<i>\&.dirty_decay_ms
1547 during arena creation\&. See
1548 opt\&.dirty_decay_ms
1549 for additional information\&.
1552 arenas\&.muzzy_decay_ms (\fBssize_t\fR) rw
1554 Current default per\-arena approximate time in milliseconds from the creation of a set of unused muzzy pages until an equivalent set of unused muzzy pages is purged and/or reused, used to initialize
1555 arena\&.<i>\&.muzzy_decay_ms
1556 during arena creation\&. See
1557 opt\&.muzzy_decay_ms
1558 for additional information\&.
1561 arenas\&.quantum (\fBsize_t\fR) r\-
1566 arenas\&.page (\fBsize_t\fR) r\-
1571 arenas\&.tcache_max (\fBsize_t\fR) r\-
1573 Maximum thread\-cached size class\&.
1576 arenas\&.nbins (\fBunsigned\fR) r\-
1578 Number of bin size classes\&.
1581 arenas\&.nhbins (\fBunsigned\fR) r\-
1583 Total number of thread cache bin size classes\&.
1586 arenas\&.bin\&.<i>\&.size (\fBsize_t\fR) r\-
1588 Maximum size supported by size class\&.
1591 arenas\&.bin\&.<i>\&.nregs (\fBuint32_t\fR) r\-
1593 Number of regions per slab\&.
1596 arenas\&.bin\&.<i>\&.slab_size (\fBsize_t\fR) r\-
1598 Number of bytes per slab\&.
1601 arenas\&.nlextents (\fBunsigned\fR) r\-
1603 Total number of large size classes\&.
1606 arenas\&.lextent\&.<i>\&.size (\fBsize_t\fR) r\-
1608 Maximum size supported by this large size class\&.
1611 arenas\&.create (\fBunsigned\fR, \fBextent_hooks_t *\fR) rw
1613 Explicitly create a new arena outside the range of automatically managed arenas, with optionally specified extent hooks, and return the new arena index\&.
1616 arenas\&.lookup (\fBunsigned\fR, \fBvoid*\fR) rw
1618 Index of the arena to which an allocation belongs to\&.
1621 prof\&.thread_active_init (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1623 Control the initial setting for
1624 thread\&.prof\&.active
1625 in newly created threads\&. See the
1626 opt\&.prof_thread_active_init
1627 option for additional information\&.
1630 prof\&.active (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1632 Control whether sampling is currently active\&. See the
1634 option for additional information, as well as the interrelated
1635 thread\&.prof\&.active
1639 prof\&.dump (\fBconst char *\fR) \-w [\fB\-\-enable\-prof\fR]
1641 Dump a memory profile to the specified file, or if NULL is specified, to a file according to the pattern
1642 <prefix>\&.<pid>\&.<seq>\&.m<mseq>\&.heap, where
1644 is controlled by the
1649 prof\&.gdump (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1651 When enabled, trigger a memory profile dump every time the total virtual memory exceeds the previous maximum\&. Profiles are dumped to files named according to the pattern
1652 <prefix>\&.<pid>\&.<seq>\&.u<useq>\&.heap, where
1654 is controlled by the
1659 prof\&.reset (\fBsize_t\fR) \-w [\fB\-\-enable\-prof\fR]
1661 Reset all memory profile statistics, and optionally update the sample rate (see
1662 opt\&.lg_prof_sample
1664 prof\&.lg_sample)\&.
1667 prof\&.lg_sample (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR]
1669 Get the current sample rate (see
1670 opt\&.lg_prof_sample)\&.
1673 prof\&.interval (\fBuint64_t\fR) r\- [\fB\-\-enable\-prof\fR]
1675 Average number of bytes allocated between interval\-based profile dumps\&. See the
1676 opt\&.lg_prof_interval
1677 option for additional information\&.
1680 stats\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1682 Total number of bytes allocated by the application\&.
1685 stats\&.active (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1687 Total number of bytes in active pages allocated by the application\&. This is a multiple of the page size, and greater than or equal to
1688 stats\&.allocated\&. This does not include
1689 stats\&.arenas\&.<i>\&.pdirty,
1690 stats\&.arenas\&.<i>\&.pmuzzy, nor pages entirely devoted to allocator metadata\&.
1693 stats\&.metadata (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1695 Total number of bytes dedicated to metadata, which comprise base allocations used for bootstrap\-sensitive allocator metadata structures (see
1696 stats\&.arenas\&.<i>\&.base) and internal allocations (see
1697 stats\&.arenas\&.<i>\&.internal)\&. Transparent huge page (enabled with
1698 opt\&.metadata_thp) usage is not considered\&.
1701 stats\&.metadata_thp (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1703 Number of transparent huge pages (THP) used for metadata\&. See
1706 opt\&.metadata_thp) for details\&.
1709 stats\&.resident (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1711 Maximum number of bytes in physically resident data pages mapped by the allocator, comprising all pages dedicated to allocator metadata, pages backing active allocations, and unused dirty pages\&. This is a maximum rather than precise because pages may not actually be physically resident if they correspond to demand\-zeroed virtual memory that has not yet been touched\&. This is a multiple of the page size, and is larger than
1715 stats\&.mapped (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1717 Total number of bytes in active extents mapped by the allocator\&. This is larger than
1718 stats\&.active\&. This does not include inactive extents, even those that contain unused dirty pages, which means that there is no strict ordering between this and
1722 stats\&.retained (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1724 Total number of bytes in virtual memory mappings that were retained rather than being returned to the operating system via e\&.g\&.
1726 or similar\&. Retained virtual memory is typically untouched, decommitted, or purged, so it has no strongly associated physical memory (see
1728 for details)\&. Retained memory is excluded from mapped memory statistics, e\&.g\&.
1732 stats\&.background_thread\&.num_threads (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1736 running currently\&.
1739 stats\&.background_thread\&.num_runs (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1741 Total number of runs from all
1742 background threads\&.
1745 stats\&.background_thread\&.run_interval (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1747 Average run interval in nanoseconds of
1748 background threads\&.
1751 stats\&.mutexes\&.ctl\&.{counter}; (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
1755 mutex (global scope; mallctl related)\&.
1757 is one of the counters below:
1761 (\fBuint64_t\fR): Total number of lock acquisition operations on this mutex\&.
1764 (\fBuint64_t\fR): Number of times the mutex was spin\-acquired\&. When the mutex is currently locked and cannot be acquired immediately, a short period of spin\-retry within jemalloc will be performed\&. Acquired through spin generally means the contention was lightweight and not causing context switches\&.
1767 (\fBuint64_t\fR): Number of times the mutex was wait\-acquired, which means the mutex contention was not solved by spin\-retry, and blocking operation was likely involved in order to acquire the mutex\&. This event generally implies higher cost / longer delay, and should be investigated if it happens often\&.
1770 (\fBuint64_t\fR): Maximum length of time in nanoseconds spent on a single wait\-acquired lock operation\&. Note that to avoid profiling overhead on the common path, this does not consider spin\-acquired cases\&.
1772 \fItotal_wait_time\fR
1773 (\fBuint64_t\fR): Cumulative time in nanoseconds spent on wait\-acquired lock operations\&. Similarly, spin\-acquired cases are not considered\&.
1776 (\fBuint32_t\fR): Maximum number of threads waiting on this mutex simultaneously\&. Similarly, spin\-acquired cases are not considered\&.
1778 \fInum_owner_switch\fR
1779 (\fBuint64_t\fR): Number of times the current mutex owner is different from the previous one\&. This event does not generally imply an issue; rather it is an indicator of how often the protected data are accessed by different threads\&.
1783 stats\&.mutexes\&.background_thread\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
1786 \fIbackground_thread\fR
1787 mutex (global scope;
1791 is one of the counters in
1792 mutex profiling counters\&.
1795 stats\&.mutexes\&.prof\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
1799 mutex (global scope; profiling related)\&.
1801 is one of the counters in
1802 mutex profiling counters\&.
1805 stats\&.mutexes\&.reset (\fBvoid\fR) \-\- [\fB\-\-enable\-stats\fR]
1807 Reset all mutex profile statistics, including global mutexes, arena mutexes and bin mutexes\&.
1810 stats\&.arenas\&.<i>\&.dss (\fBconst char *\fR) r\-
1812 dss (\fBsbrk\fR(2)) allocation precedence as related to
1819 stats\&.arenas\&.<i>\&.dirty_decay_ms (\fBssize_t\fR) r\-
1821 Approximate time in milliseconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. See
1822 opt\&.dirty_decay_ms
1826 stats\&.arenas\&.<i>\&.muzzy_decay_ms (\fBssize_t\fR) r\-
1828 Approximate time in milliseconds from the creation of a set of unused muzzy pages until an equivalent set of unused muzzy pages is purged and/or reused\&. See
1829 opt\&.muzzy_decay_ms
1833 stats\&.arenas\&.<i>\&.nthreads (\fBunsigned\fR) r\-
1835 Number of threads currently assigned to arena\&.
1838 stats\&.arenas\&.<i>\&.uptime (\fBuint64_t\fR) r\-
1840 Time elapsed (in nanoseconds) since the arena was created\&. If <i> equals
1843 \fBMALLCTL_ARENAS_ALL\fR, this is the uptime since malloc initialization\&.
1846 stats\&.arenas\&.<i>\&.pactive (\fBsize_t\fR) r\-
1848 Number of pages in active extents\&.
1851 stats\&.arenas\&.<i>\&.pdirty (\fBsize_t\fR) r\-
1853 Number of pages within unused extents that are potentially dirty, and for which
1855 or similar has not been called\&. See
1856 opt\&.dirty_decay_ms
1857 for a description of dirty pages\&.
1860 stats\&.arenas\&.<i>\&.pmuzzy (\fBsize_t\fR) r\-
1862 Number of pages within unused extents that are muzzy\&. See
1863 opt\&.muzzy_decay_ms
1864 for a description of muzzy pages\&.
1867 stats\&.arenas\&.<i>\&.mapped (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1869 Number of mapped bytes\&.
1872 stats\&.arenas\&.<i>\&.retained (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1874 Number of retained bytes\&. See
1879 stats\&.arenas\&.<i>\&.base (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1881 Number of bytes dedicated to bootstrap\-sensitive allocator metadata structures\&.
1884 stats\&.arenas\&.<i>\&.internal (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1886 Number of bytes dedicated to internal allocations\&. Internal allocations differ from application\-originated allocations in that they are for internal use, and that they are omitted from heap profiles\&.
1889 stats\&.arenas\&.<i>\&.metadata_thp (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1891 Number of transparent huge pages (THP) used for metadata\&. See
1896 stats\&.arenas\&.<i>\&.resident (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1898 Maximum number of bytes in physically resident data pages mapped by the arena, comprising all pages dedicated to allocator metadata, pages backing active allocations, and unused dirty pages\&. This is a maximum rather than precise because pages may not actually be physically resident if they correspond to demand\-zeroed virtual memory that has not yet been touched\&. This is a multiple of the page size\&.
1901 stats\&.arenas\&.<i>\&.dirty_npurge (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1903 Number of dirty page purge sweeps performed\&.
1906 stats\&.arenas\&.<i>\&.dirty_nmadvise (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1910 or similar calls made to purge dirty pages\&.
1913 stats\&.arenas\&.<i>\&.dirty_purged (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1915 Number of dirty pages purged\&.
1918 stats\&.arenas\&.<i>\&.muzzy_npurge (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1920 Number of muzzy page purge sweeps performed\&.
1923 stats\&.arenas\&.<i>\&.muzzy_nmadvise (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1927 or similar calls made to purge muzzy pages\&.
1930 stats\&.arenas\&.<i>\&.muzzy_purged (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1932 Number of muzzy pages purged\&.
1935 stats\&.arenas\&.<i>\&.small\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1937 Number of bytes currently allocated by small objects\&.
1940 stats\&.arenas\&.<i>\&.small\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1942 Cumulative number of times a small allocation was requested from the arena\*(Aqs bins, whether to fill the relevant tcache if
1944 is enabled, or to directly satisfy an allocation request otherwise\&.
1947 stats\&.arenas\&.<i>\&.small\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1949 Cumulative number of times a small allocation was returned to the arena\*(Aqs bins, whether to flush the relevant tcache if
1951 is enabled, or to directly deallocate an allocation otherwise\&.
1954 stats\&.arenas\&.<i>\&.small\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1956 Cumulative number of allocation requests satisfied by all bin size classes\&.
1959 stats\&.arenas\&.<i>\&.large\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1961 Number of bytes currently allocated by large objects\&.
1964 stats\&.arenas\&.<i>\&.large\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1966 Cumulative number of times a large extent was allocated from the arena, whether to fill the relevant tcache if
1968 is enabled and the size class is within the range being cached, or to directly satisfy an allocation request otherwise\&.
1971 stats\&.arenas\&.<i>\&.large\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1973 Cumulative number of times a large extent was returned to the arena, whether to flush the relevant tcache if
1975 is enabled and the size class is within the range being cached, or to directly deallocate an allocation otherwise\&.
1978 stats\&.arenas\&.<i>\&.large\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1980 Cumulative number of allocation requests satisfied by all large size classes\&.
1983 stats\&.arenas\&.<i>\&.bins\&.<j>\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1985 Cumulative number of times a bin region of the corresponding size class was allocated from the arena, whether to fill the relevant tcache if
1987 is enabled, or to directly satisfy an allocation request otherwise\&.
1990 stats\&.arenas\&.<i>\&.bins\&.<j>\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1992 Cumulative number of times a bin region of the corresponding size class was returned to the arena, whether to flush the relevant tcache if
1994 is enabled, or to directly deallocate an allocation otherwise\&.
1997 stats\&.arenas\&.<i>\&.bins\&.<j>\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1999 Cumulative number of allocation requests satisfied by bin regions of the corresponding size class\&.
2002 stats\&.arenas\&.<i>\&.bins\&.<j>\&.curregs (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
2004 Current number of regions for this size class\&.
2007 stats\&.arenas\&.<i>\&.bins\&.<j>\&.nfills (\fBuint64_t\fR) r\-
2009 Cumulative number of tcache fills\&.
2012 stats\&.arenas\&.<i>\&.bins\&.<j>\&.nflushes (\fBuint64_t\fR) r\-
2014 Cumulative number of tcache flushes\&.
2017 stats\&.arenas\&.<i>\&.bins\&.<j>\&.nslabs (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
2019 Cumulative number of slabs created\&.
2022 stats\&.arenas\&.<i>\&.bins\&.<j>\&.nreslabs (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
2024 Cumulative number of times the current slab from which to allocate changed\&.
2027 stats\&.arenas\&.<i>\&.bins\&.<j>\&.curslabs (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
2029 Current number of slabs\&.
2032 stats\&.arenas\&.<i>\&.bins\&.<j>\&.mutex\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2035 \fIarena\&.<i>\&.bins\&.<j>\fR
2036 mutex (arena bin scope; bin operation related)\&.
2038 is one of the counters in
2039 mutex profiling counters\&.
2042 stats\&.arenas\&.<i>\&.lextents\&.<j>\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
2044 Cumulative number of times a large extent of the corresponding size class was allocated from the arena, whether to fill the relevant tcache if
2046 is enabled and the size class is within the range being cached, or to directly satisfy an allocation request otherwise\&.
2049 stats\&.arenas\&.<i>\&.lextents\&.<j>\&.ndalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
2051 Cumulative number of times a large extent of the corresponding size class was returned to the arena, whether to flush the relevant tcache if
2053 is enabled and the size class is within the range being cached, or to directly deallocate an allocation otherwise\&.
2056 stats\&.arenas\&.<i>\&.lextents\&.<j>\&.nrequests (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
2058 Cumulative number of allocation requests satisfied by large extents of the corresponding size class\&.
2061 stats\&.arenas\&.<i>\&.lextents\&.<j>\&.curlextents (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
2063 Current number of large allocations for this size class\&.
2066 stats\&.arenas\&.<i>\&.mutexes\&.large\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2069 \fIarena\&.<i>\&.large\fR
2070 mutex (arena scope; large allocation related)\&.
2072 is one of the counters in
2073 mutex profiling counters\&.
2076 stats\&.arenas\&.<i>\&.mutexes\&.extent_avail\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2079 \fIarena\&.<i>\&.extent_avail \fR
2080 mutex (arena scope; extent avail related)\&.
2082 is one of the counters in
2083 mutex profiling counters\&.
2086 stats\&.arenas\&.<i>\&.mutexes\&.extents_dirty\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2089 \fIarena\&.<i>\&.extents_dirty \fR
2090 mutex (arena scope; dirty extents related)\&.
2092 is one of the counters in
2093 mutex profiling counters\&.
2096 stats\&.arenas\&.<i>\&.mutexes\&.extents_muzzy\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2099 \fIarena\&.<i>\&.extents_muzzy \fR
2100 mutex (arena scope; muzzy extents related)\&.
2102 is one of the counters in
2103 mutex profiling counters\&.
2106 stats\&.arenas\&.<i>\&.mutexes\&.extents_retained\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2109 \fIarena\&.<i>\&.extents_retained \fR
2110 mutex (arena scope; retained extents related)\&.
2112 is one of the counters in
2113 mutex profiling counters\&.
2116 stats\&.arenas\&.<i>\&.mutexes\&.decay_dirty\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2119 \fIarena\&.<i>\&.decay_dirty \fR
2120 mutex (arena scope; decay for dirty pages related)\&.
2122 is one of the counters in
2123 mutex profiling counters\&.
2126 stats\&.arenas\&.<i>\&.mutexes\&.decay_muzzy\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2129 \fIarena\&.<i>\&.decay_muzzy \fR
2130 mutex (arena scope; decay for muzzy pages related)\&.
2132 is one of the counters in
2133 mutex profiling counters\&.
2136 stats\&.arenas\&.<i>\&.mutexes\&.base\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2139 \fIarena\&.<i>\&.base\fR
2140 mutex (arena scope; base allocator related)\&.
2142 is one of the counters in
2143 mutex profiling counters\&.
2146 stats\&.arenas\&.<i>\&.mutexes\&.tcache_list\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR]
2149 \fIarena\&.<i>\&.tcache_list\fR
2150 mutex (arena scope; tcache to arena association related)\&. This mutex is expected to be accessed less often\&.
2152 is one of the counters in
2153 mutex profiling counters\&.
2155 .SH "HEAP PROFILE FORMAT"
2157 Although the heap profiling functionality was originally designed to be compatible with the
2159 command that is developed as part of the
2160 \m[blue]\fBgperftools package\fR\m[]\&\s-2\u[3]\d\s+2, the addition of per thread heap profiling functionality required a different heap profile format\&. The
2162 command is derived from
2163 \fBpprof\fR, with enhancements to support the heap profile format described here\&.
2165 In the following hypothetical heap profile,
2167 indicates elision for the sake of compactness\&.
2174 t*: 28106: 56637512 [0: 0]
2176 t3: 352: 16777344 [0: 0]
2178 t99: 17754: 29341640 [0: 0]
2180 @ 0x5f86da8 0x5f5a1dc [\&.\&.\&.] 0x29e4d4e 0xa200316 0xabb2988 [\&.\&.\&.]
2193 The following matches the above heap profile, but most tokens are replaced with
2195 to indicate descriptions of the corresponding fields\&.
2201 <heap_profile_format_version>/<mean_sample_interval>
2202 <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
2204 <thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
2206 <thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
2208 @ <top_frame> <frame> [\&.\&.\&.] <frame> <frame> <frame> [\&.\&.\&.]
2209 <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
2210 <backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
2211 <backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
2220 .SH "DEBUGGING MALLOC PROBLEMS"
2222 When debugging, it is a good idea to configure/build jemalloc with the
2223 \fB\-\-enable\-debug\fR
2225 \fB\-\-enable\-fill\fR
2226 options, and recompile the program with suitable options and symbols for debugger support\&. When so configured, jemalloc incorporates a wide variety of run\-time assertions that catch application errors such as double\-free, write\-after\-free, etc\&.
2228 Programs often accidentally depend on
2229 \(lquninitialized\(rq
2230 memory actually being filled with zero bytes\&. Junk filling (see the
2232 option) tends to expose such bugs in the form of obviously incorrect results and/or coredumps\&. Conversely, zero filling (see the
2234 option) eliminates the symptoms of such bugs\&. Between these two options, it is usually possible to quickly detect, diagnose, and eliminate such bugs\&.
2236 This implementation does not provide much detail about the problems it detects, because the performance impact for storing such information would be prohibitive\&.
2237 .SH "DIAGNOSTIC MESSAGES"
2239 If any of the memory allocation/deallocation functions detect an error or warning condition, a message will be printed to file descriptor
2240 \fBSTDERR_FILENO\fR\&. Errors will result in the process dumping core\&. If the
2242 option is set, most warnings are treated as errors\&.
2245 \fImalloc_message\fR
2246 variable allows the programmer to override the function which emits the text strings forming the errors and warnings if for some reason the
2248 file descriptor is not suitable for this\&.
2252 pointer argument that is
2254 unless overridden by the arguments in a call to
2255 malloc_stats_print(), followed by a string pointer\&. Please note that doing anything which tries to allocate memory in this function is likely to result in a crash or deadlock\&.
2257 All messages are prefixed by
2258 \(lq<jemalloc>: \(rq\&.
2266 functions return a pointer to the allocated memory if successful; otherwise a
2268 pointer is returned and
2275 function returns the value 0 if successful; otherwise it returns an error value\&. The
2277 function will fail if:
2283 parameter is not a power of 2 at least as large as
2284 sizeof(\fBvoid *\fR)\&.
2289 Memory allocation error\&.
2294 function returns a pointer to the allocated memory if successful; otherwise a
2296 pointer is returned and
2300 function will fail if:
2306 parameter is not a power of 2\&.
2311 Memory allocation error\&.
2316 function returns a pointer, possibly identical to
2317 \fIptr\fR, to the allocated memory if successful; otherwise a
2319 pointer is returned, and
2323 if the error was the result of an allocation failure\&. The
2325 function always leaves the original buffer intact when an error occurs\&.
2329 function returns no value\&.
2330 .SS "Non\-standard API"
2336 functions return a pointer to the allocated memory if successful; otherwise a
2338 pointer is returned to indicate insufficient contiguous memory was available to service the allocation request\&.
2342 function returns the real size of the resulting resized allocation pointed to by
2343 \fIptr\fR, which is a value less than
2345 if the allocation could not be adequately grown in place\&.
2349 function returns the real size of the allocation pointed to by
2354 returns the real size that would result from a successful equivalent
2356 function call, or zero if insufficient memory is available to perform the size computation\&.
2360 mallctlnametomib(), and
2362 functions return 0 on success; otherwise they return an error value\&. The functions will fail if:
2370 is too large or too small\&. Alternatively,
2372 is too large or too small; in this case as much data as possible are read despite the error\&.
2380 specifies an unknown/invalid value\&.
2385 Attempt to read or write void value, or attempt to write read\-only value\&.
2390 A memory allocation failure occurred\&.
2395 An interface with side effects failed in some way not directly related to
2397 read/write processing\&.
2401 malloc_usable_size()
2402 function returns the usable size of the allocation pointed to by
2406 The following environment variable affects the execution of the allocation functions:
2410 If the environment variable
2412 is set, the characters it contains will be interpreted as options\&.
2416 To dump core whenever a problem occurs:
2422 ln \-s \*(Aqabort:true\*(Aq /etc/malloc\&.conf
2428 To specify in the source that only one arena should be automatically created:
2434 malloc_conf = "narenas:1";
2447 \fBgetpagesize\fR(3)
2455 functions conform to ISO/IEC 9899:1990 (\(lqISO C90\(rq)\&.
2459 function conforms to IEEE Std 1003\&.1\-2001 (\(lqPOSIX\&.1\(rq)\&.
2463 malloc_usable_size()
2466 functions first appeared in FreeBSD 7\&.0\&.
2470 malloc_stats_print(), and
2472 functions first appeared in FreeBSD 10\&.0\&.
2476 functions first appeared in FreeBSD 11\&.0\&.
2486 \%http://jemalloc.net/
2491 \%http://www.json.org/
2496 \%http://code.google.com/p/gperftools/