In the official documentation of G1 GC,Garbage-First Garbage Collector, there is one part says like this:
There is, however, a special provision for humongous objects for arrays of primitive types for example, bool, all kinds of integers, and floating point values.
what does these words mean? I couldn't find any reference in google, is the java process directly put it in the Tenured Generation the allocating an arrays of primitive types, I'm really confused, could any one help me, is the an official explanation?
Arrays of those primitives are treated as humungous objects if the array size exceeds half of a G1 region (the same as for other objects). However, when it comes to reclaiming these arrays G1 treats them differently, in that it will try to reclaim them during any type of collection pause. In order to do that safely, the collector needs to check any links to the array to ensure that it can no longer be accessed. That's why the documentation says, " G1 opportunistically tries to reclaim humongous objects if they are not referenced by many objects..." This might seem a bit confusing because you expect to reclaim something only if it has no references.
This bug explains the rationale behind the way this is worded https://bugs.openjdk.java.net/browse/JDK-8048179
Also, this blog post provides more detail https://blogs.oracle.com/poonam/eager-reclamation-of-humongous-objects-with-g1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With