Question

I was playing with the process dictionary inside a gen_server module, i called get() function and i get something like this.

{'$ancestors',[main_server,<0.30.0>]},
{'$initial_call',{child_server,init,1}}]

what happen if i erased the process dictionary, what would go wrong ?
i erased it and every thing worked fine, even calling a function that generates an exception in the child_server the main_server still can get the exit signal.

Était-ce utile?

La solution

$ancestors is used only in the initialization stage, to get the parent's PID, which is used to catch the EXIT message coming from the parent, so that the terminate stuff can get executed. Erasing this key when the server is up and running makes no difference.

$initial_call, on the other hand, is used in the crash report by proc_lib to dump the MFA info.

A quick grep in the OTP source tree can certainly help.

Autres conseils

I think some debug functions may use process dictionary, for example erlang:process_info/2

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top