Memory handling description?
Matthias Lang
matthias@REDACTED
Thu Sep 11 12:30:34 CEST 2003
Zoltan Peter Toth writes:
> Can anybody give me a reference to some technical document that
> outlines how memory handling (heap, variable storage, message
> passing, etc) is done in the Erlang machine ?
> (e.g. when is memory allocated, released, etc.)
I am not an expert on Erlang's memory handling, but until an expert
answers, this may be better than no answer at all. It applies to the
"normal" beam system, i.e. not the shared heap.
- There is no document about it. Complete source code is freely
available but hard to understand.
- Erlang uses a garbage collector. If you don't know what that is,
the GC FAQ may be of interest:
http://www.iecc.com/gclist/GC-faq.html
- Each Erlang process has its own heap and its own stack.
- There is a separate heap for binaries above a certain size.
Such binaries are referred to by reference from e.g. process
heaps.
- Whenever a process needs more heap space, it will try to
recover space by GCing. Failing that, it grows the heap.
- Messages are passed between processes by copying them to the
target process' heap. Large binaries are passed by reference.
- When a process dies, all of its memory is given back to the
runtime system.
- ETS uses its own pool of memory
Matthias
More information about the erlang-questions
mailing list