G1 垃圾收集器是否为每个区域使用相同的区域大小?

Does G1 garbage collector use the same region size for every region?

Oracle 的 Getting Started with the G1 Garbage Collector 教程介绍了 G1 垃圾收集器的区域大小:

The heap is one memory area split into many fixed sized regions.

[...]

Region size is chosen by the JVM at startup. The JVM generally targets around 2000 regions varying in size from 1 to 32Mb.

不清楚是否所有区域在 JVM 中都具有相同的大小,或者可能存在不同大小的区域(例如,1500 个大小为 1MB 的区域和 500 个大小为 2MB 的区域)。

是的,区域大小相等。文章 Garbage First Garbage Collector Tuning 说:

The G1 GC is a regionalized and generational garbage collector, which means that the Java object heap (heap) is divided into a number of equally sized regions.

JVM 旨在创建大约 2000 个区域。它们的实际大小取决于您的最小堆大小。