Original blog address, Http://www.linkedin.com/pulse/garbage-collection-erlang-tianpo-gao?trk=prof-post.
This article will simply describe the garbage collection of Erlang, which is not an in-depth discussion.
When performing a partial garbage collection, the garbage collector only recycles the younger generation and moves the old generation to the old-time dedicated heap. When an Erlang term undergoes 2 to 3 partial garbage collection, the term will be promoted to the old age. When a full amount of recycling is carried out, the garbage collector will recycle the young generation and the old age.
So how do we divide the memory objects into different generations? In the Erlang runtime environment, there is a field called High_water in the control block PCB of the Erlang process. When a term's address stored on the Erlang process heap is larger than the value stored in the High_water, then this term is the young generation, which is the old age.
A generational collector that pauses and replicates when memory is reclaimed in the Erlang runtime environment. Each time a garbage collection is made, a new heap is created, and when the garbage collection is complete, the original heap of the Erlang process is freed, and the new heap becomes the heap of the current Erlang process, and the surviving data in the original heap is moved to the new heap.
Let's talk about Erlang's garbage collection.