1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cref SYSTEM "cref.dtd">
<cref>
<header>
<copyright>
<year>2002</year><year>2013</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
</legalnotice>
<title>erts_alloc</title>
<prepared>Rickard Green</prepared>
<docno>1</docno>
<date>03-06-11</date>
<rev>1</rev>
<file>erts_alloc.xml</file>
</header>
<lib>erts_alloc</lib>
<libsummary>An Erlang Run-Time System internal memory allocator library.</libsummary>
<description>
<p><c>erts_alloc</c> is an Erlang Run-Time System internal memory
allocator library. <c>erts_alloc</c> provides the Erlang
Run-Time System with a number of memory allocators.</p>
</description>
<section>
<title>Allocators</title>
<marker id="allocators"></marker>
<p>Currently the following allocators are present:</p>
<taglist>
<tag><c>temp_alloc</c></tag>
<item>Allocator used for temporary allocations.</item>
<tag><c>eheap_alloc</c></tag>
<item>Allocator used for Erlang heap data, such as Erlang process heaps.</item>
<tag><c>binary_alloc</c></tag>
<item>Allocator used for Erlang binary data.</item>
<tag><c>ets_alloc</c></tag>
<item>Allocator used for ETS data.</item>
<tag><c>driver_alloc</c></tag>
<item>Allocator used for driver data.</item>
<tag><c>sl_alloc</c></tag>
<item>Allocator used for memory blocks that are expected to be
short-lived.</item>
<tag><c>ll_alloc</c></tag>
<item>Allocator used for memory blocks that are expected to be
long-lived, for example Erlang code.</item>
<tag><c>fix_alloc</c></tag>
<item>A fast allocator used for some frequently used
fixed size data types.</item>
<tag><c>std_alloc</c></tag>
<item>Allocator used for most memory blocks not allocated via any of
the other allocators described above.</item>
<tag><c>sys_alloc</c></tag>
<item>This is normally the default <c>malloc</c> implementation
used on the specific OS.</item>
<tag><c>mseg_alloc</c></tag>
<item>A memory segment allocator. <c>mseg_alloc</c> is used by other
allocators for allocating memory segments and is currently only
available on systems that have the <c>mmap</c> system
call. Memory segments that are deallocated are kept for a
while in a segment cache before they are destroyed. When
segments are allocated, cached segments are used if possible
instead of creating new segments. This in order to reduce
the number of system calls made.</item>
</taglist>
<p><c>sys_alloc</c> is always enabled and
cannot be disabled. <c>mseg_alloc</c> is always enabled if it is
available and an allocator that uses it is enabled. All other
allocators can be <seealso marker="#M_e">enabled or disabled</seealso>.
By default all allocators are enabled.
When an allocator is disabled, <c>sys_alloc</c> is used instead of
the disabled allocator.</p>
<p>The main idea with the <c>erts_alloc</c> library is to separate
memory blocks that are used differently into different memory
areas, and by this achieving less memory fragmentation. By
putting less effort in finding a good fit for memory blocks that
are frequently allocated than for those less frequently
allocated, a performance gain can be achieved.</p>
</section>
<section>
<marker id="alloc_util"></marker>
<title>The alloc_util framework</title>
<p>Internally a framework called <c>alloc_util</c> is used for
implementing allocators. <c>sys_alloc</c>, and
<c>mseg_alloc</c> do not use this framework; hence, the
following does <em>not</em> apply to them.</p>
<p>An allocator manages multiple areas, called carriers, in which
memory blocks are placed. A carrier is either placed in a
separate memory segment (allocated via <c>mseg_alloc</c>), or in
the heap segment (allocated via <c>sys_alloc</c>). Multiblock
carriers are used for storage of several blocks. Singleblock
carriers are used for storage of one block. Blocks that are
larger than the value of the singleblock carrier threshold
(<seealso marker="#M_sbct">sbct</seealso>) parameter are placed
in singleblock carriers. Blocks that are smaller than the value
of the <c>sbct</c> parameter are placed in multiblock
carriers. Normally an allocator creates a "main multiblock
carrier". Main multiblock carriers are never deallocated. The
size of the main multiblock carrier is determined by the value
of the <seealso marker="#M_mmbcs">mmbcs</seealso> parameter.</p>
<p><marker id="mseg_mbc_sizes"></marker>Sizes of multiblock carriers
allocated via <c>mseg_alloc</c> are
decided based on the values of the largest multiblock carrier
size (<seealso marker="#M_lmbcs">lmbcs</seealso>), the smallest
multiblock carrier size (<seealso marker="#M_smbcs">smbcs</seealso>),
and the multiblock carrier growth stages
(<seealso marker="#M_mbcgs">mbcgs</seealso>) parameters. If
<c>nc</c> is the current number of multiblock carriers (the main
multiblock carrier excluded) managed by an allocator, the size
of the next <c>mseg_alloc</c> multiblock carrier allocated by
this allocator will roughly be
<c><![CDATA[smbcs+nc*(lmbcs-smbcs)/mbcgs]]></c> when
<c><![CDATA[nc <= mbcgs]]></c>,
and <c>lmbcs</c> when <c><![CDATA[nc > mbcgs]]></c>. If the value of the
<c>sbct</c> parameter should be larger than the value of the
<c>lmbcs</c> parameter, the allocator may have to create
multiblock carriers that are larger than the value of the
<c>lmbcs</c> parameter, though.
Singleblock carriers allocated via <c>mseg_alloc</c> are sized
to whole pages.</p>
<p>Sizes of carriers allocated via <c>sys_alloc</c> are
decided based on the value of the <c>sys_alloc</c> carrier size
(<seealso marker="#Muycs">ycs</seealso>) parameter. The size of
a carrier is the least number of multiples of the value of the
<c>ycs</c> parameter that satisfies the request.</p>
<p>Coalescing of free blocks are always performed immediately.
Boundary tags (headers and footers) in free blocks are used
which makes the time complexity for coalescing constant.</p>
<p><marker id="strategy"></marker>The memory allocation strategy
used for multiblock carriers by an
allocator is configurable via the <seealso marker="#M_as">as</seealso>
parameter. Currently the following strategies are available:</p>
<taglist>
<tag>Best fit</tag>
<item>
<p>Strategy: Find the smallest block that satisfies the
requested block size.</p>
<p>Implementation: A balanced binary search tree is
used. The time complexity is proportional to log N, where
N is the number of sizes of free blocks.</p>
</item>
<tag>Address order best fit</tag>
<item>
<p>Strategy: Find the smallest block that satisfies the
requested block size. If multiple blocks are found, choose
the one with the lowest address.</p>
<p>Implementation: A balanced binary search tree is
used. The time complexity is proportional to log N, where
N is the number of free blocks.</p>
</item>
<tag>Address order first fit</tag>
<item>
<p>Strategy: Find the block with the lowest address that satisfies the
requested block size.</p>
<p>Implementation: A balanced binary search tree is
used. The time complexity is proportional to log N, where
N is the number of free blocks.</p>
</item>
<tag>Address order first fit carrier address order best fit</tag>
<item>
<p>Strategy: Find the <em>carrier</em> with the lowest address that
can satisfy the requested block size, then find a block within
that carrier using the "adress order best fit" strategy.</p>
<p>Implementation: Balanced binary search trees are
used. The time complexity is proportional to log N, where
N is the number of free blocks.</p>
</item>
<tag>Good fit</tag>
<item>
<p>Strategy: Try to find the best fit, but settle for the best fit
found during a limited search.</p>
<p>Implementation: The implementation uses segregated free
lists with a maximum block search depth (in each list) in
order to find a good fit fast. When the maximum block
search depth is small (by default 3) this implementation
has a time complexity that is constant. The maximum block
search depth is configurable via the
<seealso marker="#M_mbsd">mbsd</seealso> parameter.</p>
</item>
<tag>A fit</tag>
<item>
<p>Strategy: Do not search for a fit, inspect only one free
block to see if it satisfies the request. This strategy is
only intended to be used for temporary allocations.</p>
<p>Implementation: Inspect the first block in a free-list.
If it satisfies the request, it is used; otherwise, a new
carrier is created. The implementation has a time
complexity that is constant.</p>
<p>As of erts version 5.6.1 the emulator will refuse to
use this strategy on other allocators than <c>temp_alloc</c>.
This since it will only cause problems for other allocators.</p>
</item>
</taglist>
<p>Apart from the ordinary allocators described above a number of
pre-allocators are used for some specific data types. These
pre-allocators pre-allocate a fixed amount of memory for certain data
types when the run-time system starts. As long as pre-allocated memory
is available, it will be used. When no pre-allocated memory is
available, memory will be allocated in ordinary allocators. These
pre-allocators are typically much faster than the ordinary allocators,
but can only satisfy a limited amount of requests.</p>
</section>
<section>
<marker id="flags"></marker>
<title>System Flags Effecting erts_alloc</title>
<warning>
<p>Only use these flags if you are absolutely sure what you are
doing. Unsuitable settings may cause serious performance
degradation and even a system crash at any time during
operation.</p>
</warning>
<p>Memory allocator system flags have the following syntax:
<c><![CDATA[+M<S><P> <V>]]></c>
where <c><![CDATA[<S>]]></c> is a letter identifying a subsystem,
<c><![CDATA[<P>]]></c> is a parameter, and <c><![CDATA[<V>]]></c> is the
value to use. The flags can be passed to the Erlang emulator
(<seealso marker="erl">erl</seealso>) as command line
arguments.</p>
<p>System flags effecting specific allocators have an upper-case
letter as <c><![CDATA[<S>]]></c>. The following letters are used for
the currently present allocators:</p>
<list type="bulleted">
<item><c>B: binary_alloc</c></item>
<item><c>D: std_alloc</c></item>
<item><c>E: ets_alloc</c></item>
<item><c>F: fix_alloc</c></item>
<item><c>H: eheap_alloc</c></item>
<item><c>L: ll_alloc</c></item>
<item><c>M: mseg_alloc</c></item>
<item><c>R: driver_alloc</c></item>
<item><c>S: sl_alloc</c></item>
<item><c>T: temp_alloc</c></item>
<item><c>Y: sys_alloc</c></item>
</list>
<p>The following flags are available for configuration of
<c>mseg_alloc</c>:</p>
<taglist>
<tag><marker id="MMamcbf"><c><![CDATA[+MMamcbf <size>]]></c></marker></tag>
<item>
Absolute max cache bad fit (in kilobytes). A segment in the
memory segment cache is not reused if its size exceeds the
requested size with more than the value of this
parameter. Default value is 4096. </item>
<tag><marker id="MMrmcbf"><c><![CDATA[+MMrmcbf <ratio>]]></c></marker></tag>
<item>
Relative max cache bad fit (in percent). A segment in the
memory segment cache is not reused if its size exceeds the
requested size with more than relative max cache bad fit
percent of the requested size. Default value is 20.</item>
<tag><marker id="MMmcs"><c><![CDATA[+MMmcs <amount>]]></c></marker></tag>
<item>
Max cached segments. The maximum number of memory segments
stored in the memory segment cache. Valid range is
0-30. Default value is 10.</item>
</taglist>
<p>The following flags are available for configuration of
<c>sys_alloc</c>:</p>
<taglist>
<tag><marker id="MYe"><c>+MYe true</c></marker></tag>
<item>
Enable <c>sys_alloc</c>. Note: <c>sys_alloc</c> cannot be disabled.</item>
<tag><marker id="MYm"><c>+MYm libc</c></marker></tag>
<item>
<c>malloc</c> library to use. Currently only
<c>libc</c> is available. <c>libc</c> enables the standard
<c>libc</c> malloc implementation. By default <c>libc</c> is used.</item>
<tag><marker id="MYtt"><c><![CDATA[+MYtt <size>]]></c></marker></tag>
<item>
Trim threshold size (in kilobytes). This is the maximum amount
of free memory at the top of the heap (allocated by
<c>sbrk</c>) that will be kept by <c>malloc</c> (not
released to the operating system). When the amount of free
memory at the top of the heap exceeds the trim threshold,
<c>malloc</c> will release it (by calling
<c>sbrk</c>). Trim threshold is given in kilobytes. Default
trim threshold is 128. <em>Note:</em> This flag will
only have any effect when the emulator has been linked with
the GNU C library, and uses its <c>malloc</c> implementation.</item>
<tag><marker id="MYtp"><c><![CDATA[+MYtp <size>]]></c></marker></tag>
<item>
Top pad size (in kilobytes). This is the amount of extra
memory that will be allocated by <c>malloc</c> when
<c>sbrk</c> is called to get more memory from the operating
system. Default top pad size is 0. <em>Note:</em> This flag
will only have any effect when the emulator has been linked
with the GNU C library, and uses its <c>malloc</c>
implementation.</item>
</taglist>
<p>The following flags are available for configuration of allocators
based on <c>alloc_util</c>. If <c>u</c> is used as subsystem
identifier (i.e., <c><![CDATA[<S> = u]]></c>) all allocators based on
<c>alloc_util</c> will be effected. If <c>B</c>, <c>D</c>, <c>E</c>,
<c>F</c>, <c>H</c>, <c>L</c>, <c>R</c>, <c>S</c>, or <c>T</c> is used as
subsystem identifier, only the specific allocator identified will be
effected:</p>
<taglist>
<tag><marker id="M_acul"><c><![CDATA[+M<S>acul <utilization>|de]]></c></marker></tag>
<item>
Abandon carrier utilization limit. A valid
<c><![CDATA[<utilization>]]></c> is an integer in the range
<c>[0, 100]</c> representing utilization in percent. When a
utilization value larger than zero is used, allocator instances
are allowed to abandon multiblock carriers. If <c>de</c> (default
enabled) is passed instead of a <c><![CDATA[<utilization>]]></c>,
a recomended non zero utilization value will be used. The actual
value chosen depend on allocator type and may be changed between
ERTS versions. Currently the default equals <c>de</c>, but this
may be changed in the future. Carriers will be abandoned when
memory utilization in the allocator instance falls below the
utilization value used. Once a carrier has been abandoned, no new
allocations will be made in it. When an allocator instance gets an
increased multiblock carrier need, it will first try to fetch an
abandoned carrier from an allocator instances of the same
allocator type. If no abandoned carrier could be fetched, it will
create a new empty carrier. When an abandoned carrier has been
fetched it will function as an ordinary carrier. This feature has
special requirements on the
<seealso marker="#M_as">allocation strategy</seealso> used. Currently
only the <c>aoff</c> and the <c>aoffcaobf</c> strategies support
abandoned carriers. This feature also requires
<seealso marker="#M_t">multiple thread specific instances</seealso>
to be enabled. When enabling this feature, multiple thread specific
instances will be enabled if not already enabled, and the
<c>aoffcaobf</c> strategy will be enabled if current strategy does not
support abandoned carriers. This feature can be enabled on all
allocators based on the <c>alloc_util</c> framework with the
exception of <c>temp_alloc</c> (which would be pointless).
</item>
<tag><marker id="M_as"><c><![CDATA[+M<S>as bf|aobf|aoff|aoffcaobf|gf|af]]></c></marker></tag>
<item>
Allocation strategy. Valid strategies are <c>bf</c> (best fit),
<c>aobf</c> (address order best fit), <c>aoff</c> (address order first fit),
<c>aoffcaobf</c> (address order first fit carrier address order best fit),
<c>gf</c> (good fit), and <c>af</c> (a fit). See
<seealso marker="#strategy">the description of allocation strategies</seealso> in "the <c>alloc_util</c> framework" section.</item>
<tag><marker id="M_asbcst"><c><![CDATA[+M<S>asbcst <size>]]></c></marker></tag>
<item>
Absolute singleblock carrier shrink threshold (in
kilobytes). When a block located in an
<c>mseg_alloc</c> singleblock carrier is shrunk, the carrier
will be left unchanged if the amount of unused memory is less
than this threshold; otherwise, the carrier will be shrunk.
See also <seealso marker="#M_rsbcst">rsbcst</seealso>.</item>
<tag><marker id="M_e"><c><![CDATA[+M<S>e true|false]]></c></marker></tag>
<item>
Enable allocator <c><![CDATA[<S>]]></c>.</item>
<tag><marker id="M_lmbcs"><c><![CDATA[+M<S>lmbcs <size>]]></c></marker></tag>
<item>
Largest (<c>mseg_alloc</c>) multiblock carrier size (in
kilobytes). See <seealso marker="#mseg_mbc_sizes">the description
on how sizes for mseg_alloc multiblock carriers are decided</seealso>
in "the <c>alloc_util</c> framework" section. On 32-bit Unix style OS
this limit can not be set higher than 128 megabyte.</item>
<tag><marker id="M_mbcgs"><c><![CDATA[+M<S>mbcgs <ratio>]]></c></marker></tag>
<item>
(<c>mseg_alloc</c>) multiblock carrier growth stages. See
<seealso marker="#mseg_mbc_sizes">the description on how sizes for
mseg_alloc multiblock carriers are decided</seealso>
in "the <c>alloc_util</c> framework" section.</item>
<tag><marker id="M_mbsd"><c><![CDATA[+M<S>mbsd <depth>]]></c></marker></tag>
<item>
Max block search depth. This flag has effect only if the
good fit strategy has been selected for allocator
<c><![CDATA[<S>]]></c>. When the good fit strategy is used, free
blocks are placed in segregated free-lists. Each free list
contains blocks of sizes in a specific range. The max block
search depth sets a limit on the maximum number of blocks to
inspect in a free list during a search for suitable block
satisfying the request.</item>
<tag><marker id="M_mmbcs"><c><![CDATA[+M<S>mmbcs <size>]]></c></marker></tag>
<item>
Main multiblock carrier size. Sets the size of the main
multiblock carrier for allocator <c><![CDATA[<S>]]></c>. The main
multiblock carrier is allocated via <c><![CDATA[sys_alloc]]></c> and is
never deallocated.</item>
<tag><marker id="M_mmmbc"><c><![CDATA[+M<S>mmmbc <amount>]]></c></marker></tag>
<item>
Max <c>mseg_alloc</c> multiblock carriers. Maximum number of
multiblock carriers allocated via <c>mseg_alloc</c> by
allocator <c><![CDATA[<S>]]></c>. When this limit has been reached,
new multiblock carriers will be allocated via
<c>sys_alloc</c>.</item>
<tag><marker id="M_mmsbc"><c><![CDATA[+M<S>mmsbc <amount>]]></c></marker></tag>
<item>
Max <c>mseg_alloc</c> singleblock carriers. Maximum number of
singleblock carriers allocated via <c>mseg_alloc</c> by
allocator <c><![CDATA[<S>]]></c>. When this limit has been reached,
new singleblock carriers will be allocated via
<c>sys_alloc</c>.</item>
<tag><marker id="M_ramv"><c><![CDATA[+M<S>ramv <bool>]]></c></marker></tag>
<item>
Realloc always moves. When enabled, reallocate operations will
more or less be translated into an allocate, copy, free sequence.
This often reduce memory fragmentation, but costs performance.
</item>
<tag><marker id="M_rmbcmt"><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></marker></tag>
<item>
Relative multiblock carrier move threshold (in percent). When
a block located in a multiblock carrier is shrunk,
the block will be moved if the ratio of the size of the returned
memory compared to the previous size is more than this threshold;
otherwise, the block will be shrunk at current location.</item>
<tag><marker id="M_rsbcmt"><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></marker></tag>
<item>
Relative singleblock carrier move threshold (in percent). When
a block located in a singleblock carrier is shrunk to
a size smaller than the value of the
<seealso marker="#M_sbct">sbct</seealso> parameter,
the block will be left unchanged in the singleblock carrier if
the ratio of unused memory is less than this threshold;
otherwise, it will be moved into a multiblock carrier. </item>
<tag><marker id="M_rsbcst"><c><![CDATA[+M<S>rsbcst <ratio>]]></c></marker></tag>
<item>
Relative singleblock carrier shrink threshold (in
percent). When a block located in an <c>mseg_alloc</c>
singleblock carrier is shrunk, the carrier will be left
unchanged if the ratio of unused memory is less than this
threshold; otherwise, the carrier will be shrunk.
See also <seealso marker="#M_asbcst">asbcst</seealso>.</item>
<tag><marker id="M_sbct"><c><![CDATA[+M<S>sbct <size>]]></c></marker></tag>
<item>
Singleblock carrier threshold. Blocks larger than this
threshold will be placed in singleblock carriers. Blocks
smaller than this threshold will be placed in multiblock
carriers. On 32-bit Unix style OS this threshold can not be set higher
than 8 megabytes.</item>
<tag><marker id="M_smbcs"><c><![CDATA[+M<S>smbcs <size>]]></c></marker></tag>
<item>
Smallest (<c>mseg_alloc</c>) multiblock carrier size (in
kilobytes). See <seealso marker="#mseg_mbc_sizes">the description
on how sizes for mseg_alloc multiblock carriers are decided</seealso>
in "the <c>alloc_util</c> framework" section.</item>
<tag><marker id="M_t"><c><![CDATA[+M<S>t true|false]]></c></marker></tag>
<item>
<p>Multiple, thread specific instances of the allocator.
This option will only have any effect on the runtime system
with SMP support. Default behaviour on the runtime system with
SMP support:</p>
<taglist>
<tag><c>ll_alloc</c></tag>
<item><c>1</c> instance.</item>
<tag>Other allocators</tag>
<item><c>NoSchedulers+1</c> instances. Each scheduler will use
a lock-free instance of its own and other threads will use
a common instance.</item>
</taglist>
<p>It was previously (before ERTS version 5.9) possible to configure
a smaller amount of thread specific instances than schedulers.
This is, however, not possible any more.</p>
</item>
</taglist>
<p>Currently the following flags are available for configuration of
<c>alloc_util</c>, i.e. all allocators based on <c>alloc_util</c>
will be effected:</p>
<taglist>
<tag><marker id="Muycs"><c><![CDATA[+Muycs <size>]]></c></marker></tag>
<item>
<c>sys_alloc</c> carrier size. Carriers allocated via
<c>sys_alloc</c> will be allocated in sizes which are
multiples of the <c>sys_alloc</c> carrier size. This is not
true for main multiblock carriers and carriers allocated
during a memory shortage, though.</item>
<tag><marker id="Mummc"><c><![CDATA[+Mummc <amount>]]></c></marker></tag>
<item>
Max <c>mseg_alloc</c> carriers. Maximum number of carriers
placed in separate memory segments. When this limit has been
reached, new carriers will be placed in memory retrieved from
<c>sys_alloc</c>.</item>
</taglist>
<p>Instrumentation flags:</p>
<taglist>
<tag><marker id="Mim"><c>+Mim true|false</c></marker></tag>
<item>
A map over current allocations is kept by the emulator. The
allocation map can be retrieved via the <c>instrument</c>
module. <c>+Mim true</c> implies <c>+Mis true</c>.
<c>+Mim true</c> is the same as
<seealso marker="erl#instr">-instr</seealso>.</item>
<tag><marker id="Mis"><c>+Mis true|false</c></marker></tag>
<item>
Status over allocated memory is kept by the emulator. The
allocation status can be retrieved via the <c>instrument</c>
module.</item>
<tag><marker id="Mit"><c>+Mit X</c></marker></tag>
<item>
Reserved for future use. Do <em>not</em> use this flag.</item>
</taglist>
<note>
<p>When instrumentation of the emulator is enabled, the emulator
uses more memory and runs slower.</p>
</note>
<p>Other flags:</p>
<taglist>
<tag><marker id="Mea"><c>+Mea min|max|r9c|r10b|r11b|config</c></marker></tag>
<item>
<taglist>
<tag><c>min</c></tag>
<item>
Disables all allocators that can be disabled.
</item>
<tag><c>max</c></tag>
<item>
Enables all allocators (currently default).
</item>
<tag><c>r9c|r10b|r11b</c></tag>
<item>
Configures all allocators as they were configured in respective
OTP release. These will eventually be removed.
</item>
<tag><c>config</c></tag>
<item>
Disables features that cannot be enabled while creating an
allocator configuration with
<seealso marker="runtime_tools:erts_alloc_config">erts_alloc_config(3)</seealso>.
Note, this option should only be used while running
<c>erts_alloc_config</c>, <em>not</em> when using the created
configuration.
</item>
</taglist>
</item>
</taglist>
<p>Only some default values have been presented
here.
<seealso marker="erts:erlang#system_info_allocator">erlang:system_info(allocator)</seealso>,
and
<seealso marker="erts:erlang#system_info_allocator_tuple">erlang:system_info({allocator, Alloc})</seealso>
can be used in order to obtain currently used settings and current
status of the allocators.</p>
<note>
<p>Most of these flags are highly implementation dependent, and they
may be changed or removed without prior notice.</p>
<p><c>erts_alloc</c> is not obliged to strictly use the settings that
have been passed to it (it may even ignore them).</p>
</note>
<p><seealso marker="runtime_tools:erts_alloc_config">erts_alloc_config(3)</seealso>
is a tool that can be used to aid creation of an
<c>erts_alloc</c> configuration that is suitable for a limited
number of runtime scenarios.</p>
</section>
<section>
<title>SEE ALSO</title>
<p><seealso marker="runtime_tools:erts_alloc_config">erts_alloc_config(3)</seealso>,
<seealso marker="erl">erl(1)</seealso>,
<seealso marker="tools:instrument">instrument(3)</seealso>,
<seealso marker="erts:erlang">erlang(3)</seealso></p>
</section>
</cref>
|