Reference counting
This is an excellent GC method where all objects are identified according to the number of references. A garbage object is the one that does not have any associated references and has a zero count. Each time an object is referenced, the count is increased. The count decreases whenever a particular reference is eliminated.
The memory is only reclaimed when a particular object’s reference count approaches zero. This method does not require the tracing of objects for GC as reference counting destroys objects the moment their references are eliminated completely. This reduces the need for virtual memory as well as CPU cache required for better computational power.
This method has some disadvantages that are avoided with the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access