Generational GC
Learn Generational GC (Garbage Collection, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
6. Basic Concepts Why Split the Heap into Generations? Studies of real programs found a simple but powerful pattern: most objects die young . A temporary string built inside a loop, a short-lived request object, a local list used once and discarded - these are created and thrown away within milliseconds. Very few objects (a cache, a database connection pool, a singleton service) live for the entire lifetime of the application. Java's Garbage Collector takes advantage of this by dividing the heap into generations and treating young and old objects differently.