[erlang-questions] message copying or by reference

Kostis Sagonas <>
Tue Jun 26 22:12:13 CEST 2007


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



More information about the erlang-questions mailing list