fix(force_shutdown): add some comments for the range of max_heap_size
This commit is contained in:
parent
844133c7c5
commit
1245020ec0
|
@ -224,15 +224,18 @@ tune_heap_size(#{max_heap_size := MaxHeapSize}) ->
|
|||
});
|
||||
tune_heap_size(undefined) -> ok.
|
||||
|
||||
%% We multiply the size with factor ?OOM_FACTOR, to give the
|
||||
%% process a chance to suicide by `check_oom/1`
|
||||
must_kill_heap_size(Size) ->
|
||||
%% We set the max allowed heap size by `erlang:process_flag(max_heap_size, #{size => Size})`,
|
||||
%% where the `Size` cannot be set to an integer lager than `(1 bsl 59) - 1` on a 64-bit system,
|
||||
%% or `(1 bsl 27) - 1` on a 32-bit system.
|
||||
MaxAllowedSize = case erlang:system_info(wordsize) of
|
||||
8 -> % arch_64
|
||||
(1 bsl 59) - 1;
|
||||
4 -> % arch_32
|
||||
(1 bsl 27) - 1
|
||||
end,
|
||||
%% We multiply the size with factor ?OOM_FACTOR, to give the
|
||||
%% process a chance to suicide by `check_oom/1`
|
||||
case ceil(Size * ?OOM_FACTOR) of
|
||||
Size0 when Size0 >= MaxAllowedSize -> MaxAllowedSize;
|
||||
Size0 -> Size0
|
||||
|
|
Loading…
Reference in New Issue