39
In the JEP-248 the definition of G1 has been discussed (Garbage First Collector) as the standard Garbage Collector on Java 9. In this period, I have heard many quotes about the G1, but very little material has deeper details or comparisons as for example with the CMS (Concurrent Mark and Sweep), which today would be the GC "pattern" in production applications with minimum performance requirements.
Since the automatic memory management provided by JVM is one of the crucial points of the platform, I would like a deeper view of why (pros and cons) the adoption of this new Garbage Collector, in addition to a parallel with the existing implementations.
I will follow this question +1
– Wellington Avelino
Is it even possible to answer this in the case of a closed source product? The "Tchan" of this G1 seems to be the subdivision of memory into blocks, and the prioritization of doing GC on near-empty blocks, including moving objects out of the block in order to free it. This avoids a typical problem of systems with GC: using a memory truck, with objects occupying this memory very sparsely. Details of how this is actually implemented, just looking at the code, and certainly the G1 will perform worse on specific loads (although it should be better in the average case, otherwise they would not use.)
– epx
I still think there is reasonable room for improvement in the answers, I have a reasonable knowledge of G1 it has been implemented/used since 2009. I will see if I complement the answer before setting it as correct. Thank you for the @Ciganomorrisonmendez reward
– Reginaldo Soares
Regis, set the fire there. It’s an hour before the reward ends.
– Leonel Sanches da Silva
I don’t have an answer, but that reference (in English) seems to describe the process fairly well. If I had seen the question earlier, I could risk a translation, but at first sight I believe that the answer from Daniel touches on all the important points - although without going into too much detail (in my interpretation, the GC of Java has been generational for a long time, so that’s not the news; what improved, it seems to me, was just the same implementation).
– mgibsonbr