Age | Commit message (Collapse) | Author |
|
* raimo/polish-gen_statem/OTP-13065:
Reword 'dispatch' into 'branch depending'
|
|
|
|
* lukas/erts/max_heap_size/OTP-13174:
erts: Fix max heap size exit when in hipe mode
Update preloaded modules
erts: Fix pre-bif yield current_function
erts: Implement max_heap_size process flag
|
|
|
|
The max_heap_size process flag can be used to limit the
growth of a process heap by killing it before it becomes
too large to handle. It is possible to set the maximum
using the `erl +hmax` option, `system_flag(max_heap_size, ...)`,
`spawn_opt(Fun, [{max_heap_size, ...}])` and
`process_flag(max_heap_size, ...)`.
It is possible to configure the behaviour of the process
when the maximum heap size is reached. The process may be
sent an untrappable exit signal with reason kill and/or
send an error_logger message with details on the process
state. A new trace event called gc_max_heap_size is
also triggered for the garbage_collection trace flag
when the heap grows larger than the configured size.
If kill and error_logger are disabled, it is still
possible to see that the maximum has been reached by
doing garbage collection tracing on the process.
The heap size is defined as the sum of the heap memory
that the process is currently using. This includes
all generational heaps, the stack, any messages that
are considered to be part of the heap and any extra
memory the garbage collector may need during collection.
In the current implementation this means that when a process
is set using on_heap message queue data mode, the messages
that are in the internal message queue are counted towards
this value. For off_heap, only matched messages count towards
the size of the heap. For mixed, it depends on race conditions
within the VM whether a message is part of the heap or not.
Below is an example run of the new behaviour:
Eshell V8.0 (abort with ^G)
1> f(P),P = spawn_opt(fun() -> receive ok -> ok end end, [{max_heap_size, 512}]).
<0.60.0>
2> erlang:trace(P, true, [garbage_collection, procs]).
1
3> [P ! lists:duplicate(M,M) || M <- lists:seq(1,15)],ok.
ok
4>
=ERROR REPORT==== 26-Apr-2016::16:25:10 ===
Process: <0.60.0>
Context: maximum heap size reached
Max heap size: 512
Total heap size: 723
Kill: true
Error Logger: true
GC Info: [{old_heap_block_size,0},
{heap_block_size,609},
{mbuf_size,145},
{recent_size,0},
{stack_size,9},
{old_heap_size,0},
{heap_size,211},
{bin_vheap_size,0},
{bin_vheap_block_size,46422},
{bin_old_vheap_size,0},
{bin_old_vheap_block_size,46422}]
flush().
Shell got {trace,<0.60.0>,gc_start,
[{old_heap_block_size,0},
{heap_block_size,233},
{mbuf_size,145},
{recent_size,0},
{stack_size,9},
{old_heap_size,0},
{heap_size,211},
{bin_vheap_size,0},
{bin_vheap_block_size,46422},
{bin_old_vheap_size,0},
{bin_old_vheap_block_size,46422}]}
Shell got {trace,<0.60.0>,gc_max_heap_size,
[{old_heap_block_size,0},
{heap_block_size,609},
{mbuf_size,145},
{recent_size,0},
{stack_size,9},
{old_heap_size,0},
{heap_size,211},
{bin_vheap_size,0},
{bin_vheap_block_size,46422},
{bin_old_vheap_size,0},
{bin_old_vheap_block_size,46422}]}
Shell got {trace,<0.60.0>,exit,killed}
|
|
* raimo/polish-gen_statem/OTP-13065:
Fix all seealso and other minor changes
Editorial update
|
|
|
|
raimo/polish-gen_statem/OTP-13065
Conflicts:
lib/stdlib/doc/src/gen_statem.xml
|
|
* bjorn/stdlib/warning-and-error/OTP-13476:
Add documentation
epp: Add the -error and -warning directives
epp: Refactor expansion of header path
|
|
|
|
* raimo/polish-gen_statem/OTP-13065:
Fix documentation
Clean up terminate functions
Fix callback mode after code change not used
Restructure loop_* to clarify S handling
|
|
|
|
If one of several alternatives configurations are required for
an Erlang module to compile, but none are available, it would
be useful to give a nice error message. For example:
-ifdef(CONFIG_A).
%% Some code if A is true.
-else.
-ifdef(CONFIG_B).
%% Some code if B is true.
-else.
-error("Neither CONFIG_A nor CONFIG_B are available").
-endif.
-endif.
If neither CONFIG_A nor CONFIG_B are defined, the error message
will be:
module.erl:10: -error("Neither CONFIG_A nor CONFIG_B are available").
That is basically the same behavior as for the #error directive in
GCC.
For symmetry with the -error directive, add the -warning
directive to generate a compiler warning. For example:
-ifdef(HAVE_COOL_FEATURE).
%% Code if we have Cool Feature.
-else.
%% Inefficient fallback code.
-warning("Using inefficient fallback").
-endif.
If HAVE_COOL_FEATURE is not defined, the warning message will
be:
module.erl:8: Warning: -warning("Using inefficient fallback").
That is basically the same behavior as for the #warning directive
in GCC.
Conflicts:
lib/stdlib/src/epp.erl
lib/stdlib/test/epp_SUITE.erl
|
|
scan_include_lib/4 uses a helper function find_lib_dir/1, which has a
strange interface. It takes a string and returns a tuple. The caller
must match the tuple and call fname_join/1 to obtain the desired
result. I assume that the strange interface was not noticed because
the function is only used in one place.
Replace the find_lib_dir/1 with a new expand_lib_dir/1 function which
does the entire job in one go. The new function is much easier to
reuse in other places, which we might want to do in a future commit.
|
|
* egil/stdlib/fix-maps-alias/ERL-135/OTP-13534:
stdlib: Strengthen map pattern tests
stdlib: Add lint tests for parallel match of maps
stdlib: Refactor erl_lint_SUITE
stdlib: Fix linting of map key variables
|
|
* lukas/erts/rename_xmqd_to_hmqd/OTP-13366:
erts: Rename erl flag +xmqd to +hmqd in erlexec
Fix proc_lib message_queue_data spec
erts: Fix total_heap_size calculation for on_heap
erts: Rename erl flag +xmqd to +hmqd
|
|
|
|
|
|
|
|
Map keys cannot be bound and then used in parallel matching.
Example:
#{ K := V } = #{ k := K } = M.
This is illegal if 'K' is not already bound.
|
|
* jlouis/stdlib/implement-lists-join/PR-1012/OTP-13523:
Implement lists:join/2
|
|
'...' is allowed at the end of of association types.
|
|
Type information is stored in erl_bif_types for certain BIFs.
This fact must be stated in the type specification for the
stubs that are superceded by erl_bif_types.
* Shadowed by erl_bif_types: maps:from_list/1
* Shadowed by erl_bif_types: maps:get/2
* Shadowed by erl_bif_types: maps:is_key/2
* Shadowed by erl_bif_types: maps:merge/2
* Shadowed by erl_bif_types: maps:put/3
* Shadowed by erl_bif_types: maps:to_list/1
* Shadowed by erl_bif_types: maps:update/3
|
|
|
|
|
|
Using the new type syntax, we can specify which keys are required, and
which are optional in a way Dialyzer could use.
|
|
erl_types typesets mandatory keys with :=, and uses "..." as a shorthand
for "any() => any()". Add these to erl_parse so that all representable
types can be written in type-specs.
|
|
* egil/maps-api-additions/PR-1025/OTP-13522:
stdlib: Document maps:update_with/3,4
stdlib: Add tests for maps:update_with/3,4
stdlib: Add maps:update_with/3,4
erts: Add tests for maps:take/2
stdlib: Document maps:take/2
erts: Add BIF maps:take/2
|
|
|
|
|
|
|
|
Maps equivalent to dict:update/3,4
|
|
|
|
|
|
|
|
* raimo/polish-gen_statem/OTP-13065:
Fix hibernation subtlety
|
|
|
|
|
|
|
|
* raimo/new-gen-state-machine/OTP-13065: (52 commits)
Add section on state filtering
Promote gen_statem over gen_fsm
Modify code_change/4 to return CallbackMode
Use ?NAME macro in examples
Introduce Fred Herbert suggested additions
Introduce corrections from Fred Hebert and Ingela
Use .png pictures instead of .gif
Write Design Principles chapter
Fix missing short forms for event timeout
Do more intricate Fred Hebert doc changes
Change Caller -> From as suggested by Fred Hebert
Do documentation improvements from Fred Hebert
Fix broken documenation reference
Rename state_timeout -> event_timeout
Fix most of the system docs and emacs mode
Change code_change/4 to {ok,State,Data}
Fixup sharpened test suite
Sharpen test suite
Remove the remove_event action and all alike
Relax caller() type check and cleanup
...
Conflicts:
lib/stdlib/src/gen.erl
lib/stdlib/src/gen_event.erl
lib/stdlib/src/gen_fsm.erl
lib/stdlib/src/gen_server.erl
lib/stdlib/test/error_logger_forwarder.erl
|
|
The use case is not cryptographical but we want to compare Erlang
implementation to c implementation so use crypto:strong_rand_bytes anyway.
|
|
OpenSSL has deprecated the function RAND_pseudo_bytes used by
crypto:rand_bytes/1, so this function is now deprecated in OTP too.
rand_bytes/3 also used this function, but was not documented
so we can remove it right away.
This commit also removes the fallback in generate_key to use
rand_bytes/1 if strong_rand_bytes/1 throws low entropy.
This is a potential incompatibility but we think it is desirable
as crypto should provide cryptographically secure functions.
|
|
|
|
|
|
Also move check of non-atom states in callback mode
state_functions to where the state function is called.
This gives homogenous diagnostics for state functions,
code_change/4 and system_replace_state StateFun.
Irregularities pointed out by James Fish.
|
|
Dialyzer would warn about uses of the ?assert(BoolExpr) macro in assert.hrl
if the argument was known to be boolean-only.
|
|
|
|
|
|
|
|
|