Profile Image

what is G1 garbage collector tuning: -XX:G1HeapWastePercent?

What is G1 garbage collector tuning: -XX:G1HeapWastePercent? 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?

  • jvmargument

  • xx-g1heapwastepercent

  • x-g1heapwastepercent

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky



You can set the percentage of heap that you can to waste with:


-XX:G1HeapWastePercent=xxx,  where xxx is the desired percent.




To set the percent to 10% use:






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 G1HeapWastePercent the percentage of heap that you're willing to waste. The Java HotSpot VM doesn't initiate the mixed garbage collection cycle when the reclaimable percentage is less than the heap waste percentage.


Default Value:


Default value is 5%






Arguments related:


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


Related Posts:


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
  • jvmargument

  • xx-g1heapwastepercent

  • x-g1heapwastepercent