[erlang-questions] Garbage collection
Mon Dec 19 13:29:18 CET 2016
I've got a couple of questions about garbage collection:
1. AFAIU, a process's heap is garbage collected when the process is
executed. A process creates and destroys new objects and when there is
no enough room for the new object in the heap, GC is invoked.
When the process is in scheduler's wait queue, then no new objects are
created, so GC isn't called.
The only exception, I see, is when new messages are sent to suspended
process: they are to be kept in receiver's heap and it may lead to GC
Is my understanding correct? Or there are other possibilities to GC
2. In OTP-19.2 sources, erts/emulator/beam/erl_gc.c:sweep_off_heap() may
reallocate ProcBins including the struct binary they point to. The list
of ProcBins to realloc is received in link_live_proc_bin(). What
prevents us to reallocate the binary that may be referenced by another
More information about the erlang-questions