Memory in Erlang

I hope others with a deeper understanding can provide more details, but at the high level, the main differences with BEAM is:

  1. Each process has its own separate heap. This means less data for any particular garbage collector to have to deal with. It also means for short lived processes, there may be no need for any GC at all because the whole memory allocated to the process is freed in a single block when it completes.

  2. Persistent data structures. These immutable data structures share parts of themselves with new “copies” that are derived from them. This means new allocations are often smaller diffs, resulting in less danger of fragmentation.

6 Likes