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

Frank Muller frank.muller.erl@REDACTED
Fri Jan 25 17:19:08 CET 2019


Hey Dmytro

So no matter if receiving process exists or not, those 100000000 messages
have to be copied on the sender’s heap until next garbage collection is
performed? Did I get it correctly?

/Frank

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 <frank.muller.erl@REDACTED>
> 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
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190125/0428d321/attachment.htm>


More information about the erlang-questions mailing list