The following allocators are present:
The main idea with the
Internally a framework called
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
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 (
Blocks that are smaller than the value of parameter
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
If
Sizes of carriers allocated through
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.
Strategy: Find the smallest block satisfying 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.
Strategy: Find the smallest block satisfying 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.
Strategy: Find the block with the lowest address satisfying 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.
Strategy: Find the carrier with the lowest address that can satisfy the requested block size, then find a block within that carrier using the "best fit" strategy.
Implementation: Balanced binary search trees are used. The time complexity is proportional to log N, where N is the number of free blocks.
Strategy: Find the carrier with the lowest address that can satisfy the requested block size, then find a block within that carrier using the "address order best fit" strategy.
Implementation: Balanced binary search trees are used. The time complexity is proportional to log N, where N is the number of free blocks.
Strategy: Find the oldest carrier that can satisfy the requested block size, then find a block within that carrier using the "address order first fit" strategy.
Implementation: A balanced binary search tree is used. The time complexity is proportional to log N, where N is the number of free blocks.
Strategy: Find the oldest carrier that can satisfy the requested block size, then find a block within that carrier using the "best fit" strategy.
Implementation: Balanced binary search trees are used. The time complexity is proportional to log N, where N is the number of free blocks.
Strategy: Find the oldest carrier that can satisfy the requested block size, then find a block within that carrier using the "address order best fit" strategy.
Implementation: Balanced binary search trees are used. The time complexity is proportional to log N, where N is the number of free blocks.
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)
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 can be configured using parameter
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 from ERTS 5.6.1 the emulator refuses to
use this strategy on other allocators than
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.
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:
System flags effecting specific allocators have an uppercase
letter as
Absolute maximum 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. Defaults to
Relative maximum 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 maximum cache bad fit
percent of the requested size. Defaults to
Sets
Setting this flag to
Sets
Sets
What reservation of physical memory means, highly depends on the operating system, and how it is configured. For example, different memory overcommit settings on Linux drastically change the behavior.
Setting this flag to
Sets super carrier size (in MB). Defaults to
Maximum cached segments. The maximum number of memory segments
stored in the memory segment cache. Valid range is
Enables
Trim threshold size (in kilobytes). This is the maximum amount
of free memory at the top of the heap (allocated by
This flag has effect only when the emulator is linked with
the GNU C library, and uses its
Top pad size (in kilobytes). This is the amount of extra
memory that is allocated by
This flag has effect only when the emulator is linked with
the GNU C library, and uses its
If
Abandon carrier utilization limit. A valid
Carriers are abandoned when
memory utilization in the allocator instance falls below the
utilization value used. Once a carrier is abandoned, no new
allocations are made in it. When an allocator instance gets an
increased multiblock carrier need, it first tries to fetch an
abandoned carrier from another allocator instance. If no abandoned
carrier can be fetched, it creates 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
This feature also requires
Abandon carrier free block min limit. A valid
See also
Abandon carrier number limit. A valid
See also
Allocation strategy. The following strategies are valid:
See the description of allocation strategies in section
Absolute singleblock carrier shrink threshold (in
kilobytes). When a block located in an
Adds a small tag to each allocated block that contains basic
information about what it is and who allocated it. Use the
The runtime overhead is one word per allocation when enabled. This may change at any time in the future.
The default is
Enables allocator
Largest (
(
Maximum block search depth. This flag has effect only if the
good fit strategy is selected for allocator
Main multiblock carrier size. Sets the size of the main
multiblock carrier for allocator
Maximum
Maximum
Realloc always moves. When enabled, reallocate operations are more or less translated into an allocate, copy, free sequence. This often reduces memory fragmentation, but costs performance.
Relative multiblock carrier move threshold (in percent). When a block located in a multiblock carrier is shrunk, the block is moved if the ratio of the size of the returned memory compared to the previous size is more than this threshold, otherwise the block is shrunk at the current location.
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 parameter
Relative singleblock carrier shrink threshold (in
percent). When a block located in an
Singleblock carrier threshold (in kilobytes). Blocks larger than this threshold are placed in singleblock carriers. Blocks smaller than this threshold are placed in multiblock carriers. On 32-bit Unix style OS this threshold cannot be set > 8 MB.
Smallest (
Multiple, thread-specific instances of the allocator.
This option has only effect on the runtime system
with SMP support. Default behavior on the runtime system with
SMP support is
Before ERTS 5.9 it was possible to configure a smaller number of thread-specific instances than schedulers. This is, however, not possible anymore.
All allocators based on
Maximum
Allow
Adds a small tag to each allocated block that contains basic
information about what it is and who allocated it. See
Reserved for future use. Do not use this flag.
When instrumentation of the emulator is enabled, the emulator uses more memory and runs slower.
Options:
Disables all allocators that can be disabled.
Enables all allocators (default).
Configures all allocators as they were configured in respective Erlang/OTP release. These will eventually be removed.
Disables features that cannot be enabled while creating an
allocator configuration with
This option is to be used only while running
Lock physical memory. Defaults to
Only some default values have been presented here. For information
about the currently used settings and the current status of the
allocators, see
Most of these flags are highly implementation-dependent and can be changed or removed without prior notice.
The