]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/jemalloc/doc/jemalloc.3
MFV r304060:
[FreeBSD/FreeBSD.git] / contrib / jemalloc / doc / jemalloc.3
1 '\" t
2 .\"     Title: JEMALLOC
3 .\"    Author: Jason Evans
4 .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5 .\"      Date: 06/08/2016
6 .\"    Manual: User Manual
7 .\"    Source: jemalloc 4.2.1-0-g3de035335255d553bdb344c32ffdb603816195d8
8 .\"  Language: English
9 .\"
10 .TH "JEMALLOC" "3" "06/08/2016" "jemalloc 4.2.1-0-g3de035335255" "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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 jemalloc \- general purpose memory allocation functions
32 .SH "LIBRARY"
33 .PP
34 This manual describes jemalloc 4\&.2\&.1\-0\-g3de035335255d553bdb344c32ffdb603816195d8\&. More information can be found at the
35 \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&.
36 .PP
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\-munmap\fR,
41 \fB\-\-enable\-stats\fR,
42 \fB\-\-enable\-tcache\fR,
43 \fB\-\-enable\-tls\fR,
44 \fB\-\-enable\-utrace\fR, and
45 \fB\-\-enable\-xmalloc\fR\&. Additionally,
46 \fB\-\-enable\-debug\fR
47 is enabled in development versions of FreeBSD (controlled by the
48 \fBMALLOC_PRODUCTION\fR
49 make variable)\&.
50 .SH "SYNOPSIS"
51 .sp
52 .ft B
53 .nf
54 #include <stdlib\&.h>
55 #include <malloc_np\&.h>
56 .fi
57 .ft
58 .SS "Standard API"
59 .HP \w'void\ *malloc('u
60 .BI "void *malloc(size_t\ " "size" ");"
61 .HP \w'void\ *calloc('u
62 .BI "void *calloc(size_t\ " "number" ", size_t\ " "size" ");"
63 .HP \w'int\ posix_memalign('u
64 .BI "int posix_memalign(void\ **" "ptr" ", size_t\ " "alignment" ", size_t\ " "size" ");"
65 .HP \w'void\ *aligned_alloc('u
66 .BI "void *aligned_alloc(size_t\ " "alignment" ", size_t\ " "size" ");"
67 .HP \w'void\ *realloc('u
68 .BI "void *realloc(void\ *" "ptr" ", size_t\ " "size" ");"
69 .HP \w'void\ free('u
70 .BI "void free(void\ *" "ptr" ");"
71 .SS "Non\-standard API"
72 .HP \w'void\ *mallocx('u
73 .BI "void *mallocx(size_t\ " "size" ", int\ " "flags" ");"
74 .HP \w'void\ *rallocx('u
75 .BI "void *rallocx(void\ *" "ptr" ", size_t\ " "size" ", int\ " "flags" ");"
76 .HP \w'size_t\ xallocx('u
77 .BI "size_t xallocx(void\ *" "ptr" ", size_t\ " "size" ", size_t\ " "extra" ", int\ " "flags" ");"
78 .HP \w'size_t\ sallocx('u
79 .BI "size_t sallocx(void\ *" "ptr" ", int\ " "flags" ");"
80 .HP \w'void\ dallocx('u
81 .BI "void dallocx(void\ *" "ptr" ", int\ " "flags" ");"
82 .HP \w'void\ sdallocx('u
83 .BI "void sdallocx(void\ *" "ptr" ", size_t\ " "size" ", int\ " "flags" ");"
84 .HP \w'size_t\ nallocx('u
85 .BI "size_t nallocx(size_t\ " "size" ", int\ " "flags" ");"
86 .HP \w'int\ mallctl('u
87 .BI "int mallctl(const\ char\ *" "name" ", void\ *" "oldp" ", size_t\ *" "oldlenp" ", void\ *" "newp" ", size_t\ " "newlen" ");"
88 .HP \w'int\ mallctlnametomib('u
89 .BI "int mallctlnametomib(const\ char\ *" "name" ", size_t\ *" "mibp" ", size_t\ *" "miblenp" ");"
90 .HP \w'int\ mallctlbymib('u
91 .BI "int mallctlbymib(const\ size_t\ *" "mib" ", size_t\ " "miblen" ", void\ *" "oldp" ", size_t\ *" "oldlenp" ", void\ *" "newp" ", size_t\ " "newlen" ");"
92 .HP \w'void\ malloc_stats_print('u
93 .BI "void malloc_stats_print(void\ " "(*write_cb)" "\ (void\ *,\ const\ char\ *), void\ *" "cbopaque" ", const\ char\ *" "opts" ");"
94 .HP \w'size_t\ malloc_usable_size('u
95 .BI "size_t malloc_usable_size(const\ void\ *" "ptr" ");"
96 .HP \w'void\ (*malloc_message)('u
97 .BI "void (*malloc_message)(void\ *" "cbopaque" ", const\ char\ *" "s" ");"
98 .PP
99 const char *\fImalloc_conf\fR;
100 .SH "DESCRIPTION"
101 .SS "Standard API"
102 .PP
103 The
104 \fBmalloc\fR\fB\fR
105 function allocates
106 \fIsize\fR
107 bytes of uninitialized memory\&. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object\&.
108 .PP
109 The
110 \fBcalloc\fR\fB\fR
111 function allocates space for
112 \fInumber\fR
113 objects, each
114 \fIsize\fR
115 bytes in length\&. The result is identical to calling
116 \fBmalloc\fR\fB\fR
117 with an argument of
118 \fInumber\fR
119 *
120 \fIsize\fR, with the exception that the allocated memory is explicitly initialized to zero bytes\&.
121 .PP
122 The
123 \fBposix_memalign\fR\fB\fR
124 function allocates
125 \fIsize\fR
126 bytes of memory such that the allocation\*(Aqs base address is a multiple of
127 \fIalignment\fR, and returns the allocation in the value pointed to by
128 \fIptr\fR\&. The requested
129 \fIalignment\fR
130 must be a power of 2 at least as large as
131 sizeof(\fBvoid *\fR)\&.
132 .PP
133 The
134 \fBaligned_alloc\fR\fB\fR
135 function allocates
136 \fIsize\fR
137 bytes of memory such that the allocation\*(Aqs base address is a multiple of
138 \fIalignment\fR\&. The requested
139 \fIalignment\fR
140 must be a power of 2\&. Behavior is undefined if
141 \fIsize\fR
142 is not an integral multiple of
143 \fIalignment\fR\&.
144 .PP
145 The
146 \fBrealloc\fR\fB\fR
147 function changes the size of the previously allocated memory referenced by
148 \fIptr\fR
149 to
150 \fIsize\fR
151 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
152 \fIptr\fR
153 is freed and a pointer to the newly allocated memory is returned\&. Note that
154 \fBrealloc\fR\fB\fR
155 may move the memory allocation, resulting in a different return value than
156 \fIptr\fR\&. If
157 \fIptr\fR
158 is
159 \fBNULL\fR, the
160 \fBrealloc\fR\fB\fR
161 function behaves identically to
162 \fBmalloc\fR\fB\fR
163 for the specified size\&.
164 .PP
165 The
166 \fBfree\fR\fB\fR
167 function causes the allocated memory referenced by
168 \fIptr\fR
169 to be made available for future allocations\&. If
170 \fIptr\fR
171 is
172 \fBNULL\fR, no action occurs\&.
173 .SS "Non\-standard API"
174 .PP
175 The
176 \fBmallocx\fR\fB\fR,
177 \fBrallocx\fR\fB\fR,
178 \fBxallocx\fR\fB\fR,
179 \fBsallocx\fR\fB\fR,
180 \fBdallocx\fR\fB\fR,
181 \fBsdallocx\fR\fB\fR, and
182 \fBnallocx\fR\fB\fR
183 functions all have a
184 \fIflags\fR
185 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:
186 .PP
187 \fBMALLOCX_LG_ALIGN(\fR\fB\fIla\fR\fR\fB) \fR
188 .RS 4
189 Align the memory allocation to start at an address that is a multiple of
190 (1 << \fIla\fR)\&. This macro does not validate that
191 \fIla\fR
192 is within the valid range\&.
193 .RE
194 .PP
195 \fBMALLOCX_ALIGN(\fR\fB\fIa\fR\fR\fB) \fR
196 .RS 4
197 Align the memory allocation to start at an address that is a multiple of
198 \fIa\fR, where
199 \fIa\fR
200 is a power of two\&. This macro does not validate that
201 \fIa\fR
202 is a power of 2\&.
203 .RE
204 .PP
205 \fBMALLOCX_ZERO\fR
206 .RS 4
207 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 .RE
209 .PP
210 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB) \fR
211 .RS 4
212 Use the thread\-specific cache (tcache) specified by the identifier
213 \fItc\fR, which must have been acquired via the
214 "tcache\&.create"
215 mallctl\&. This macro does not validate that
216 \fItc\fR
217 specifies a valid identifier\&.
218 .RE
219 .PP
220 \fBMALLOCX_TCACHE_NONE\fR
221 .RS 4
222 Do not use a thread\-specific cache (tcache)\&. Unless
223 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR
224 or
225 \fBMALLOCX_TCACHE_NONE\fR
226 is specified, an automatically managed tcache will be used under many circumstances\&. This macro cannot be used in the same
227 \fIflags\fR
228 argument as
229 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR\&.
230 .RE
231 .PP
232 \fBMALLOCX_ARENA(\fR\fB\fIa\fR\fR\fB) \fR
233 .RS 4
234 Use the arena specified by the index
235 \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
236 \fIa\fR
237 specifies an arena index in the valid range\&.
238 .RE
239 .PP
240 The
241 \fBmallocx\fR\fB\fR
242 function allocates at least
243 \fIsize\fR
244 bytes of memory, and returns a pointer to the base address of the allocation\&. Behavior is undefined if
245 \fIsize\fR
246 is
247 \fB0\fR\&.
248 .PP
249 The
250 \fBrallocx\fR\fB\fR
251 function resizes the allocation at
252 \fIptr\fR
253 to be at least
254 \fIsize\fR
255 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
256 \fIsize\fR
257 is
258 \fB0\fR\&.
259 .PP
260 The
261 \fBxallocx\fR\fB\fR
262 function resizes the allocation at
263 \fIptr\fR
264 in place to be at least
265 \fIsize\fR
266 bytes, and returns the real size of the allocation\&. If
267 \fIextra\fR
268 is non\-zero, an attempt is made to resize the allocation to be at least
269 (\fIsize\fR + \fIextra\fR)
270 bytes, though inability to allocate the extra byte(s) will not by itself result in failure to resize\&. Behavior is undefined if
271 \fIsize\fR
272 is
273 \fB0\fR, or if
274 (\fIsize\fR + \fIextra\fR > \fBSIZE_T_MAX\fR)\&.
275 .PP
276 The
277 \fBsallocx\fR\fB\fR
278 function returns the real size of the allocation at
279 \fIptr\fR\&.
280 .PP
281 The
282 \fBdallocx\fR\fB\fR
283 function causes the memory referenced by
284 \fIptr\fR
285 to be made available for future allocations\&.
286 .PP
287 The
288 \fBsdallocx\fR\fB\fR
289 function is an extension of
290 \fBdallocx\fR\fB\fR
291 with a
292 \fIsize\fR
293 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
294 \fBnallocx\fR\fB\fR
295 or
296 \fBsallocx\fR\fB\fR\&.
297 .PP
298 The
299 \fBnallocx\fR\fB\fR
300 function allocates no memory, but it performs the same size computation as the
301 \fBmallocx\fR\fB\fR
302 function, and returns the real size of the allocation that would result from the equivalent
303 \fBmallocx\fR\fB\fR
304 function call, or
305 \fB0\fR
306 if the inputs exceed the maximum supported size class and/or alignment\&. Behavior is undefined if
307 \fIsize\fR
308 is
309 \fB0\fR\&.
310 .PP
311 The
312 \fBmallctl\fR\fB\fR
313 function provides a general interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions\&. The period\-separated
314 \fIname\fR
315 argument specifies a location in a tree\-structured namespace; see the
316 MALLCTL NAMESPACE
317 section for documentation on the tree contents\&. To read a value, pass a pointer via
318 \fIoldp\fR
319 to adequate space to contain the value, and a pointer to its length via
320 \fIoldlenp\fR; otherwise pass
321 \fBNULL\fR
322 and
323 \fBNULL\fR\&. Similarly, to write a value, pass a pointer to the value via
324 \fInewp\fR, and its length via
325 \fInewlen\fR; otherwise pass
326 \fBNULL\fR
327 and
328 \fB0\fR\&.
329 .PP
330 The
331 \fBmallctlnametomib\fR\fB\fR
332 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 \(lqManagement Information Base\(rq (MIB) that can be passed repeatedly to
333 \fBmallctlbymib\fR\fB\fR\&. Upon successful return from
334 \fBmallctlnametomib\fR\fB\fR,
335 \fImibp\fR
336 contains an array of
337 \fI*miblenp\fR
338 integers, where
339 \fI*miblenp\fR
340 is the lesser of the number of components in
341 \fIname\fR
342 and the input value of
343 \fI*miblenp\fR\&. Thus it is possible to pass a
344 \fI*miblenp\fR
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:
347 .sp
348 .if n \{\
349 .RS 4
350 .\}
351 .nf
352 unsigned nbins, i;
353 size_t mib[4];
354 size_t len, miblen;
355
356 len = sizeof(nbins);
357 mallctl("arenas\&.nbins", &nbins, &len, NULL, 0);
358
359 miblen = 4;
360 mallctlnametomib("arenas\&.bin\&.0\&.size", mib, &miblen);
361 for (i = 0; i < nbins; i++) {
362         size_t bin_size;
363
364         mib[2] = i;
365         len = sizeof(bin_size);
366         mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0);
367         /* Do something with bin_size\&.\&.\&. */
368 }
369 .fi
370 .if n \{\
371 .RE
372 .\}
373 .PP
374 The
375 \fBmalloc_stats_print\fR\fB\fR
376 function writes human\-readable summary statistics via the
377 \fIwrite_cb\fR
378 callback function pointer and
379 \fIcbopaque\fR
380 data passed to
381 \fIwrite_cb\fR, or
382 \fBmalloc_message\fR\fB\fR
383 if
384 \fIwrite_cb\fR
385 is
386 \fBNULL\fR\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying "g" as a character within the
387 \fIopts\fR
388 string\&. Note that
389 \fBmalloc_message\fR\fB\fR
390 uses the
391 \fBmallctl*\fR\fB\fR
392 functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If
393 \fB\-\-enable\-stats\fR
394 is specified during configuration, \(lqm\(rq and \(lqa\(rq can be specified to omit merged arena and per arena statistics, respectively; \(lqb\(rq, \(lql\(rq, and \(lqh\(rq can be specified to omit per size class statistics for bins, large objects, and huge objects, respectively\&. 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\&.
395 .PP
396 The
397 \fBmalloc_usable_size\fR\fB\fR
398 function returns the usable size of the allocation pointed to by
399 \fIptr\fR\&. The return value may be larger than the size that was requested during allocation\&. The
400 \fBmalloc_usable_size\fR\fB\fR
401 function is not a mechanism for in\-place
402 \fBrealloc\fR\fB\fR; rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by
403 \fBmalloc_usable_size\fR\fB\fR
404 should not be depended on, since such behavior is entirely implementation\-dependent\&.
405 .SH "TUNING"
406 .PP
407 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\&.
408 .PP
409 The string specified via
410 \fB\-\-with\-malloc\-conf\fR, the string pointed to by the global variable
411 \fImalloc_conf\fR, the \(lqname\(rq of the file referenced by the symbolic link named
412 /etc/malloc\&.conf, and the value of the environment variable
413 \fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. Note that
414 \fImalloc_conf\fR
415 may be read before
416 \fBmain\fR\fB\fR
417 is entered, so the declaration of
418 \fImalloc_conf\fR
419 should specify an initializer that contains the final value to be read by jemalloc\&.
420 \fB\-\-with\-malloc\-conf\fR
421 and
422 \fImalloc_conf\fR
423 are compile\-time mechanisms, whereas
424 /etc/malloc\&.conf
425 and
426 \fBMALLOC_CONF\fR
427 can be safely set any time prior to program invocation\&.
428 .PP
429 An options string is a comma\-separated list of option:value pairs\&. There is one key corresponding to each
430 "opt\&.*"
431 mallctl (see the
432 MALLCTL NAMESPACE
433 section for options documentation)\&. For example,
434 abort:true,narenas:1
435 sets the
436 "opt\&.abort"
437 and
438 "opt\&.narenas"
439 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\&.
440 .SH "IMPLEMENTATION NOTES"
441 .PP
442 Traditionally, allocators have used
443 \fBsbrk\fR(2)
444 to obtain memory, which is suboptimal for several reasons, including race conditions, increased fragmentation, and artificial limitations on maximum usable memory\&. If
445 \fBsbrk\fR(2)
446 is supported by the operating system, this allocator uses both
447 \fBmmap\fR(2)
448 and
449 \fBsbrk\fR(2), in that order of preference; otherwise only
450 \fBmmap\fR(2)
451 is used\&.
452 .PP
453 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\&.
454 .PP
455 In addition to multiple arenas, unless
456 \fB\-\-disable\-tcache\fR
457 is specified during configuration, this allocator supports thread\-specific caching for small and large objects, 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\&.
458 .PP
459 Memory is conceptually broken into equal\-sized chunks, where the chunk size is a power of two that is greater than the page size\&. Chunks are always aligned to multiples of the chunk size\&. This alignment makes it possible to find metadata for user objects very quickly\&. User objects are broken into three categories according to size: small, large, and huge\&. Multiple small and large objects can reside within a single chunk, whereas huge objects each have one or more chunks backing them\&. Each chunk that contains small and/or large objects tracks its contents as runs of contiguous pages (unused, backing a set of small objects, or backing one large object)\&. The combination of chunk alignment and chunk page maps makes it possible to determine all metadata regarding small and large allocations in constant time\&.
460 .PP
461 Small objects are managed in groups by page runs\&. Each run 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
462 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, large size classes are smaller than the chunk size (see the
463 "opt\&.lg_chunk"
464 option), and huge size classes extend from the chunk size up to the largest size class that does not exceed
465 \fBPTRDIFF_MAX\fR\&.
466 .PP
467 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\&.
468 .PP
469 The
470 \fBrealloc\fR\fB\fR,
471 \fBrallocx\fR\fB\fR, and
472 \fBxallocx\fR\fB\fR
473 functions may resize allocations without moving them under limited circumstances\&. Unlike the
474 \fB*allocx\fR\fB\fR
475 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
476 \fBrealloc\fR\fB\fR
477 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 and huge allocations in place, as long as the pre\-size and post\-size are both large or both huge\&. In such cases shrinkage always succeeds for large size classes, but for huge size classes the chunk allocator must support splitting (see
478 "arena\&.<i>\&.chunk_hooks")\&. Growth only succeeds if the trailing memory is currently available, and additionally for huge size classes the chunk allocator must support merging\&.
479 .PP
480 Assuming 2 MiB chunks, 4 KiB pages, and a 16\-byte quantum on a 64\-bit system, the size classes in each category are as shown in
481 Table 1\&.
482 .sp
483 .it 1 an-trap
484 .nr an-no-space-flag 1
485 .nr an-break-flag 1
486 .br
487 .B Table\ \&1.\ \&Size classes
488 .TS
489 allbox tab(:);
490 lB rB lB.
491 T{
492 Category
493 T}:T{
494 Spacing
495 T}:T{
496 Size
497 T}
498 .T&
499 l r l
500 ^ r l
501 ^ r l
502 ^ r l
503 ^ r l
504 ^ r l
505 ^ r l
506 ^ r l
507 ^ r l
508 l r l
509 ^ r l
510 ^ r l
511 ^ r l
512 ^ r l
513 ^ r l
514 ^ r l
515 ^ r l
516 l r l
517 ^ r l
518 ^ r l
519 ^ r l
520 ^ r l
521 ^ r l
522 ^ r l
523 ^ r l
524 ^ r l.
525 T{
526 Small
527 T}:T{
528 lg
529 T}:T{
530 [8]
531 T}
532 :T{
533 16
534 T}:T{
535 [16, 32, 48, 64, 80, 96, 112, 128]
536 T}
537 :T{
538 32
539 T}:T{
540 [160, 192, 224, 256]
541 T}
542 :T{
543 64
544 T}:T{
545 [320, 384, 448, 512]
546 T}
547 :T{
548 128
549 T}:T{
550 [640, 768, 896, 1024]
551 T}
552 :T{
553 256
554 T}:T{
555 [1280, 1536, 1792, 2048]
556 T}
557 :T{
558 512
559 T}:T{
560 [2560, 3072, 3584, 4096]
561 T}
562 :T{
563 1 KiB
564 T}:T{
565 [5 KiB, 6 KiB, 7 KiB, 8 KiB]
566 T}
567 :T{
568 2 KiB
569 T}:T{
570 [10 KiB, 12 KiB, 14 KiB]
571 T}
572 T{
573 Large
574 T}:T{
575 2 KiB
576 T}:T{
577 [16 KiB]
578 T}
579 :T{
580 4 KiB
581 T}:T{
582 [20 KiB, 24 KiB, 28 KiB, 32 KiB]
583 T}
584 :T{
585 8 KiB
586 T}:T{
587 [40 KiB, 48 KiB, 54 KiB, 64 KiB]
588 T}
589 :T{
590 16 KiB
591 T}:T{
592 [80 KiB, 96 KiB, 112 KiB, 128 KiB]
593 T}
594 :T{
595 32 KiB
596 T}:T{
597 [160 KiB, 192 KiB, 224 KiB, 256 KiB]
598 T}
599 :T{
600 64 KiB
601 T}:T{
602 [320 KiB, 384 KiB, 448 KiB, 512 KiB]
603 T}
604 :T{
605 128 KiB
606 T}:T{
607 [640 KiB, 768 KiB, 896 KiB, 1 MiB]
608 T}
609 :T{
610 256 KiB
611 T}:T{
612 [1280 KiB, 1536 KiB, 1792 KiB]
613 T}
614 T{
615 Huge
616 T}:T{
617 256 KiB
618 T}:T{
619 [2 MiB]
620 T}
621 :T{
622 512 KiB
623 T}:T{
624 [2560 KiB, 3 MiB, 3584 KiB, 4 MiB]
625 T}
626 :T{
627 1 MiB
628 T}:T{
629 [5 MiB, 6 MiB, 7 MiB, 8 MiB]
630 T}
631 :T{
632 2 MiB
633 T}:T{
634 [10 MiB, 12 MiB, 14 MiB, 16 MiB]
635 T}
636 :T{
637 4 MiB
638 T}:T{
639 [20 MiB, 24 MiB, 28 MiB, 32 MiB]
640 T}
641 :T{
642 8 MiB
643 T}:T{
644 [40 MiB, 48 MiB, 56 MiB, 64 MiB]
645 T}
646 :T{
647 \&.\&.\&.
648 T}:T{
649 \&.\&.\&.
650 T}
651 :T{
652 512 PiB
653 T}:T{
654 [2560 PiB, 3 EiB, 3584 PiB, 4 EiB]
655 T}
656 :T{
657 1 EiB
658 T}:T{
659 [5 EiB, 6 EiB, 7 EiB]
660 T}
661 .TE
662 .sp 1
663 .SH "MALLCTL NAMESPACE"
664 .PP
665 The following names are defined in the namespace accessible via the
666 \fBmallctl*\fR\fB\fR
667 functions\&. Value types are specified in parentheses, their readable/writable statuses are encoded as
668 rw,
669 r\-,
670 \-w, or
671 \-\-, and required build configuration flags follow, if any\&. A name element encoded as
672 <i>
673 or
674 <j>
675 indicates an integer component, where the integer varies from 0 to some upper value that must be determined via introspection\&. In the case of
676 "stats\&.arenas\&.<i>\&.*",
677 <i>
678 equal to
679 "arenas\&.narenas"
680 can be used to access the summation of statistics from all arenas\&. Take special note of the
681 "epoch"
682 mallctl, which controls refreshing of cached dynamic statistics\&.
683 .PP
684 "version" (\fBconst char *\fR) r\-
685 .RS 4
686 Return the jemalloc version string\&.
687 .RE
688 .PP
689 "epoch" (\fBuint64_t\fR) rw
690 .RS 4
691 If a value is passed in, refresh the data from which the
692 \fBmallctl*\fR\fB\fR
693 functions report values, and increment the epoch\&. Return the current epoch\&. This is useful for detecting whether another thread caused a refresh\&.
694 .RE
695 .PP
696 "config\&.cache_oblivious" (\fBbool\fR) r\-
697 .RS 4
698 \fB\-\-enable\-cache\-oblivious\fR
699 was specified during build configuration\&.
700 .RE
701 .PP
702 "config\&.debug" (\fBbool\fR) r\-
703 .RS 4
704 \fB\-\-enable\-debug\fR
705 was specified during build configuration\&.
706 .RE
707 .PP
708 "config\&.fill" (\fBbool\fR) r\-
709 .RS 4
710 \fB\-\-enable\-fill\fR
711 was specified during build configuration\&.
712 .RE
713 .PP
714 "config\&.lazy_lock" (\fBbool\fR) r\-
715 .RS 4
716 \fB\-\-enable\-lazy\-lock\fR
717 was specified during build configuration\&.
718 .RE
719 .PP
720 "config\&.malloc_conf" (\fBconst char *\fR) r\-
721 .RS 4
722 Embedded configure\-time\-specified run\-time options string, empty unless
723 \fB\-\-with\-malloc\-conf\fR
724 was specified during build configuration\&.
725 .RE
726 .PP
727 "config\&.munmap" (\fBbool\fR) r\-
728 .RS 4
729 \fB\-\-enable\-munmap\fR
730 was specified during build configuration\&.
731 .RE
732 .PP
733 "config\&.prof" (\fBbool\fR) r\-
734 .RS 4
735 \fB\-\-enable\-prof\fR
736 was specified during build configuration\&.
737 .RE
738 .PP
739 "config\&.prof_libgcc" (\fBbool\fR) r\-
740 .RS 4
741 \fB\-\-disable\-prof\-libgcc\fR
742 was not specified during build configuration\&.
743 .RE
744 .PP
745 "config\&.prof_libunwind" (\fBbool\fR) r\-
746 .RS 4
747 \fB\-\-enable\-prof\-libunwind\fR
748 was specified during build configuration\&.
749 .RE
750 .PP
751 "config\&.stats" (\fBbool\fR) r\-
752 .RS 4
753 \fB\-\-enable\-stats\fR
754 was specified during build configuration\&.
755 .RE
756 .PP
757 "config\&.tcache" (\fBbool\fR) r\-
758 .RS 4
759 \fB\-\-disable\-tcache\fR
760 was not specified during build configuration\&.
761 .RE
762 .PP
763 "config\&.tls" (\fBbool\fR) r\-
764 .RS 4
765 \fB\-\-disable\-tls\fR
766 was not specified during build configuration\&.
767 .RE
768 .PP
769 "config\&.utrace" (\fBbool\fR) r\-
770 .RS 4
771 \fB\-\-enable\-utrace\fR
772 was specified during build configuration\&.
773 .RE
774 .PP
775 "config\&.valgrind" (\fBbool\fR) r\-
776 .RS 4
777 \fB\-\-enable\-valgrind\fR
778 was specified during build configuration\&.
779 .RE
780 .PP
781 "config\&.xmalloc" (\fBbool\fR) r\-
782 .RS 4
783 \fB\-\-enable\-xmalloc\fR
784 was specified during build configuration\&.
785 .RE
786 .PP
787 "opt\&.abort" (\fBbool\fR) r\-
788 .RS 4
789 Abort\-on\-warning enabled/disabled\&. If true, most warnings are fatal\&. The process will call
790 \fBabort\fR(3)
791 in these cases\&. This option is disabled by default unless
792 \fB\-\-enable\-debug\fR
793 is specified during configuration, in which case it is enabled by default\&.
794 .RE
795 .PP
796 "opt\&.dss" (\fBconst char *\fR) r\-
797 .RS 4
798 dss (\fBsbrk\fR(2)) allocation precedence as related to
799 \fBmmap\fR(2)
800 allocation\&. The following settings are supported if
801 \fBsbrk\fR(2)
802 is supported by the operating system: \(lqdisabled\(rq, \(lqprimary\(rq, and \(lqsecondary\(rq; otherwise only \(lqdisabled\(rq is supported\&. The default is \(lqsecondary\(rq if
803 \fBsbrk\fR(2)
804 is supported by the operating system; \(lqdisabled\(rq otherwise\&.
805 .RE
806 .PP
807 "opt\&.lg_chunk" (\fBsize_t\fR) r\-
808 .RS 4
809 Virtual memory chunk size (log base 2)\&. If a chunk size outside the supported size range is specified, the size is silently clipped to the minimum/maximum supported size\&. The default chunk size is 2 MiB (2^21)\&.
810 .RE
811 .PP
812 "opt\&.narenas" (\fBunsigned\fR) r\-
813 .RS 4
814 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\&.
815 .RE
816 .PP
817 "opt\&.purge" (\fBconst char *\fR) r\-
818 .RS 4
819 Purge mode is \(lqratio\(rq (default) or \(lqdecay\(rq\&. See
820 "opt\&.lg_dirty_mult"
821 for details of the ratio mode\&. See
822 "opt\&.decay_time"
823 for details of the decay mode\&.
824 .RE
825 .PP
826 "opt\&.lg_dirty_mult" (\fBssize_t\fR) r\-
827 .RS 4
828 Per\-arena minimum ratio (log base 2) of active to dirty pages\&. Some dirty unused pages may be allowed to accumulate, within the limit set by the ratio (or one chunk worth of dirty pages, whichever is greater), before informing the kernel about some of those pages via
829 \fBmadvise\fR(2)
830 or a similar system call\&. This provides the kernel with sufficient information to recycle dirty pages if physical memory becomes scarce and the pages remain unused\&. The default minimum ratio is 8:1 (2^3:1); an option value of \-1 will disable dirty page purging\&. See
831 "arenas\&.lg_dirty_mult"
832 and
833 "arena\&.<i>\&.lg_dirty_mult"
834 for related dynamic control options\&.
835 .RE
836 .PP
837 "opt\&.decay_time" (\fBssize_t\fR) r\-
838 .RS 4
839 Approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. 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
840 "arenas\&.decay_time"
841 and
842 "arena\&.<i>\&.decay_time"
843 for related dynamic control options\&.
844 .RE
845 .PP
846 "opt\&.stats_print" (\fBbool\fR) r\-
847 .RS 4
848 Enable/disable statistics printing at exit\&. If enabled, the
849 \fBmalloc_stats_print\fR\fB\fR
850 function is called at program exit via an
851 \fBatexit\fR(3)
852 function\&. If
853 \fB\-\-enable\-stats\fR
854 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,
855 \fBatexit\fR\fB\fR
856 may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls
857 \fBatexit\fR\fB\fR, so this option is not universally usable (though the application can register its own
858 \fBatexit\fR\fB\fR
859 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\&.
860 .RE
861 .PP
862 "opt\&.junk" (\fBconst char *\fR) r\- [\fB\-\-enable\-fill\fR]
863 .RS 4
864 Junk filling\&. If set to "alloc", each byte of uninitialized allocated memory will be initialized to
865 0xa5\&. If set to "free", all deallocated memory will be initialized to
866 0x5a\&. If set to "true", both allocated and deallocated memory will be initialized, and if set to "false", junk filling be disabled entirely\&. This is intended for debugging and will impact performance negatively\&. This option is "false" by default unless
867 \fB\-\-enable\-debug\fR
868 is specified during configuration, in which case it is "true" by default unless running inside
869 \m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2\&.
870 .RE
871 .PP
872 "opt\&.quarantine" (\fBsize_t\fR) r\- [\fB\-\-enable\-fill\fR]
873 .RS 4
874 Per thread quarantine size in bytes\&. If non\-zero, each thread maintains a FIFO object quarantine that stores up to the specified number of bytes of memory\&. The quarantined memory is not freed until it is released from quarantine, though it is immediately junk\-filled if the
875 "opt\&.junk"
876 option is enabled\&. This feature is of particular use in combination with
877 \m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, which can detect attempts to access quarantined objects\&. This is intended for debugging and will impact performance negatively\&. The default quarantine size is 0 unless running inside Valgrind, in which case the default is 16 MiB\&.
878 .RE
879 .PP
880 "opt\&.redzone" (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR]
881 .RS 4
882 Redzones enabled/disabled\&. If enabled, small allocations have redzones before and after them\&. Furthermore, if the
883 "opt\&.junk"
884 option is enabled, the redzones are checked for corruption during deallocation\&. However, the primary intended purpose of this feature is to be used in combination with
885 \m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, which needs redzones in order to do effective buffer overflow/underflow detection\&. This option is intended for debugging and will impact performance negatively\&. This option is disabled by default unless running inside Valgrind\&.
886 .RE
887 .PP
888 "opt\&.zero" (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR]
889 .RS 4
890 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
891 \fBrealloc\fR\fB\fR
892 and
893 \fBrallocx\fR\fB\fR
894 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\&.
895 .RE
896 .PP
897 "opt\&.utrace" (\fBbool\fR) r\- [\fB\-\-enable\-utrace\fR]
898 .RS 4
899 Allocation tracing based on
900 \fButrace\fR(2)
901 enabled/disabled\&. This option is disabled by default\&.
902 .RE
903 .PP
904 "opt\&.xmalloc" (\fBbool\fR) r\- [\fB\-\-enable\-xmalloc\fR]
905 .RS 4
906 Abort\-on\-out\-of\-memory enabled/disabled\&. If enabled, rather than returning failure for any allocation function, display a diagnostic message on
907 \fBSTDERR_FILENO\fR
908 and cause the program to drop core (using
909 \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:
910 .sp
911 .if n \{\
912 .RS 4
913 .\}
914 .nf
915 malloc_conf = "xmalloc:true";
916 .fi
917 .if n \{\
918 .RE
919 .\}
920 .sp
921 This option is disabled by default\&.
922 .RE
923 .PP
924 "opt\&.tcache" (\fBbool\fR) r\- [\fB\-\-enable\-tcache\fR]
925 .RS 4
926 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
927 "opt\&.lg_tcache_max"
928 option for related tuning information\&. This option is enabled by default unless running inside
929 \m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, in which case it is forcefully disabled\&.
930 .RE
931 .PP
932 "opt\&.lg_tcache_max" (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR]
933 .RS 4
934 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)\&.
935 .RE
936 .PP
937 "opt\&.prof" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
938 .RS 4
939 Memory profiling enabled/disabled\&. If enabled, profile memory allocation activity\&. See the
940 "opt\&.prof_active"
941 option for on\-the\-fly activation/deactivation\&. See the
942 "opt\&.lg_prof_sample"
943 option for probabilistic sampling control\&. See the
944 "opt\&.prof_accum"
945 option for control of cumulative sample reporting\&. See the
946 "opt\&.lg_prof_interval"
947 option for information on interval\-triggered profile dumping, the
948 "opt\&.prof_gdump"
949 option for information on high\-water\-triggered profile dumping, and the
950 "opt\&.prof_final"
951 option for final profile dumping\&. Profile output is compatible with the
952 \fBjeprof\fR
953 command, which is based on the
954 \fBpprof\fR
955 that is developed as part of the
956 \m[blue]\fBgperftools package\fR\m[]\&\s-2\u[3]\d\s+2\&. See
957 HEAP PROFILE FORMAT
958 for heap profile format documentation\&.
959 .RE
960 .PP
961 "opt\&.prof_prefix" (\fBconst char *\fR) r\- [\fB\-\-enable\-prof\fR]
962 .RS 4
963 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
964 jeprof\&.
965 .RE
966 .PP
967 "opt\&.prof_active" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
968 .RS 4
969 Profiling activated/deactivated\&. This is a secondary control mechanism that makes it possible to start the application with profiling enabled (see the
970 "opt\&.prof"
971 option) but inactive, then toggle profiling at any time during program execution with the
972 "prof\&.active"
973 mallctl\&. This option is enabled by default\&.
974 .RE
975 .PP
976 "opt\&.prof_thread_active_init" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
977 .RS 4
978 Initial setting for
979 "thread\&.prof\&.active"
980 in newly created threads\&. The initial setting for newly created threads can also be changed during execution via the
981 "prof\&.thread_active_init"
982 mallctl\&. This option is enabled by default\&.
983 .RE
984 .PP
985 "opt\&.lg_prof_sample" (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR]
986 .RS 4
987 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)\&.
988 .RE
989 .PP
990 "opt\&.prof_accum" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
991 .RS 4
992 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\&.
993 .RE
994 .PP
995 "opt\&.lg_prof_interval" (\fBssize_t\fR) r\- [\fB\-\-enable\-prof\fR]
996 .RS 4
997 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
998 <prefix>\&.<pid>\&.<seq>\&.i<iseq>\&.heap, where
999 <prefix>
1000 is controlled by the
1001 "opt\&.prof_prefix"
1002 option\&. By default, interval\-triggered profile dumping is disabled (encoded as \-1)\&.
1003 .RE
1004 .PP
1005 "opt\&.prof_gdump" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1006 .RS 4
1007 Set the initial state of
1008 "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\&.
1009 .RE
1010 .PP
1011 "opt\&.prof_final" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1012 .RS 4
1013 Use an
1014 \fBatexit\fR(3)
1015 function to dump final memory usage to a file named according to the pattern
1016 <prefix>\&.<pid>\&.<seq>\&.f\&.heap, where
1017 <prefix>
1018 is controlled by the
1019 "opt\&.prof_prefix"
1020 option\&. Note that
1021 \fBatexit\fR\fB\fR
1022 may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls
1023 \fBatexit\fR\fB\fR, so this option is not universally usable (though the application can register its own
1024 \fBatexit\fR\fB\fR
1025 function with equivalent functionality)\&. This option is disabled by default\&.
1026 .RE
1027 .PP
1028 "opt\&.prof_leak" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR]
1029 .RS 4
1030 Leak reporting enabled/disabled\&. If enabled, use an
1031 \fBatexit\fR(3)
1032 function to report memory leaks detected by allocation sampling\&. See the
1033 "opt\&.prof"
1034 option for information on analyzing heap profile output\&. This option is disabled by default\&.
1035 .RE
1036 .PP
1037 "thread\&.arena" (\fBunsigned\fR) rw
1038 .RS 4
1039 Get or set the arena associated with the calling thread\&. If the specified arena was not initialized beforehand (see the
1040 "arenas\&.initialized"
1041 mallctl), it will be automatically initialized as a side effect of calling this interface\&.
1042 .RE
1043 .PP
1044 "thread\&.allocated" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1045 .RS 4
1046 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\&.
1047 .RE
1048 .PP
1049 "thread\&.allocatedp" (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR]
1050 .RS 4
1051 Get a pointer to the the value that is returned by the
1052 "thread\&.allocated"
1053 mallctl\&. This is useful for avoiding the overhead of repeated
1054 \fBmallctl*\fR\fB\fR
1055 calls\&.
1056 .RE
1057 .PP
1058 "thread\&.deallocated" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1059 .RS 4
1060 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\&.
1061 .RE
1062 .PP
1063 "thread\&.deallocatedp" (\fBuint64_t *\fR) r\- [\fB\-\-enable\-stats\fR]
1064 .RS 4
1065 Get a pointer to the the value that is returned by the
1066 "thread\&.deallocated"
1067 mallctl\&. This is useful for avoiding the overhead of repeated
1068 \fBmallctl*\fR\fB\fR
1069 calls\&.
1070 .RE
1071 .PP
1072 "thread\&.tcache\&.enabled" (\fBbool\fR) rw [\fB\-\-enable\-tcache\fR]
1073 .RS 4
1074 Enable/disable calling thread\*(Aqs tcache\&. The tcache is implicitly flushed as a side effect of becoming disabled (see
1075 "thread\&.tcache\&.flush")\&.
1076 .RE
1077 .PP
1078 "thread\&.tcache\&.flush" (\fBvoid\fR) \-\- [\fB\-\-enable\-tcache\fR]
1079 .RS 4
1080 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\&.
1081 .RE
1082 .PP
1083 "thread\&.prof\&.name" (\fBconst char *\fR) r\- or \-w [\fB\-\-enable\-prof\fR]
1084 .RS 4
1085 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
1086 \fBisgraph\fR(3)
1087 and
1088 \fBisblank\fR(3)\&.
1089 .RE
1090 .PP
1091 "thread\&.prof\&.active" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1092 .RS 4
1093 Control whether sampling is currently active for the calling thread\&. This is an activation mechanism in addition to
1094 "prof\&.active"; both must be active for the calling thread to sample\&. This flag is enabled by default\&.
1095 .RE
1096 .PP
1097 "tcache\&.create" (\fBunsigned\fR) r\- [\fB\-\-enable\-tcache\fR]
1098 .RS 4
1099 Create an explicit thread\-specific cache (tcache) and return an identifier that can be passed to the
1100 \fBMALLOCX_TCACHE(\fR\fB\fItc\fR\fR\fB)\fR
1101 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\&.
1102 .RE
1103 .PP
1104 "tcache\&.flush" (\fBunsigned\fR) \-w [\fB\-\-enable\-tcache\fR]
1105 .RS 4
1106 Flush the specified thread\-specific cache (tcache)\&. The same considerations apply to this interface as to
1107 "thread\&.tcache\&.flush", except that the tcache will never be automatically discarded\&.
1108 .RE
1109 .PP
1110 "tcache\&.destroy" (\fBunsigned\fR) \-w [\fB\-\-enable\-tcache\fR]
1111 .RS 4
1112 Flush the specified thread\-specific cache (tcache) and make the identifier available for use during a future tcache creation\&.
1113 .RE
1114 .PP
1115 "arena\&.<i>\&.purge" (\fBvoid\fR) \-\-
1116 .RS 4
1117 Purge all unused dirty pages for arena <i>, or for all arenas if <i> equals
1118 "arenas\&.narenas"\&.
1119 .RE
1120 .PP
1121 "arena\&.<i>\&.decay" (\fBvoid\fR) \-\-
1122 .RS 4
1123 Trigger decay\-based purging of unused dirty pages for arena <i>, or for all arenas if <i> equals
1124 "arenas\&.narenas"\&. The proportion of unused dirty pages to be purged depends on the current time; see
1125 "opt\&.decay_time"
1126 for details\&.
1127 .RE
1128 .PP
1129 "arena\&.<i>\&.reset" (\fBvoid\fR) \-\-
1130 .RS 4
1131 Discard all of the arena\*(Aqs extant allocations\&. This interface can only be used with arenas created via
1132 "arenas\&.extend"\&. 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\&. This interface cannot be used if running inside Valgrind, nor if the
1133 quarantine
1134 size is non\-zero\&.
1135 .RE
1136 .PP
1137 "arena\&.<i>\&.dss" (\fBconst char *\fR) rw
1138 .RS 4
1139 Set the precedence of dss allocation as related to mmap allocation for arena <i>, or for all arenas if <i> equals
1140 "arenas\&.narenas"\&. See
1141 "opt\&.dss"
1142 for supported settings\&.
1143 .RE
1144 .PP
1145 "arena\&.<i>\&.lg_dirty_mult" (\fBssize_t\fR) rw
1146 .RS 4
1147 Current per\-arena minimum ratio (log base 2) of active to dirty pages for arena <i>\&. Each time this interface is set and the ratio is increased, pages are synchronously purged as necessary to impose the new ratio\&. See
1148 "opt\&.lg_dirty_mult"
1149 for additional information\&.
1150 .RE
1151 .PP
1152 "arena\&.<i>\&.decay_time" (\fBssize_t\fR) rw
1153 .RS 4
1154 Current per\-arena approximate time in seconds 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
1155 "opt\&.decay_time"
1156 for additional information\&.
1157 .RE
1158 .PP
1159 "arena\&.<i>\&.chunk_hooks" (\fBchunk_hooks_t\fR) rw
1160 .RS 4
1161 Get or set the chunk management hook functions for arena <i>\&. The functions must be capable of operating on all extant chunks associated with arena <i>, usually by passing unknown chunks to the replaced functions\&. In practice, it is feasible to control allocation for arenas created via
1162 "arenas\&.extend"
1163 such that all chunks originate from an application\-supplied chunk allocator (by setting custom chunk hook functions just after arena creation), but the automatically created arenas may have already created chunks prior to the application having an opportunity to take over chunk allocation\&.
1164 .sp
1165 .if n \{\
1166 .RS 4
1167 .\}
1168 .nf
1169 typedef struct {
1170         chunk_alloc_t           *alloc;
1171         chunk_dalloc_t          *dalloc;
1172         chunk_commit_t          *commit;
1173         chunk_decommit_t        *decommit;
1174         chunk_purge_t           *purge;
1175         chunk_split_t           *split;
1176         chunk_merge_t           *merge;
1177 } chunk_hooks_t;
1178 .fi
1179 .if n \{\
1180 .RE
1181 .\}
1182 .sp
1183 The
1184 \fBchunk_hooks_t\fR
1185 structure comprises function pointers which are described individually below\&. jemalloc uses these functions to manage chunk 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 chunks for later reuse\&. Cleanup attempts cascade from deallocation to decommit to purging, which gives the chunk management functions opportunities to reject the most permanent cleanup operations in favor of less permanent (and often less costly) operations\&. The chunk splitting and merging operations can also be opted out of, but this is mainly intended to support platforms on which virtual memory mappings provided by the operating system kernel do not automatically coalesce and split, e\&.g\&. Windows\&.
1186 .HP \w'typedef\ void\ *(chunk_alloc_t)('u
1187 .BI "typedef void *(chunk_alloc_t)(void\ *" "chunk" ", size_t\ " "size" ", size_t\ " "alignment" ", bool\ *" "zero" ", bool\ *" "commit" ", unsigned\ " "arena_ind" ");"
1188 .sp
1189 .if n \{\
1190 .RS 4
1191 .\}
1192 .nf
1193 .fi
1194 .if n \{\
1195 .RE
1196 .\}
1197 .sp
1198 A chunk allocation function conforms to the
1199 \fBchunk_alloc_t\fR
1200 type and upon success returns a pointer to
1201 \fIsize\fR
1202 bytes of mapped memory on behalf of arena
1203 \fIarena_ind\fR
1204 such that the chunk\*(Aqs base address is a multiple of
1205 \fIalignment\fR, as well as setting
1206 \fI*zero\fR
1207 to indicate whether the chunk is zeroed and
1208 \fI*commit\fR
1209 to indicate whether the chunk is committed\&. Upon error the function returns
1210 \fBNULL\fR
1211 and leaves
1212 \fI*zero\fR
1213 and
1214 \fI*commit\fR
1215 unmodified\&. The
1216 \fIsize\fR
1217 parameter is always a multiple of the chunk size\&. The
1218 \fIalignment\fR
1219 parameter is always a power of two at least as large as the chunk size\&. Zeroing is mandatory if
1220 \fI*zero\fR
1221 is true upon function entry\&. Committing is mandatory if
1222 \fI*commit\fR
1223 is true upon function entry\&. If
1224 \fIchunk\fR
1225 is not
1226 \fBNULL\fR, the returned pointer must be
1227 \fIchunk\fR
1228 on success or
1229 \fBNULL\fR
1230 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 chunk allocation function makes the arena\*(Aqs
1231 "arena\&.<i>\&.dss"
1232 setting irrelevant\&.
1233 .HP \w'typedef\ bool\ (chunk_dalloc_t)('u
1234 .BI "typedef bool (chunk_dalloc_t)(void\ *" "chunk" ", size_t\ " "size" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1235 .sp
1236 .if n \{\
1237 .RS 4
1238 .\}
1239 .nf
1240 .fi
1241 .if n \{\
1242 .RE
1243 .\}
1244 .sp
1245 A chunk deallocation function conforms to the
1246 \fBchunk_dalloc_t\fR
1247 type and deallocates a
1248 \fIchunk\fR
1249 of given
1250 \fIsize\fR
1251 with
1252 \fIcommitted\fR/decommited memory as indicated, on behalf of arena
1253 \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 chunk remains mapped, in the same commit state, and available for future use, in which case it will be automatically retained for later reuse\&.
1254 .HP \w'typedef\ bool\ (chunk_commit_t)('u
1255 .BI "typedef bool (chunk_commit_t)(void\ *" "chunk" ", size_t\ " "size" ", size_t\ " "offset" ", size_t\ " "length" ", unsigned\ " "arena_ind" ");"
1256 .sp
1257 .if n \{\
1258 .RS 4
1259 .\}
1260 .nf
1261 .fi
1262 .if n \{\
1263 .RE
1264 .\}
1265 .sp
1266 A chunk commit function conforms to the
1267 \fBchunk_commit_t\fR
1268 type and commits zeroed physical memory to back pages within a
1269 \fIchunk\fR
1270 of given
1271 \fIsize\fR
1272 at
1273 \fIoffset\fR
1274 bytes, extending for
1275 \fIlength\fR
1276 on behalf of arena
1277 \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\&.
1278 .HP \w'typedef\ bool\ (chunk_decommit_t)('u
1279 .BI "typedef bool (chunk_decommit_t)(void\ *" "chunk" ", size_t\ " "size" ", size_t\ " "offset" ", size_t\ " "length" ", unsigned\ " "arena_ind" ");"
1280 .sp
1281 .if n \{\
1282 .RS 4
1283 .\}
1284 .nf
1285 .fi
1286 .if n \{\
1287 .RE
1288 .\}
1289 .sp
1290 A chunk decommit function conforms to the
1291 \fBchunk_decommit_t\fR
1292 type and decommits any physical memory that is backing pages within a
1293 \fIchunk\fR
1294 of given
1295 \fIsize\fR
1296 at
1297 \fIoffset\fR
1298 bytes, extending for
1299 \fIlength\fR
1300 on behalf of arena
1301 \fIarena_ind\fR, returning false upon success, in which case the pages will be committed via the chunk 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\&.
1302 .HP \w'typedef\ bool\ (chunk_purge_t)('u
1303 .BI "typedef bool (chunk_purge_t)(void\ *" "chunk" ", size_t" "size" ", size_t\ " "offset" ", size_t\ " "length" ", unsigned\ " "arena_ind" ");"
1304 .sp
1305 .if n \{\
1306 .RS 4
1307 .\}
1308 .nf
1309 .fi
1310 .if n \{\
1311 .RE
1312 .\}
1313 .sp
1314 A chunk purge function conforms to the
1315 \fBchunk_purge_t\fR
1316 type and optionally discards physical pages within the virtual memory mapping associated with
1317 \fIchunk\fR
1318 of given
1319 \fIsize\fR
1320 at
1321 \fIoffset\fR
1322 bytes, extending for
1323 \fIlength\fR
1324 on behalf of arena
1325 \fIarena_ind\fR, returning false if pages within the purged virtual memory range will be zero\-filled the next time they are accessed\&.
1326 .HP \w'typedef\ bool\ (chunk_split_t)('u
1327 .BI "typedef bool (chunk_split_t)(void\ *" "chunk" ", size_t\ " "size" ", size_t\ " "size_a" ", size_t\ " "size_b" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1328 .sp
1329 .if n \{\
1330 .RS 4
1331 .\}
1332 .nf
1333 .fi
1334 .if n \{\
1335 .RE
1336 .\}
1337 .sp
1338 A chunk split function conforms to the
1339 \fBchunk_split_t\fR
1340 type and optionally splits
1341 \fIchunk\fR
1342 of given
1343 \fIsize\fR
1344 into two adjacent chunks, the first of
1345 \fIsize_a\fR
1346 bytes, and the second of
1347 \fIsize_b\fR
1348 bytes, operating on
1349 \fIcommitted\fR/decommitted memory as indicated, on behalf of arena
1350 \fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates that the chunk remains unsplit and therefore should continue to be operated on as a whole\&.
1351 .HP \w'typedef\ bool\ (chunk_merge_t)('u
1352 .BI "typedef bool (chunk_merge_t)(void\ *" "chunk_a" ", size_t\ " "size_a" ", void\ *" "chunk_b" ", size_t\ " "size_b" ", bool\ " "committed" ", unsigned\ " "arena_ind" ");"
1353 .sp
1354 .if n \{\
1355 .RS 4
1356 .\}
1357 .nf
1358 .fi
1359 .if n \{\
1360 .RE
1361 .\}
1362 .sp
1363 A chunk merge function conforms to the
1364 \fBchunk_merge_t\fR
1365 type and optionally merges adjacent chunks,
1366 \fIchunk_a\fR
1367 of given
1368 \fIsize_a\fR
1369 and
1370 \fIchunk_b\fR
1371 of given
1372 \fIsize_b\fR
1373 into one contiguous chunk, operating on
1374 \fIcommitted\fR/decommitted memory as indicated, on behalf of arena
1375 \fIarena_ind\fR, returning false upon success\&. If the function returns true, this indicates that the chunks remain distinct mappings and therefore should continue to be operated on independently\&.
1376 .RE
1377 .PP
1378 "arenas\&.narenas" (\fBunsigned\fR) r\-
1379 .RS 4
1380 Current limit on number of arenas\&.
1381 .RE
1382 .PP
1383 "arenas\&.initialized" (\fBbool *\fR) r\-
1384 .RS 4
1385 An array of
1386 "arenas\&.narenas"
1387 booleans\&. Each boolean indicates whether the corresponding arena is initialized\&.
1388 .RE
1389 .PP
1390 "arenas\&.lg_dirty_mult" (\fBssize_t\fR) rw
1391 .RS 4
1392 Current default per\-arena minimum ratio (log base 2) of active to dirty pages, used to initialize
1393 "arena\&.<i>\&.lg_dirty_mult"
1394 during arena creation\&. See
1395 "opt\&.lg_dirty_mult"
1396 for additional information\&.
1397 .RE
1398 .PP
1399 "arenas\&.decay_time" (\fBssize_t\fR) rw
1400 .RS 4
1401 Current default per\-arena approximate time in seconds 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
1402 "arena\&.<i>\&.decay_time"
1403 during arena creation\&. See
1404 "opt\&.decay_time"
1405 for additional information\&.
1406 .RE
1407 .PP
1408 "arenas\&.quantum" (\fBsize_t\fR) r\-
1409 .RS 4
1410 Quantum size\&.
1411 .RE
1412 .PP
1413 "arenas\&.page" (\fBsize_t\fR) r\-
1414 .RS 4
1415 Page size\&.
1416 .RE
1417 .PP
1418 "arenas\&.tcache_max" (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR]
1419 .RS 4
1420 Maximum thread\-cached size class\&.
1421 .RE
1422 .PP
1423 "arenas\&.nbins" (\fBunsigned\fR) r\-
1424 .RS 4
1425 Number of bin size classes\&.
1426 .RE
1427 .PP
1428 "arenas\&.nhbins" (\fBunsigned\fR) r\- [\fB\-\-enable\-tcache\fR]
1429 .RS 4
1430 Total number of thread cache bin size classes\&.
1431 .RE
1432 .PP
1433 "arenas\&.bin\&.<i>\&.size" (\fBsize_t\fR) r\-
1434 .RS 4
1435 Maximum size supported by size class\&.
1436 .RE
1437 .PP
1438 "arenas\&.bin\&.<i>\&.nregs" (\fBuint32_t\fR) r\-
1439 .RS 4
1440 Number of regions per page run\&.
1441 .RE
1442 .PP
1443 "arenas\&.bin\&.<i>\&.run_size" (\fBsize_t\fR) r\-
1444 .RS 4
1445 Number of bytes per page run\&.
1446 .RE
1447 .PP
1448 "arenas\&.nlruns" (\fBunsigned\fR) r\-
1449 .RS 4
1450 Total number of large size classes\&.
1451 .RE
1452 .PP
1453 "arenas\&.lrun\&.<i>\&.size" (\fBsize_t\fR) r\-
1454 .RS 4
1455 Maximum size supported by this large size class\&.
1456 .RE
1457 .PP
1458 "arenas\&.nhchunks" (\fBunsigned\fR) r\-
1459 .RS 4
1460 Total number of huge size classes\&.
1461 .RE
1462 .PP
1463 "arenas\&.hchunk\&.<i>\&.size" (\fBsize_t\fR) r\-
1464 .RS 4
1465 Maximum size supported by this huge size class\&.
1466 .RE
1467 .PP
1468 "arenas\&.extend" (\fBunsigned\fR) r\-
1469 .RS 4
1470 Extend the array of arenas by appending a new arena, and returning the new arena index\&.
1471 .RE
1472 .PP
1473 "prof\&.thread_active_init" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1474 .RS 4
1475 Control the initial setting for
1476 "thread\&.prof\&.active"
1477 in newly created threads\&. See the
1478 "opt\&.prof_thread_active_init"
1479 option for additional information\&.
1480 .RE
1481 .PP
1482 "prof\&.active" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1483 .RS 4
1484 Control whether sampling is currently active\&. See the
1485 "opt\&.prof_active"
1486 option for additional information, as well as the interrelated
1487 "thread\&.prof\&.active"
1488 mallctl\&.
1489 .RE
1490 .PP
1491 "prof\&.dump" (\fBconst char *\fR) \-w [\fB\-\-enable\-prof\fR]
1492 .RS 4
1493 Dump a memory profile to the specified file, or if NULL is specified, to a file according to the pattern
1494 <prefix>\&.<pid>\&.<seq>\&.m<mseq>\&.heap, where
1495 <prefix>
1496 is controlled by the
1497 "opt\&.prof_prefix"
1498 option\&.
1499 .RE
1500 .PP
1501 "prof\&.gdump" (\fBbool\fR) rw [\fB\-\-enable\-prof\fR]
1502 .RS 4
1503 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
1504 <prefix>\&.<pid>\&.<seq>\&.u<useq>\&.heap, where
1505 <prefix>
1506 is controlled by the
1507 "opt\&.prof_prefix"
1508 option\&.
1509 .RE
1510 .PP
1511 "prof\&.reset" (\fBsize_t\fR) \-w [\fB\-\-enable\-prof\fR]
1512 .RS 4
1513 Reset all memory profile statistics, and optionally update the sample rate (see
1514 "opt\&.lg_prof_sample"
1515 and
1516 "prof\&.lg_sample")\&.
1517 .RE
1518 .PP
1519 "prof\&.lg_sample" (\fBsize_t\fR) r\- [\fB\-\-enable\-prof\fR]
1520 .RS 4
1521 Get the current sample rate (see
1522 "opt\&.lg_prof_sample")\&.
1523 .RE
1524 .PP
1525 "prof\&.interval" (\fBuint64_t\fR) r\- [\fB\-\-enable\-prof\fR]
1526 .RS 4
1527 Average number of bytes allocated between interval\-based profile dumps\&. See the
1528 "opt\&.lg_prof_interval"
1529 option for additional information\&.
1530 .RE
1531 .PP
1532 "stats\&.cactive" (\fBsize_t *\fR) r\- [\fB\-\-enable\-stats\fR]
1533 .RS 4
1534 Pointer to a counter that contains an approximate count of the current number of bytes in active pages\&. The estimate may be high, but never low, because each arena rounds up when computing its contribution to the counter\&. Note that the
1535 "epoch"
1536 mallctl has no bearing on this counter\&. Furthermore, counter consistency is maintained via atomic operations, so it is necessary to use an atomic operation in order to guarantee a consistent read when dereferencing the pointer\&.
1537 .RE
1538 .PP
1539 "stats\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1540 .RS 4
1541 Total number of bytes allocated by the application\&.
1542 .RE
1543 .PP
1544 "stats\&.active" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1545 .RS 4
1546 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
1547 "stats\&.allocated"\&. This does not include
1548 "stats\&.arenas\&.<i>\&.pdirty", nor pages entirely devoted to allocator metadata\&.
1549 .RE
1550 .PP
1551 "stats\&.metadata" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1552 .RS 4
1553 Total number of bytes dedicated to metadata, which comprise base allocations used for bootstrap\-sensitive internal allocator data structures, arena chunk headers (see
1554 "stats\&.arenas\&.<i>\&.metadata\&.mapped"), and internal allocations (see
1555 "stats\&.arenas\&.<i>\&.metadata\&.allocated")\&.
1556 .RE
1557 .PP
1558 "stats\&.resident" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1559 .RS 4
1560 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
1561 "stats\&.active"\&.
1562 .RE
1563 .PP
1564 "stats\&.mapped" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1565 .RS 4
1566 Total number of bytes in active chunks mapped by the allocator\&. This is a multiple of the chunk size, and is larger than
1567 "stats\&.active"\&. This does not include inactive chunks, even those that contain unused dirty pages, which means that there is no strict ordering between this and
1568 "stats\&.resident"\&.
1569 .RE
1570 .PP
1571 "stats\&.retained" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1572 .RS 4
1573 Total number of bytes in virtual memory mappings that were retained rather than being returned to the operating system via e\&.g\&.
1574 \fBmunmap\fR(2)\&. Retained virtual memory is typically untouched, decommitted, or purged, so it has no strongly associated physical memory (see
1575 chunk hooks
1576 for details)\&. Retained memory is excluded from mapped memory statistics, e\&.g\&.
1577 "stats\&.mapped"\&.
1578 .RE
1579 .PP
1580 "stats\&.arenas\&.<i>\&.dss" (\fBconst char *\fR) r\-
1581 .RS 4
1582 dss (\fBsbrk\fR(2)) allocation precedence as related to
1583 \fBmmap\fR(2)
1584 allocation\&. See
1585 "opt\&.dss"
1586 for details\&.
1587 .RE
1588 .PP
1589 "stats\&.arenas\&.<i>\&.lg_dirty_mult" (\fBssize_t\fR) r\-
1590 .RS 4
1591 Minimum ratio (log base 2) of active to dirty pages\&. See
1592 "opt\&.lg_dirty_mult"
1593 for details\&.
1594 .RE
1595 .PP
1596 "stats\&.arenas\&.<i>\&.decay_time" (\fBssize_t\fR) r\-
1597 .RS 4
1598 Approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. See
1599 "opt\&.decay_time"
1600 for details\&.
1601 .RE
1602 .PP
1603 "stats\&.arenas\&.<i>\&.nthreads" (\fBunsigned\fR) r\-
1604 .RS 4
1605 Number of threads currently assigned to arena\&.
1606 .RE
1607 .PP
1608 "stats\&.arenas\&.<i>\&.pactive" (\fBsize_t\fR) r\-
1609 .RS 4
1610 Number of pages in active runs\&.
1611 .RE
1612 .PP
1613 "stats\&.arenas\&.<i>\&.pdirty" (\fBsize_t\fR) r\-
1614 .RS 4
1615 Number of pages within unused runs that are potentially dirty, and for which
1616 \fBmadvise\fR\fB\fI\&.\&.\&.\fR\fR\fB \fR\fB\fI\fBMADV_DONTNEED\fR\fR\fR
1617 or similar has not been called\&.
1618 .RE
1619 .PP
1620 "stats\&.arenas\&.<i>\&.mapped" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1621 .RS 4
1622 Number of mapped bytes\&.
1623 .RE
1624 .PP
1625 "stats\&.arenas\&.<i>\&.retained" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1626 .RS 4
1627 Number of retained bytes\&. See
1628 "stats\&.retained"
1629 for details\&.
1630 .RE
1631 .PP
1632 "stats\&.arenas\&.<i>\&.metadata\&.mapped" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1633 .RS 4
1634 Number of mapped bytes in arena chunk headers, which track the states of the non\-metadata pages\&.
1635 .RE
1636 .PP
1637 "stats\&.arenas\&.<i>\&.metadata\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1638 .RS 4
1639 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\&. This statistic is reported separately from
1640 "stats\&.metadata"
1641 and
1642 "stats\&.arenas\&.<i>\&.metadata\&.mapped"
1643 because it overlaps with e\&.g\&. the
1644 "stats\&.allocated"
1645 and
1646 "stats\&.active"
1647 statistics, whereas the other metadata statistics do not\&.
1648 .RE
1649 .PP
1650 "stats\&.arenas\&.<i>\&.npurge" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1651 .RS 4
1652 Number of dirty page purge sweeps performed\&.
1653 .RE
1654 .PP
1655 "stats\&.arenas\&.<i>\&.nmadvise" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1656 .RS 4
1657 Number of
1658 \fBmadvise\fR\fB\fI\&.\&.\&.\fR\fR\fB \fR\fB\fI\fBMADV_DONTNEED\fR\fR\fR
1659 or similar calls made to purge dirty pages\&.
1660 .RE
1661 .PP
1662 "stats\&.arenas\&.<i>\&.purged" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1663 .RS 4
1664 Number of pages purged\&.
1665 .RE
1666 .PP
1667 "stats\&.arenas\&.<i>\&.small\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1668 .RS 4
1669 Number of bytes currently allocated by small objects\&.
1670 .RE
1671 .PP
1672 "stats\&.arenas\&.<i>\&.small\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1673 .RS 4
1674 Cumulative number of allocation requests served by small bins\&.
1675 .RE
1676 .PP
1677 "stats\&.arenas\&.<i>\&.small\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1678 .RS 4
1679 Cumulative number of small objects returned to bins\&.
1680 .RE
1681 .PP
1682 "stats\&.arenas\&.<i>\&.small\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1683 .RS 4
1684 Cumulative number of small allocation requests\&.
1685 .RE
1686 .PP
1687 "stats\&.arenas\&.<i>\&.large\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1688 .RS 4
1689 Number of bytes currently allocated by large objects\&.
1690 .RE
1691 .PP
1692 "stats\&.arenas\&.<i>\&.large\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1693 .RS 4
1694 Cumulative number of large allocation requests served directly by the arena\&.
1695 .RE
1696 .PP
1697 "stats\&.arenas\&.<i>\&.large\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1698 .RS 4
1699 Cumulative number of large deallocation requests served directly by the arena\&.
1700 .RE
1701 .PP
1702 "stats\&.arenas\&.<i>\&.large\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1703 .RS 4
1704 Cumulative number of large allocation requests\&.
1705 .RE
1706 .PP
1707 "stats\&.arenas\&.<i>\&.huge\&.allocated" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1708 .RS 4
1709 Number of bytes currently allocated by huge objects\&.
1710 .RE
1711 .PP
1712 "stats\&.arenas\&.<i>\&.huge\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1713 .RS 4
1714 Cumulative number of huge allocation requests served directly by the arena\&.
1715 .RE
1716 .PP
1717 "stats\&.arenas\&.<i>\&.huge\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1718 .RS 4
1719 Cumulative number of huge deallocation requests served directly by the arena\&.
1720 .RE
1721 .PP
1722 "stats\&.arenas\&.<i>\&.huge\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1723 .RS 4
1724 Cumulative number of huge allocation requests\&.
1725 .RE
1726 .PP
1727 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1728 .RS 4
1729 Cumulative number of allocations served by bin\&.
1730 .RE
1731 .PP
1732 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1733 .RS 4
1734 Cumulative number of allocations returned to bin\&.
1735 .RE
1736 .PP
1737 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1738 .RS 4
1739 Cumulative number of allocation requests\&.
1740 .RE
1741 .PP
1742 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.curregs" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1743 .RS 4
1744 Current number of regions for this size class\&.
1745 .RE
1746 .PP
1747 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.nfills" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR \fB\-\-enable\-tcache\fR]
1748 .RS 4
1749 Cumulative number of tcache fills\&.
1750 .RE
1751 .PP
1752 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.nflushes" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR \fB\-\-enable\-tcache\fR]
1753 .RS 4
1754 Cumulative number of tcache flushes\&.
1755 .RE
1756 .PP
1757 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.nruns" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1758 .RS 4
1759 Cumulative number of runs created\&.
1760 .RE
1761 .PP
1762 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.nreruns" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1763 .RS 4
1764 Cumulative number of times the current run from which to allocate changed\&.
1765 .RE
1766 .PP
1767 "stats\&.arenas\&.<i>\&.bins\&.<j>\&.curruns" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1768 .RS 4
1769 Current number of runs\&.
1770 .RE
1771 .PP
1772 "stats\&.arenas\&.<i>\&.lruns\&.<j>\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1773 .RS 4
1774 Cumulative number of allocation requests for this size class served directly by the arena\&.
1775 .RE
1776 .PP
1777 "stats\&.arenas\&.<i>\&.lruns\&.<j>\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1778 .RS 4
1779 Cumulative number of deallocation requests for this size class served directly by the arena\&.
1780 .RE
1781 .PP
1782 "stats\&.arenas\&.<i>\&.lruns\&.<j>\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1783 .RS 4
1784 Cumulative number of allocation requests for this size class\&.
1785 .RE
1786 .PP
1787 "stats\&.arenas\&.<i>\&.lruns\&.<j>\&.curruns" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1788 .RS 4
1789 Current number of runs for this size class\&.
1790 .RE
1791 .PP
1792 "stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.nmalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1793 .RS 4
1794 Cumulative number of allocation requests for this size class served directly by the arena\&.
1795 .RE
1796 .PP
1797 "stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.ndalloc" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1798 .RS 4
1799 Cumulative number of deallocation requests for this size class served directly by the arena\&.
1800 .RE
1801 .PP
1802 "stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.nrequests" (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR]
1803 .RS 4
1804 Cumulative number of allocation requests for this size class\&.
1805 .RE
1806 .PP
1807 "stats\&.arenas\&.<i>\&.hchunks\&.<j>\&.curhchunks" (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR]
1808 .RS 4
1809 Current number of huge allocations for this size class\&.
1810 .RE
1811 .SH "HEAP PROFILE FORMAT"
1812 .PP
1813 Although the heap profiling functionality was originally designed to be compatible with the
1814 \fBpprof\fR
1815 command that is developed as part of the
1816 \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
1817 \fBjeprof\fR
1818 command is derived from
1819 \fBpprof\fR, with enhancements to support the heap profile format described here\&.
1820 .PP
1821 In the following hypothetical heap profile,
1822 \fB[\&.\&.\&.]\fR
1823 indicates elision for the sake of compactness\&.
1824 .sp
1825 .if n \{\
1826 .RS 4
1827 .\}
1828 .nf
1829 heap_v2/524288
1830   t*: 28106: 56637512 [0: 0]
1831   [\&.\&.\&.]
1832   t3: 352: 16777344 [0: 0]
1833   [\&.\&.\&.]
1834   t99: 17754: 29341640 [0: 0]
1835   [\&.\&.\&.]
1836 @ 0x5f86da8 0x5f5a1dc [\&.\&.\&.] 0x29e4d4e 0xa200316 0xabb2988 [\&.\&.\&.]
1837   t*: 13: 6688 [0: 0]
1838   t3: 12: 6496 [0: ]
1839   t99: 1: 192 [0: 0]
1840 [\&.\&.\&.]
1841
1842 MAPPED_LIBRARIES:
1843 [\&.\&.\&.]
1844 .fi
1845 .if n \{\
1846 .RE
1847 .\}
1848 .sp
1849 The following matches the above heap profile, but most tokens are replaced with
1850 \fB<description>\fR
1851 to indicate descriptions of the corresponding fields\&.
1852 .sp
1853 .if n \{\
1854 .RS 4
1855 .\}
1856 .nf
1857 <heap_profile_format_version>/<mean_sample_interval>
1858   <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
1859   [\&.\&.\&.]
1860   <thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
1861   [\&.\&.\&.]
1862   <thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
1863   [\&.\&.\&.]
1864 @ <top_frame> <frame> [\&.\&.\&.] <frame> <frame> <frame> [\&.\&.\&.]
1865   <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
1866   <backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
1867   <backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
1868 [\&.\&.\&.]
1869
1870 MAPPED_LIBRARIES:
1871 </proc/<pid>/maps>
1872 .fi
1873 .if n \{\
1874 .RE
1875 .\}
1876 .SH "DEBUGGING MALLOC PROBLEMS"
1877 .PP
1878 When debugging, it is a good idea to configure/build jemalloc with the
1879 \fB\-\-enable\-debug\fR
1880 and
1881 \fB\-\-enable\-fill\fR
1882 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\&.
1883 .PP
1884 Programs often accidentally depend on \(lquninitialized\(rq memory actually being filled with zero bytes\&. Junk filling (see the
1885 "opt\&.junk"
1886 option) tends to expose such bugs in the form of obviously incorrect results and/or coredumps\&. Conversely, zero filling (see the
1887 "opt\&.zero"
1888 option) eliminates the symptoms of such bugs\&. Between these two options, it is usually possible to quickly detect, diagnose, and eliminate such bugs\&.
1889 .PP
1890 This implementation does not provide much detail about the problems it detects, because the performance impact for storing such information would be prohibitive\&. However, jemalloc does integrate with the most excellent
1891 \m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2
1892 tool if the
1893 \fB\-\-enable\-valgrind\fR
1894 configuration option is enabled\&.
1895 .SH "DIAGNOSTIC MESSAGES"
1896 .PP
1897 If any of the memory allocation/deallocation functions detect an error or warning condition, a message will be printed to file descriptor
1898 \fBSTDERR_FILENO\fR\&. Errors will result in the process dumping core\&. If the
1899 "opt\&.abort"
1900 option is set, most warnings are treated as errors\&.
1901 .PP
1902 The
1903 \fImalloc_message\fR
1904 variable allows the programmer to override the function which emits the text strings forming the errors and warnings if for some reason the
1905 \fBSTDERR_FILENO\fR
1906 file descriptor is not suitable for this\&.
1907 \fBmalloc_message\fR\fB\fR
1908 takes the
1909 \fIcbopaque\fR
1910 pointer argument that is
1911 \fBNULL\fR
1912 unless overridden by the arguments in a call to
1913 \fBmalloc_stats_print\fR\fB\fR, 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\&.
1914 .PP
1915 All messages are prefixed by \(lq<jemalloc>:\(rq\&.
1916 .SH "RETURN VALUES"
1917 .SS "Standard API"
1918 .PP
1919 The
1920 \fBmalloc\fR\fB\fR
1921 and
1922 \fBcalloc\fR\fB\fR
1923 functions return a pointer to the allocated memory if successful; otherwise a
1924 \fBNULL\fR
1925 pointer is returned and
1926 \fIerrno\fR
1927 is set to
1928 ENOMEM\&.
1929 .PP
1930 The
1931 \fBposix_memalign\fR\fB\fR
1932 function returns the value 0 if successful; otherwise it returns an error value\&. The
1933 \fBposix_memalign\fR\fB\fR
1934 function will fail if:
1935 .PP
1936 EINVAL
1937 .RS 4
1938 The
1939 \fIalignment\fR
1940 parameter is not a power of 2 at least as large as
1941 sizeof(\fBvoid *\fR)\&.
1942 .RE
1943 .PP
1944 ENOMEM
1945 .RS 4
1946 Memory allocation error\&.
1947 .RE
1948 .PP
1949 The
1950 \fBaligned_alloc\fR\fB\fR
1951 function returns a pointer to the allocated memory if successful; otherwise a
1952 \fBNULL\fR
1953 pointer is returned and
1954 \fIerrno\fR
1955 is set\&. The
1956 \fBaligned_alloc\fR\fB\fR
1957 function will fail if:
1958 .PP
1959 EINVAL
1960 .RS 4
1961 The
1962 \fIalignment\fR
1963 parameter is not a power of 2\&.
1964 .RE
1965 .PP
1966 ENOMEM
1967 .RS 4
1968 Memory allocation error\&.
1969 .RE
1970 .PP
1971 The
1972 \fBrealloc\fR\fB\fR
1973 function returns a pointer, possibly identical to
1974 \fIptr\fR, to the allocated memory if successful; otherwise a
1975 \fBNULL\fR
1976 pointer is returned, and
1977 \fIerrno\fR
1978 is set to
1979 ENOMEM
1980 if the error was the result of an allocation failure\&. The
1981 \fBrealloc\fR\fB\fR
1982 function always leaves the original buffer intact when an error occurs\&.
1983 .PP
1984 The
1985 \fBfree\fR\fB\fR
1986 function returns no value\&.
1987 .SS "Non\-standard API"
1988 .PP
1989 The
1990 \fBmallocx\fR\fB\fR
1991 and
1992 \fBrallocx\fR\fB\fR
1993 functions return a pointer to the allocated memory if successful; otherwise a
1994 \fBNULL\fR
1995 pointer is returned to indicate insufficient contiguous memory was available to service the allocation request\&.
1996 .PP
1997 The
1998 \fBxallocx\fR\fB\fR
1999 function returns the real size of the resulting resized allocation pointed to by
2000 \fIptr\fR, which is a value less than
2001 \fIsize\fR
2002 if the allocation could not be adequately grown in place\&.
2003 .PP
2004 The
2005 \fBsallocx\fR\fB\fR
2006 function returns the real size of the allocation pointed to by
2007 \fIptr\fR\&.
2008 .PP
2009 The
2010 \fBnallocx\fR\fB\fR
2011 returns the real size that would result from a successful equivalent
2012 \fBmallocx\fR\fB\fR
2013 function call, or zero if insufficient memory is available to perform the size computation\&.
2014 .PP
2015 The
2016 \fBmallctl\fR\fB\fR,
2017 \fBmallctlnametomib\fR\fB\fR, and
2018 \fBmallctlbymib\fR\fB\fR
2019 functions return 0 on success; otherwise they return an error value\&. The functions will fail if:
2020 .PP
2021 EINVAL
2022 .RS 4
2023 \fInewp\fR
2024 is not
2025 \fBNULL\fR, and
2026 \fInewlen\fR
2027 is too large or too small\&. Alternatively,
2028 \fI*oldlenp\fR
2029 is too large or too small; in this case as much data as possible are read despite the error\&.
2030 .RE
2031 .PP
2032 ENOENT
2033 .RS 4
2034 \fIname\fR
2035 or
2036 \fImib\fR
2037 specifies an unknown/invalid value\&.
2038 .RE
2039 .PP
2040 EPERM
2041 .RS 4
2042 Attempt to read or write void value, or attempt to write read\-only value\&.
2043 .RE
2044 .PP
2045 EAGAIN
2046 .RS 4
2047 A memory allocation failure occurred\&.
2048 .RE
2049 .PP
2050 EFAULT
2051 .RS 4
2052 An interface with side effects failed in some way not directly related to
2053 \fBmallctl*\fR\fB\fR
2054 read/write processing\&.
2055 .RE
2056 .PP
2057 The
2058 \fBmalloc_usable_size\fR\fB\fR
2059 function returns the usable size of the allocation pointed to by
2060 \fIptr\fR\&.
2061 .SH "ENVIRONMENT"
2062 .PP
2063 The following environment variable affects the execution of the allocation functions:
2064 .PP
2065 \fBMALLOC_CONF\fR
2066 .RS 4
2067 If the environment variable
2068 \fBMALLOC_CONF\fR
2069 is set, the characters it contains will be interpreted as options\&.
2070 .RE
2071 .SH "EXAMPLES"
2072 .PP
2073 To dump core whenever a problem occurs:
2074 .sp
2075 .if n \{\
2076 .RS 4
2077 .\}
2078 .nf
2079 ln \-s \*(Aqabort:true\*(Aq /etc/malloc\&.conf
2080 .fi
2081 .if n \{\
2082 .RE
2083 .\}
2084 .PP
2085 To specify in the source a chunk size that is 16 MiB:
2086 .sp
2087 .if n \{\
2088 .RS 4
2089 .\}
2090 .nf
2091 malloc_conf = "lg_chunk:24";
2092 .fi
2093 .if n \{\
2094 .RE
2095 .\}
2096 .SH "SEE ALSO"
2097 .PP
2098 \fBmadvise\fR(2),
2099 \fBmmap\fR(2),
2100 \fBsbrk\fR(2),
2101 \fButrace\fR(2),
2102 \fBalloca\fR(3),
2103 \fBatexit\fR(3),
2104 \fBgetpagesize\fR(3)
2105 .SH "STANDARDS"
2106 .PP
2107 The
2108 \fBmalloc\fR\fB\fR,
2109 \fBcalloc\fR\fB\fR,
2110 \fBrealloc\fR\fB\fR, and
2111 \fBfree\fR\fB\fR
2112 functions conform to ISO/IEC 9899:1990 (\(lqISO C90\(rq)\&.
2113 .PP
2114 The
2115 \fBposix_memalign\fR\fB\fR
2116 function conforms to IEEE Std 1003\&.1\-2001 (\(lqPOSIX\&.1\(rq)\&.
2117 .SH "HISTORY"
2118 .PP
2119 The
2120 \fBmalloc_usable_size\fR\fB\fR
2121 and
2122 \fBposix_memalign\fR\fB\fR
2123 functions first appeared in FreeBSD 7\&.0\&.
2124 .PP
2125 The
2126 \fBaligned_alloc\fR\fB\fR,
2127 \fBmalloc_stats_print\fR\fB\fR, and
2128 \fBmallctl*\fR\fB\fR
2129 functions first appeared in FreeBSD 10\&.0\&.
2130 .PP
2131 The
2132 \fB*allocx\fR\fB\fR
2133 functions first appeared in FreeBSD 11\&.0\&.
2134 .SH "AUTHOR"
2135 .PP
2136 \fBJason Evans\fR
2137 .RS 4
2138 .RE
2139 .SH "NOTES"
2140 .IP " 1." 4
2141 jemalloc website
2142 .RS 4
2143 \%http://www.canonware.com/jemalloc/
2144 .RE
2145 .IP " 2." 4
2146 Valgrind
2147 .RS 4
2148 \%http://valgrind.org/
2149 .RE
2150 .IP " 3." 4
2151 gperftools package
2152 .RS 4
2153 \%http://code.google.com/p/gperftools/
2154 .RE