top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are generations in garbage collector?

0 votes
316 views
What are generations in garbage collector?
posted Apr 4, 2017 by Rohini Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Short-lived objects are stored in the first generation, generation 0.
The longer-lived objects are pushed into the higher generations, 1 or 2.
The garbage collector works more frequently in the lower generations than in the higher ones.
When an object is first created, it is put into generation 0

answer Apr 17, 2017 by Shweta Singh
...