[erlang-questions] Question about Erlang's term serialization for message passing

Taavi Talvik taavi@REDACTED
Tue Mar 6 23:03:48 CET 2007


On Mar 6, 2007, at 11:21 PM, Christoph Dornheim wrote:
> when experimenting with distributed message passing and the  
> external term format
> transformation with term_to_binary, I wonder if the internal  
> encoding used for
> passing Erlang terms to local or remote processes is a  
> representation of their
> in-memory pointer structure (similar to Java's serialization of  
> object graphs)
> or if it is value-oriented like the external term format.
>
> I guess the former is true since otherwise message passing would  
> lead to
> problems such that data possibly needs more memory space in the  
> receiving
> process than in the sending one (think of sending [L,L] for L= 
> [1,2,3] from
> process P1 to P2: if something like term_to_binary is used for  
> encoding the
> received term needs the same space as [L,[1,2,3]] would have been  
> sent).

Erlang does not have any "hidden in-memory pointer structure" at all.  
As far
as I understand (i am in no way erlang guru) only receiving of values is
defined semantically. There are no "object graphs" in erlang. Only  
values as
ints, floats, pids, references, ports, lists etc.

Message size optimization probably can be implemented as implementation
specific optimization. With hybrid heap it probably is implemented as  
such.

But it is still optimization detail, which should be invisible on  
language definition level.

best regards,
taavi





More information about the erlang-questions mailing list