Skip to main content

Debugging G1 GC

5 replies [Last post]
Joined: 2009-11-17


I wonder if anyone can suggest to me how I can go about debugging G1 GC.

We are seeing this happening:

After moving from CMS to G1, my application will suddenly uses up 60-70% of a CPU Core for no good reason. Although this is similar to a supposedly fixed bug (, I didnt notice memory use kept going up. On the other hand I cannot help but seeing the similarity in terms of high CPU usage.

I cannot predict the time when the issue will happen but I know that if the problem occurs and I force a Full GC (or connect visualVM to it), the Core CPU utilization goes down rightaway.

I am using 1.6u18 b05. The flags I use are:


-XX:+G1ParallelRSetUpdatingEnabled <<< i have tried with or without this
-XX:+G1ParallelRSetScanningEnabled <<< i have tried with or without this

Any suggestion how can I log my observation for Java Bug reporting? visualVM does not seem to register G1's activities.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-10

I've seen the same behavior on a Swing app running on Win 7 with jre 1.6.0_18 launched only with -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC options.

Pitty because otherwise the G1 does a very good job in compacting the heap.

Joined: 2004-01-07

JDK6u18 has an older version of G1, does the problem still happen with a recent JDK7 build?

Joined: 2005-10-19

JDK6u20 early access release includes a recent HotSpot 17 build, so that's also an option:


Joined: 2003-06-10


I confirm that with java version "1.6.0_20-ea" the problem went away. Great!


Joined: 2004-01-07

One thing that could probably help would be to run your app with debug/fastdebug builds,
and record stack-traces when the problem occurs (you can use the pstack-utility when using linux).

Another useful thing would probably a oprofile/sysprof profile, to see where all the probably wasted CPU cycles are spent on.

Good luck, Clemens