[erlang-questions] Sending messages to non-existing process

Dmytro Lytovchenko <>
Fri Jan 25 16:52:42 CET 2019


1. A lookup of the process is performed in the dictionary of all pids.
2. Having null result, the message is dropped (and remains in sender's heap
until the next garbage collection)

There should be no side effect other than the cost of locking/unlocking
processes dict for that lookup.
Sudden process registration should from that moment have all messages
copied into the receiving heap, one copy per send, creating 100000000
copies on the receiver heap.


On Fri, 25 Jan 2019 at 15:50, Frank Muller <>
wrote:

> Hey guys
>
> Is there any side effect of sending an infinite stream of messages to a
> non-existing process registered by name?
>
> Ex.
> 1> Term = ….
> 2> register(foo, self()).
> 3> 1 / 0.
> 4> [ foo ! Term || _ <- lists:eq(1. 10000000000000) ].
>
> I’m curious about how the VM handles this scenario internally:
>
> 1. messages are simply discarded? And if this the case, will this hurt the
> VM’s performances?
> 2. something else???
>
> Finally, what will happen if during the sending, a process get registered
> with name 'foo' ?
>
> Thanks in advance
> /Frank
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190125/56ed6b7d/attachment.html>


More information about the erlang-questions mailing list