April 2018
Intermediate to advanced
300 pages
7h 41m
English
There are three kinds of generation in garbage collection known as Generation 0, Generation 1, and Generation 2. In this section, we will look at the concept of generations and how it affects the performance of the garbage collector.
Let's suppose we run an application that creates three objects named Object1, Object2, and Object3. These objects will allocate the memory in Generation 0:

Now, when the garbage collector runs (this is an automatic process, unless you explicitly call the garbage collector from the code), it checks for the objects that are not needed by the application and have no reference in the program. It ...