[erlang-bugs] proc_lib relies on immutable dictionary
Bjorn Gustavsson
bgustavsson@REDACTED
Thu Nov 27 15:08:36 CET 2008
On Thu, Nov 27, 2008 at 2:30 PM, mats cronqvist <masse@REDACTED> wrote:
>
> exit_p(Class, Reason) ->
> {M,F,A} = get('$initial_call'),
> MFA = {M,F,make_dummy_args(A, [])},
> crash_report(Class, Reason, MFA),
> exit(Reason).
>
> exit_p now (for no apparent reason) relies on the user not clearing
> the dictionary.
My fault. I noticed that the initial MFA was passed around in the loop
just to be just when the process
exited, which I found wasteful as the the value could just as well be
retrieved from the process dictionary.
If there is a good reason for clearing the process dictionary, I could
change back the implementation in
R13.
Note that from R12B-5, the entire initial arguments are not saved in
the process dictionary:
OTP-7531 Processes spawned using proc_lib (including gen_server and
other library modules that use proc_lib) no longer keep the
entire argument list for the initial call, but only the
arity.
Also, if proc_lib:spawn/1 is used to spawn a fun, the actual
fun is not kept, but only module, function name, and arity of
the function that implements the fun.
The reason for the change is that keeping the initial fun (or
a fun in an argument list), would prevent upgrading the code
for the module. A secondary reason is that keeping the fun
and function arguments could waste a significant amount of
memory.
The drawback with the change is that the crash reports will
provide less precise information about the initial call (only
Module:Function/Arity instead of Module:Function(Arguments)).
The function proc_lib:initial_call/1 still returns a list,
but each argument has been replaced with a dummy atom.
/Bjorn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-bugs
mailing list