Erlang -- erts_alloc

User's Guide
Reference Manual
Release Notes
PDF
Top

Erlang Run-Time System Application (ERTS)
Reference Manual
Version 5.9.2

Expand All
Contract All

Table of Contents

- erl_prim_loader
  - Top of manual page
  - start/3
  - get_file/1
  - get_path/0
  - list_dir/1
  - read_file_info/1
  - set_path/1
- erlang
  - Top of manual page
  - abs/1
  - adler32/1
  - adler32/2
  - adler32_combine/3
  - append_element/2
  - apply/2
  - apply/3
  - atom_to_binary/2
  - atom_to_list/1
  - binary_part/2
  - binary_part/3
  - binary_to_atom/2
  - binary_to_existing_atom/2
  - binary_to_list/1
  - binary_to_list/3
  - bitstring_to_list/1
  - binary_to_term/1
  - binary_to_term/2
  - bit_size/1
  - bump_reductions/1
  - byte_size/1
  - cancel_timer/1
  - check_old_code/1
  - check_process_code/2
  - crc32/1
  - crc32/2
  - crc32_combine/3
  - date/0
  - decode_packet/3
  - delete_module/1
  - demonitor/1
  - demonitor/2
  - disconnect_node/1
  - display/1
  - element/2
  - erase/0
  - erase/1
  - error/1
  - error/2
  - exit/1
  - exit/2
  - external_size/1
  - external_size/2
  - float/1
  - float_to_list/1
  - fun_info/1
  - fun_info/2
  - fun_to_list/1
  - function_exported/3
  - garbage_collect/0
  - garbage_collect/1
  - get/0
  - get/1
  - get_cookie/0
  - get_keys/1
  - get_stacktrace/0
  - group_leader/0
  - group_leader/2
  - halt/0
  - halt/1
  - halt/2
  - hash/2
  - hd/1
  - hibernate/3
  - integer_to_list/1
  - integer_to_list/2
  - iolist_to_binary/1
  - iolist_size/1
  - is_alive/0
  - is_atom/1
  - is_binary/1
  - is_bitstring/1
  - is_boolean/1
  - is_builtin/3
  - is_float/1
  - is_function/1
  - is_function/2
  - is_integer/1
  - is_list/1
  - is_number/1
  - is_pid/1
  - is_port/1
  - is_process_alive/1
  - is_record/2
  - is_record/3
  - is_reference/1
  - is_tuple/1
  - length/1
  - link/1
  - list_to_atom/1
  - list_to_binary/1
  - list_to_bitstring/1
  - list_to_existing_atom/1
  - list_to_float/1
  - list_to_integer/1
  - list_to_integer/2
  - list_to_pid/1
  - list_to_tuple/1
  - load_module/2
  - load_nif/2
  - loaded/0
  - localtime/0
  - localtime_to_universaltime/1
  - localtime_to_universaltime/2
  - make_ref/0
  - make_tuple/2
  - make_tuple/3
  - max/2
  - md5/1
  - md5_final/1
  - md5_init/0
  - md5_update/2
  - memory/0
  - memory/1
  - min/2
  - module_loaded/1
  - monitor/2
  - monitor_node/2
  - monitor_node/3
  - nif_error/1
  - nif_error/2
  - node/0
  - node/1
  - nodes/0
  - nodes/1
  - now/0
  - open_port/2
  - phash/2
  - phash2/1
  - pid_to_list/1
  - port_close/1
  - port_command/2
  - port_command/3
  - port_connect/2
  - port_control/3
  - port_call/3
  - port_info/1
  - port_info/2
  - port_to_list/1
  - ports/0
  - pre_loaded/0
  - process_display/2
  - process_flag/2
  - process_flag/3
  - process_info/1
  - process_info/2
  - processes/0
  - purge_module/1
  - put/2
  - raise/3
  - read_timer/1
  - ref_to_list/1
  - register/2
  - registered/0
  - resume_process/1
  - round/1
  - self/0
  - send/2
  - send/3
  - send_after/3
  - send_nosuspend/2
  - send_nosuspend/3
  - set_cookie/2
  - setelement/3
  - size/1
  - spawn/1
  - spawn/2
  - spawn/3
  - spawn/4
  - spawn_link/1
  - spawn_link/2
  - spawn_link/3
  - spawn_link/4
  - spawn_monitor/1
  - spawn_monitor/3
  - spawn_opt/2
  - spawn_opt/3
  - spawn_opt/4
  - spawn_opt/5
  - split_binary/2
  - start_timer/3
  - statistics/1
  - suspend_process/2
  - suspend_process/1
  - system_flag/2
  - system_info/1
  - system_monitor/0
  - system_monitor/1
  - system_monitor/2
  - system_profile/0
  - system_profile/2
  - term_to_binary/1
  - term_to_binary/2
  - throw/1
  - time/0
  - tl/1
  - trace/3
  - trace_delivered/1
  - trace_info/2
  - trace_pattern/2
  - trace_pattern/3
  - trunc/1
  - tuple_size/1
  - tuple_to_list/1
  - universaltime/0
  - universaltime_to_localtime/1
  - unlink/1
  - unregister/1
  - whereis/1
  - yield/0
- init
  - Top of manual page
  - boot/1
  - get_argument/1
  - get_arguments/0
  - get_plain_arguments/0
  - get_status/0
  - reboot/0
  - restart/0
  - script_id/0
  - stop/0
  - stop/1
- zlib
  - Top of manual page
  - open/0
  - close/1
  - deflateInit/1
  - deflateInit/2
  - deflateInit/6
  - deflate/2
  - deflate/3
  - deflateSetDictionary/2
  - deflateReset/1
  - deflateParams/3
  - deflateEnd/1
  - inflateInit/1
  - inflateInit/2
  - inflate/2
  - inflateSetDictionary/2
  - inflateReset/1
  - inflateEnd/1
  - setBufSize/2
  - getBufSize/1
  - crc32/1
  - crc32/2
  - crc32/3
  - crc32_combine/4
  - adler32/2
  - adler32/3
  - adler32_combine/4
  - compress/1
  - uncompress/1
  - zip/1
  - unzip/1
  - gzip/1
  - gunzip/1
- epmd
- erl
- erlc
- werl
- escript
- erlsrv
- start_erl
- erl_set_memory_block
  - Top of manual page
  - erl_set_memory_block()
  - erl_memory_show()
  - erl_mem_info_get()
- run_erl
- start
- erl_driver
  - Top of manual page
  - driver_system_info()
  - driver_output()
  - driver_output2()
  - driver_output_binary()
  - driver_outputv()
  - driver_vec_to_buf()
  - driver_set_timer()
  - driver_cancel_timer()
  - driver_read_timer()
  - driver_get_now()
  - driver_select()
  - driver_alloc()
  - driver_realloc()
  - driver_free()
  - driver_alloc_binary()
  - driver_realloc_binary()
  - driver_free_binary()
  - driver_binary_get_refc()
  - driver_binary_inc_refc()
  - driver_binary_dec_refc()
  - driver_enq()
  - driver_pushq()
  - driver_deq()
  - driver_sizeq()
  - driver_enq_bin()
  - driver_pushq_bin()
  - driver_peekqv()
  - driver_peekq()
  - driver_enqv()
  - driver_pushqv()
  - driver_pdl_create()
  - driver_pdl_lock()
  - driver_pdl_unlock()
  - driver_pdl_get_refc()
  - driver_pdl_inc_refc()
  - driver_pdl_dec_refc()
  - driver_monitor_process()
  - driver_demonitor_process()
  - driver_get_monitored_process()
  - driver_compare_monitors()
  - add_driver_entry()
  - remove_driver_entry()
  - erl_errno_id()
  - set_busy_port()
  - set_port_control_flags()
  - driver_failure_eof()
  - driver_failure_atom()
  - driver_failure_posix()
  - driver_failure()
  - driver_connected()
  - driver_caller()
  - driver_output_term()
  - driver_mk_atom()
  - driver_mk_port()
  - driver_send_term()
  - driver_async ()
  - driver_async_cancel()
  - driver_lock_driver()
  - driver_create_port()
  - erl_drv_thread_create()
  - erl_drv_thread_opts_create()
  - erl_drv_thread_opts_destroy()
  - erl_drv_thread_exit()
  - erl_drv_thread_join()
  - erl_drv_thread_self()
  - erl_drv_equal_tids()
  - erl_drv_mutex_create()
  - erl_drv_mutex_destroy()
  - erl_drv_mutex_lock()
  - erl_drv_mutex_trylock()
  - erl_drv_mutex_unlock()
  - erl_drv_cond_create()
  - erl_drv_cond_destroy()
  - erl_drv_cond_signal()
  - erl_drv_cond_broadcast()
  - erl_drv_cond_wait()
  - erl_drv_rwlock_create()
  - erl_drv_rwlock_destroy()
  - erl_drv_rwlock_rlock()
  - erl_drv_rwlock_tryrlock()
  - erl_drv_rwlock_runlock()
  - erl_drv_rwlock_rwlock()
  - erl_drv_rwlock_tryrwlock()
  - erl_drv_rwlock_rwunlock()
  - erl_drv_tsd_key_create()
  - erl_drv_tsd_key_destroy()
  - erl_drv_tsd_set()
  - erl_drv_tsd_get()
  - erl_drv_putenv()
  - erl_drv_getenv()
- driver_entry
- erts_alloc
- erl_nif
  - Top of manual page
  - enif_alloc()
  - enif_alloc_binary()
  - enif_alloc_env()
  - enif_alloc_resource()
  - enif_clear_env()
  - enif_compare()
  - enif_cond_broadcast()
  - enif_cond_create()
  - enif_cond_destroy()
  - enif_cond_signal()
  - enif_cond_wait()
  - enif_equal_tids()
  - enif_free()
  - enif_free_env()
  - enif_get_atom()
  - enif_get_atom_length()
  - enif_get_double()
  - enif_get_int()
  - enif_get_int64()
  - enif_get_local_pid()
  - enif_get_list_cell()
  - enif_get_list_length()
  - enif_get_long()
  - enif_get_resource()
  - enif_get_string()
  - enif_get_tuple()
  - enif_get_uint()
  - enif_get_uint64()
  - enif_get_ulong()
  - enif_inspect_binary()
  - enif_inspect_iolist_as_binary()
  - enif_is_atom()
  - enif_is_binary()
  - enif_is_empty_list()
  - enif_is_exception()
  - enif_is_number()
  - enif_is_fun()
  - enif_is_identical()
  - enif_is_pid()
  - enif_is_port()
  - enif_is_ref()
  - enif_is_tuple()
  - enif_is_list()
  - enif_keep_resource()
  - enif_make_atom()
  - enif_make_atom_len()
  - enif_make_badarg()
  - enif_make_binary()
  - enif_make_copy()
  - enif_make_double()
  - enif_make_existing_atom()
  - enif_make_existing_atom_len()
  - enif_make_int()
  - enif_make_int64()
  - enif_make_list()
  - enif_make_list1()
  - enif_make_list2()
  - enif_make_list3()
  - enif_make_list4()
  - enif_make_list5()
  - enif_make_list6()
  - enif_make_list7()
  - enif_make_list8()
  - enif_make_list9()
  - enif_make_list_cell()
  - enif_make_list_from_array()
  - enif_make_reverse_list()
  - enif_make_long()
  - enif_make_new_binary()
  - enif_make_pid()
  - enif_make_ref()
  - enif_make_resource()
  - enif_make_resource_binary()
  - enif_make_string()
  - enif_make_string_len()
  - enif_make_sub_binary()
  - enif_make_tuple()
  - enif_make_tuple1()
  - enif_make_tuple2()
  - enif_make_tuple3()
  - enif_make_tuple4()
  - enif_make_tuple5()
  - enif_make_tuple6()
  - enif_make_tuple7()
  - enif_make_tuple8()
  - enif_make_tuple9()
  - enif_make_tuple_from_array()
  - enif_make_uint()
  - enif_make_uint64()
  - enif_make_ulong()
  - enif_mutex_create()
  - enif_mutex_destroy()
  - enif_mutex_lock()
  - enif_mutex_trylock()
  - enif_mutex_unlock()
  - enif_open_resource_type()
  - enif_priv_data()
  - enif_realloc_binary()
  - enif_release_binary()
  - enif_release_resource()
  - enif_rwlock_create()
  - enif_rwlock_destroy()
  - enif_rwlock_rlock()
  - enif_rwlock_runlock()
  - enif_rwlock_rwlock()
  - enif_rwlock_rwunlock()
  - enif_rwlock_tryrlock()
  - enif_rwlock_tryrwlock()
  - enif_self()
  - enif_send()
  - enif_sizeof_resource()
  - enif_system_info()
  - enif_thread_create()
  - enif_thread_exit()
  - enif_thread_join()
  - enif_thread_opts_create()
  - enif_thread_opts_destroy()
  - enif_thread_self()
  - enif_tsd_key_create()
  - enif_tsd_key_destroy()
  - enif_tsd_get()
  - enif_tsd_set()

# erts_alloc

### C LIBRARY

erts_alloc

### LIBRARY SUMMARY

An Erlang Run-Time System internal memory allocator library.

### DESCRIPTION

erts_alloc is an Erlang Run-Time System internal memory allocator library. erts_alloc provides the Erlang Run-Time System with a number of memory allocators.

### Allocators

Currently the following allocators are present:

temp_alloc
  Allocator used for temporary allocations.
eheap_alloc
  Allocator used for Erlang heap data, such as Erlang process heaps.
binary_alloc
  Allocator used for Erlang binary data.
ets_alloc
  Allocator used for ETS data.
driver_alloc
  Allocator used for driver data.
sl_alloc
  Allocator used for memory blocks that are expected to be short-lived.
ll_alloc
  Allocator used for memory blocks that are expected to be long-lived, for example Erlang code.
fix_alloc
  A fast allocator used for some frequently used fixed size data types.
std_alloc
  Allocator used for most memory blocks not allocated via any of the other allocators described above.
sys_alloc
  This is normally the default malloc implementation used on the specific OS.
mseg_alloc
  A memory segment allocator. mseg_alloc is used by other allocators for allocating memory segments and is currently only available on systems that have the mmap 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.
sbmbc_alloc
  Allocator used by other allocators for allocation of carriers where only small blocks are placed. Currently this allocator is disabled by default.

sys_alloc is always enabled and cannot be disabled. mseg_alloc is always enabled if it is available and an allocator that uses it is enabled. All other allocators can be enabled or disabled. By default all allocators are enabled. When an allocator is disabled, sys_alloc is used instead of the disabled allocator. sbmbc_alloc is an exception. If sbmbc_alloc is disabled, other allocators will not handle small blocks in separate carriers.

The main idea with the erts_alloc 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.

### The alloc_util framework

Internally a framework called alloc_util is used for implementing allocators. sys_alloc, and mseg_alloc do not use this framework; hence, the following does not apply to them.

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 mseg_alloc), in the heap segment (allocated via sys_alloc), or inside another carrier (in case it is a carrier created by sbmbc_alloc). 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 (sbct) parameter are placed in singleblock carriers. Blocks that are smaller than the value of the sbct parameter are placed in multiblock carriers. Blocks that are smaller than the small block multiblock carrier threshold (sbmbct) will be placed in multiblock carriers only used for small blocks. 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 mmbcs parameter.

Sizes of multiblock carriers allocated via mseg_alloc are decided based on the values of the largest multiblock carrier size (lmbcs), the smallest multiblock carrier size (smbcs), and the multiblock carrier growth stages (mbcgs) parameters. If nc is the current number of multiblock carriers (the main multiblock carrier excluded) managed by an allocator, the size of the next mseg_alloc multiblock carrier allocated by this allocator will roughly be smbcs+nc*(lmbcs-smbcs)/mbcgs when nc <= mbcgs, and lmbcs when nc > mbcgs. If the value of the sbct parameter should be larger than the value of the lmbcs parameter, the allocator may have to create multiblock carriers that are larger than the value of the lmbcs parameter, though. The size of multiblock carriers for small blocks is determined by the small block multiblock carrier size (sbmbcs). Singleblock carriers allocated via mseg_alloc are sized to whole pages.

Sizes of carriers allocated via sys_alloc are decided based on the value of the sys_alloc carrier size (ycs) parameter. The size of a carrier is the least number of multiples of the value of the ycs parameter that satisfies the request.

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.

The memory allocation strategy used for multiblock carriers by an allocator is configurable via the as parameter. Currently the following strategies are available:

Best fit

  Strategy: Find the smallest block that satisfies the requested block size.

  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.

Address order best fit

  Strategy: Find the smallest block that satisfies the requested block size. If multiple blocks are found, choose the one with the lowest address.

  Implementation: A balanced binary search tree is used. The time complexity is proportional to log N, where N is the number of free blocks.

Address order first fit

  Strategy: Find the block with the lowest address that satisfies the requested block size.

  Implementation: A balanced binary search tree is used. The time complexity is proportional to log N, where N is the number of free blocks.

Good fit

  Strategy: Try to find the best fit, but settle for the best fit found during a limited search.

  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 mbsd parameter.

A fit

  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.

  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.

  As of erts version 5.6.1 the emulator will refuse to use this strategy on other allocators than temp_alloc. This since it will only cause problems for other allocators.

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.

Note

Currently only allocators using the best fit and the address order best fit strategies are able to use "small block multi block carriers".

### System Flags Effecting erts_alloc

Warning

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.

Memory allocator system flags have the following syntax: +M<S><P> <V> where <S> is a letter identifying a subsystem, <P> is a parameter, and <V> is the value to use. The flags can be passed to the Erlang emulator (erl) as command line arguments.

System flags effecting specific allocators have an upper-case letter as <S>. The following letters are used for the currently present allocators:

- B: binary_alloc
- C: sbmbc_alloc
- D: std_alloc
- E: ets_alloc
- F: fix_alloc
- H: eheap_alloc
- L: ll_alloc
- M: mseg_alloc
- R: driver_alloc
- S: sl_alloc
- T: temp_alloc
- Y: sys_alloc

The following flags are available for configuration of mseg_alloc:

+MMamcbf <size>
  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.
+MMrmcbf <ratio>
  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.
+MMmcs <amount>
  Max cached segments. The maximum number of memory segments stored in the memory segment cache. Valid range is 0-30. Default value is 5.

The following flags are available for configuration of sys_alloc:

+MYe true
  Enable sys_alloc. Note: sys_alloc cannot be disabled.
+MYm libc
  malloc library to use. Currently only libc is available. libc enables the standard libc malloc implementation. By default libc is used.
+MYtt <size>
  Trim threshold size (in kilobytes). This is the maximum amount of free memory at the top of the heap (allocated by sbrk) that will be kept by malloc (not released to the operating system). When the amount of free memory at the top of the heap exceeds the trim threshold, malloc will release it (by calling sbrk). Trim threshold is given in kilobytes. Default trim threshold is 128. Note: This flag will only have any effect when the emulator has been linked with the GNU C library, and uses its malloc implementation.
+MYtp <size>
  Top pad size (in kilobytes). This is the amount of extra memory that will be allocated by malloc when sbrk is called to get more memory from the operating system. Default top pad size is 0. Note: This flag will only have any effect when the emulator has been linked with the GNU C library, and uses its malloc implementation.

The following flags are available for configuration of allocators based on alloc_util. If u is used as subsystem identifier (i.e., <S> = u) all allocators based on alloc_util will be effected. If B, D, E, F, H, L, R, S, or T is used as subsystem identifier, only the specific allocator identified will be effected:

+M<S>as bf|aobf|aoff|gf|af
  Allocation strategy. Valid strategies are bf (best fit), aobf (address order best fit), aoff (address order first fit), gf (good fit), and af (a fit). See the description of allocation strategies in "the alloc_util framework" section.
+M<S>asbcst <size>
  Absolute singleblock carrier shrink threshold (in kilobytes). When a block located in an mseg_alloc 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 rsbcst.
+M<S>e true|false
  Enable allocator <S>.
+M<S>lmbcs <size>
  Largest (mseg_alloc) multiblock carrier size (in kilobytes). See the description on how sizes for mseg_alloc multiblock carriers are decided in "the alloc_util framework" section.
+M<S>mbcgs <ratio>
  (mseg_alloc) multiblock carrier growth stages. See the description on how sizes for mseg_alloc multiblock carriers are decided in "the alloc_util framework" section.
+M<S>mbsd <depth>
  Max block search depth. This flag has effect only if the good fit strategy has been selected for allocator <S>. 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.
+M<S>mmbcs <size>
  Main multiblock carrier size. Sets the size of the main multiblock carrier for allocator <S>. The main multiblock carrier is allocated via sys_alloc and is never deallocated.
+M<S>mmmbc <amount>
  Max mseg_alloc multiblock carriers. Maximum number of multiblock carriers allocated via mseg_alloc by allocator <S>. When this limit has been reached, new multiblock carriers will be allocated via sys_alloc.
+M<S>mmsbc <amount>
  Max mseg_alloc singleblock carriers. Maximum number of singleblock carriers allocated via mseg_alloc by allocator <S>. When this limit has been reached, new singleblock carriers will be allocated via sys_alloc.
+M<S>ramv <bool>
  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.
+M<S>rmbcmt <ratio>
  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.
+M<S>rsbcmt <ratio>
  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 sbct 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.
+M<S>rsbcst <ratio>
  Relative singleblock carrier shrink threshold (in percent). When a block located in an mseg_alloc 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 asbcst.
+M<S>sbct <size>
  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.
+M<S>sbmbcs <size>
  Small block multiblock carrier size (in bytes). Memory blocks smaller than the small block multiblock carrier threshold (sbmbct) will be placed in multiblock carriers used for small blocks only. This parameter determines the size of such carriers.
+M<S>sbmbct <size>
  Small block multiblock carrier threshold (in bytes). Memory blocks smaller than this threshold will be placed in multiblock carriers used for small blocks only.
+M<S>smbcs <size>
  Smallest (mseg_alloc) multiblock carrier size (in kilobytes). See the description on how sizes for mseg_alloc multiblock carriers are decided in "the alloc_util framework" section.
+M<S>t true|false

  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:

  ll_alloc
    1 instance.
  Other allocators
    NoSchedulers+1 instances. Each scheduler will use a lock-free instance of its own and other threads will use a common instance.

  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.

Currently the following flags are available for configuration of alloc_util, i.e. all allocators based on alloc_util will be effected:

+Muycs <size>
  sys_alloc carrier size. Carriers allocated via sys_alloc will be allocated in sizes which are multiples of the sys_alloc carrier size. This is not true for main multiblock carriers and carriers allocated during a memory shortage, though.
+Mummc <amount>
  Max mseg_alloc 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 sys_alloc.

Instrumentation flags:

+Mim true|false
  A map over current allocations is kept by the emulator. The allocation map can be retrieved via the instrument module. +Mim true implies +Mis true. +Mim true is the same as -instr.
+Mis true|false
  Status over allocated memory is kept by the emulator. The allocation status can be retrieved via the instrument module.
+Mit X
  Reserved for future use. Do not use this flag.

Note

When instrumentation of the emulator is enabled, the emulator uses more memory and runs slower.

Other flags:

+Mea min|max|r9c|r10b|r11b|config
  min
    Disables all allocators that can be disabled.
  max
    Enables all allocators (currently default).
  r9c|r10b|r11b
    Configures all allocators as they were configured in respective OTP release. These will eventually be removed.
  config
    Disables features that cannot be enabled while creating an allocator configuration with erts_alloc_config(3). Note, this option should only be used while running erts_alloc_config, not when using the created configuration.

Only some default values have been presented here. erlang:system_info(allocator), and erlang:system_info({allocator, Alloc}) can be used in order to obtain currently used settings and current status of the allocators.

Note

Most of these flags are highly implementation dependent, and they may be changed or removed without prior notice.

erts_alloc is not obliged to strictly use the settings that have been passed to it (it may even ignore them).

erts_alloc_config(3) is a tool that can be used to aid creation of an erts_alloc configuration that is suitable for a limited number of runtime scenarios.

### SEE ALSO

erts_alloc_config(3), erl(1), instrument(3), erlang(3)