Profile Image
vishnupriya

What is G1 garbage collector tuning: -XX:G1HeapRegionSize?

What is G1 garbage collector tuning: -XX:G1HeapRegionSize? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xx-g1heapregionsize

  • x-g1heapregionsize

  • G1 garbage collector tuning

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

You can set size of regions into which java heap is divided using G1 GC:

 

-XX:G1HeapRegionSize=size,  where size is desired size for the regions.

 

Examples:

 

To set the size of the subdivisions to 16 MB use:

 

-XX:G1HeapRegionSize=16m

 

Description:

 

G1 (Garbage First) GC is designed for apps in multi-processor environments with large memory space (more than 4GB). It is available from the JDK7 Update 4. Unlike other collectors, the G1 collector partitions the heap into a set of equal-sized heap regions (usually 1MB to 32MB) chunks, prioritizes them, and then performs the garbage collection on those chunks based on the priority. We can tune G1 with additional options, one of them is G1HeapRegionSize. It sets the size of the regions into which the Java heap is subdivided when using the garbage-first (G1) collector. The value is a power of 2 and can range from 1 MB to 32 MB. The default region size is determined ergonomically based on the heap size with a goal of approximately 2048 regions.

 

Default Value:

 

Default value platform-dependent.

 

Errors:

 

None

 

Arguments related:

 

TODO link UseG1GC , MaxHeapSize, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, NewSize

 

Related Posts

NOTE:

 

If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xx-g1heapregionsize

  • x-g1heapregionsize

  • G1 garbage collector tuning