usegcoverheadlimit parallelgcthreads java garbage-collection jvm g1gc g1

java - parallelgcthreads - ¿G1 GC tiene un tamaño máximo de región o cantidad máxima de región?



jvm parallelgcthreads (1)

cuando estudié GC G1, encontré este artículo: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html . En ese artículo, hay algo que dice lo siguiente:

El G1 GC es un recolector de basura regionalizado y generacional, lo que significa que el montón de objetos Java (heap) se divide en varias regiones de igual tamaño. Al iniciarse, la Máquina Virtual Java (JVM) establece el tamaño de la región. Los tamaños de región pueden variar de 1 MB a 32 MB dependiendo del tamaño del montón. El objetivo es no tener más de 2048 regiones.

¿Eso significa que el tamaño máximo de la memoria del montón de Java que G1 GC puede manejar es 2048 * 32M, y si el tamaño lo supera, ¿qué sucederá?


De las fuentes HotSpot JVM :

// Minimum region size; we won''t go lower than that. // We might want to decrease this in the future, to deal with small // heaps a bit more efficiently. static const size_t MIN_REGION_SIZE = 1024 * 1024; // Maximum region size; we don''t go higher than that. There''s a good // reason for having an upper bound. We don''t want regions to get too // large, otherwise cleanup''s effectiveness would decrease as there // will be fewer opportunities to find totally empty regions after // marking. static const size_t MAX_REGION_SIZE = 32 * 1024 * 1024; // The automatic region size calculation will try to have around this // many regions in the heap (based on the min heap size). static const size_t TARGET_REGION_NUMBER = 2048;

  • MIN_REGION_SIZE (1MB) y MAX_REGION_SIZE (32MB) son límites MAX_REGION_SIZE ;
  • TARGET_REGION_NUMBER es solo una sugerencia que se usa para calcular el tamaño de región predeterminado si no se especifica entre las opciones de JVM. El número real puede exceder este valor.