Garbage First (G1)
The Garbage First collector is the most recent implementation. It is a server-side implementation that tends to decrease the pauses and concurrently works with the application. It introduces a new way of visualizing the heap.
The heap is divided into constant-sized regions. The G1 starts to mark the regions concurrently. After this phase, it knows which regions are almost empty and then starts collecting the memory from these regions, allowing the G1 to get a lot of memory pretty quickly and without much effort. This is where the name of this algorithm comes from. Then, in the compact phase, G1 can copy objects from multiple regions to a single region to ensure that it stays efficient.
An important thing to know about the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access