A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.erlang.org/doc/apps/erts/erts_alloc below:

erts_alloc — erts v16.0.1

An Erlang runtime system internal memory allocator library.

Description

erts_alloc is an Erlang runtime system internal memory allocator library. erts_alloc provides the Erlang runtime system with a number of memory allocators.

Allocators

The following allocators are present:

sys_alloc, literal_alloc and temp_alloc are 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.

The main idea with the erts_alloc library is to separate memory blocks that are used differently into different memory areas, to achieve 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, so 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 through mseg_alloc), or in the heap segment (allocated through sys_alloc).

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

Sizes of multiblock carriers allocated through mseg_alloc are decided based on the following 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 is roughly smbcs+nc*(lmbcs-smbcs)/mbcgs when nc <= mbcgs, and lmbcs when nc > mbcgs. If the value of parameter sbct is larger than the value of parameter lmbcs, the allocator may have to create multiblock carriers that are larger than the value of parameter lmbcs, though. Singleblock carriers allocated through mseg_alloc are sized to whole pages.

Sizes of carriers allocated through 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 parameter ycs satisfying 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 can be configured using parameter as. The following strategies are available:

Apart from the ordinary allocators described above, some 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 runtime system starts. As long as pre-allocated memory is available, it is used. When no pre-allocated memory is available, memory is allocated in ordinary allocators. These pre-allocators are typically much faster than the ordinary allocators, but can only satisfy a limited number of requests.

System Flags Effecting erts_alloc Warning

Only use these flags if you are sure what you are doing. Unsuitable settings can 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(1)) as command-line arguments.

System flags effecting specific allocators have an uppercase letter as <S>. The following letters are used for the allocators:

Flags for Configuration of mseg_alloc Flags for Configuration of sys_alloc Flags for Configuration of Allocators Based on alloc_util

If u is used as subsystem identifier (that is, <S> = u), all allocators based on alloc_util are effected. If B, D, E, F, H, I, L, R, S, T, X is used as subsystem identifier, only the specific allocator identifier is effected.

Flags for Configuration of alloc_util

All allocators based on alloc_util are effected.

Special Flag for literal_alloc Instrumentation Flags Note

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

Other Flags Notes

Only some default values have been presented here. For information about the currently used settings and the current status of the allocators, see erlang:system_info(allocator) and erlang:system_info({allocator, Alloc}).

Note

Most of these flags are highly implementation-dependent and can be changed or removed without prior notice.

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

See Also

erl(1), erlang, instrument


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4