[erlang-questions] message copying overhead atoms vs binaries

David Mercer dmercer@REDACTED
Mon Jan 10 19:39:25 CET 2011


On Monday, January 10, 2011, Paolo Negri wrote:

> There's a sentence in [2] that I can't fully understand.
> 
> "Heap binaries are small binaries, up to 64 bytes, that are stored
> directly on the process heap. They will be copied when the process is
> garbage collected and when they are sent as a message. They don't
> require any special handling by the garbage collector."
> 
> Specifically I'm confused about why (and where) heap binaries will be
> copied when the process is garbage collected.

[I'm not the expert, but since no-one jumped up to answer, I'll give you
what I think is the answer, and if no-one more qualified answers, mine can
be considered the default correct answer.]

Presumably, the Erlang runtime uses a copying garbage collector when it
garbage collects a process.  At a high level: it creates a new heap area and
copies the "active" portions of the old heap to the new, and then returns
the old heap area in its entirety to the system for reuse.  There are
umpteen variations on this, but at a high level, I'm guessing that is what
is meant by copying during garbage collection.

Cheers,

DBM



More information about the erlang-questions mailing list