DEVFYI - Developer Resource - FYI

What are generations in Garbage Collection terminolgy? What is its relevance?

Java Interview Questions and Answers (part 3)


(Continued from previous question...)

429. What are generations in Garbage Collection terminolgy? What is its relevance?

Garbage Collectors make assumptions about how our application runs. Most common assumption is that an object is most likely to die shortly after it was created: called infant mortality. This assumes that an object that has been around for a while, will likely stay around for a while. GC organizes objects into generations (young, tenured, and perm). This tells that if an object lives for more than certain period of time it is moved from one generation to another generations( say from young -> tenured -> permanent). Hence GC will be run more frequently at the young generations and rarely at permanent generations. This reduces the overhead on GC and gives faster response time.

(Continued on next question...)

Other Interview Questions