Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
GC marks only reachable objects and move/copy these objects to other area of heap based on the GC type - compacting or copying garbage collectors.
Refer:
en.wikipedia.org/wiki/File:Animation_of_the_Naive_Mark_and_Sweep_Garbage_Collector_Algorithm.gif
lambda.uta.edu/cse5317/notes/node47.html
Garbage collector work on Mark and sweep algorithem.It mark all the elements that have unreachable reference and garbage collect them in future. the objects that have un reachable reference goes to tenured generation from young generation survivor space
- Raj January 08, 2013