A nonrecursive list compacting algorithm
A nonrecursive list compacting algorithm
Each Erlang process has its own stack and heap which are allocated in the same memory block and grow towards each other. When the stack and the heap meet, the garbage collector is triggered and memory is reclaimed. If not enough memory was reclaimed, the heap will grow.
https://www.erlang-solutions.com/blog/erlang-garbage-collector.html#cheney