I was reading recently about Gargabe collection in Java and I came to find Plumbr company their blogs about this theme. I came to this book . The info I summarized below is basically from that source and others . This is the first article about this topic and introduces the main concepts.
Garbage Collector – GC
Very well known, the garbage collector is the automated tool used for reclamation of unused memory eliminating. Such automation is called Garbage Collection.
The so well debated Garbage Collector is one of those things that make Java such a special language actually.
Fragmenting and Compacting
If we eliminate the objects, considering that they are randomly distributed, the after fragmenting, it’s also an interesting thing to compact the memory. This process actually takes time and requires
Young and Tenured (Old)
The distribution of objects is done according to the time of creation/assignment time and by classifying those objects we pretty much get a complete and accurate picture about the objects, in a screenshot.
Stop The World pause
Basically is when the application is temporarily paused so the GC can do its complete work and clean the objects, but since they keep changing, we need to pause the application and take a screenshot of the application so the GC can delete real objects.
There are many algorithms that can be used in the GC that take different approaches for young and tenured objects, in other words, we can delete those objects using different ways.