How does Java Garbage Collection work? How would you implement garbage collection?
Interview Answers
Anonymous
Mar 2, 2013
Look on youtube.. It's an entire lecture about it on UCLA's channel.
1
Anonymous
Mar 7, 2016
Description without details:
1. Keeps reference count for each object(which is a pointer)
2. Increments/decrement a these counters when need
3. When there is no enough memory for a new object or after some timeout(actually there are many decision making algorithms for go) it iterates over all counters and frees memory used for objects with ref count == 0.