[erlang-questions] Question about Erlang's term serialization for message passing
Wed Mar 7 00:15:30 CET 2007
On 3/6/07, Christoph Dornheim <cd5@REDACTED> wrote:
> Taavi Talvik <taavi <at> uninet.ee> writes:
> > 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
> At the language level, all data are values, but at the implementation level data
> is built up by pointers to memory locations; so an Erlang term is internally
> represented by a graph-like pointer structure. E.g. when creating a new list
> L'=[a|L] from some list L their internal representations share memory since,
> internally, L' has a pointer to L.
> See also http://article.gmane.org/gmane.comp.lang.erlang.general/16122/
Does it really matter though? It sounds very implementation dependent.
If you're trying to reduce identical terms for transfer you're
probably going to do pretty well just using term_to_binary/2 with
If you're trying to minimize memory consumption you ought to be using
data structures that have that property (independent of VM specific
optimizations) in the first place.
More information about the erlang-questions