[erlang-questions] message copying or by reference

Paul Mineiro <>
Wed Jun 27 02:26:29 CEST 2007


According to Joe's new book, binaries are reference counted, so messages
with large binaries in them are very cheap to sling around.  It is also
cheap to stick binaries in ets tables, if side effects are your cup of tea.

-- p

On Tue, 26 Jun 2007, Kostis Sagonas wrote:

> Damien Morton wrote:
> > When I send a message from one process to another on the same node, is
> > that message passed by copying or by reference.
> >
> > Lets say I have an agent which is maintaining a largish internal state
> > (i.e. several 10s ro 100s of KB when serialised) and wants to send a
> > good portion of that to another process (i.e. if the state is thought of
> > as a tree, then several subtrees might be sent). How is this handled?
>
> The default Erlang/OTP system uses copying.
>
> However, the distribution also comes with an (unsupported by Ericsson)
> configuration where message sending happens mostly by passing a
> reference.  You can try this by starting the system as
>
> 	erl -hybrid
>
> There is also a relevant publication (*) where a related static analysis
> and various tradeoffs of both configurations are discussed.
>
> Kostis
>
> (*) http://user.it.uu.se/~kostis/Papers/toplas06.pdf
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>

Ignorance of what is going on is no barrier to confidence.



More information about the erlang-questions mailing list