What Is GC_HeapInspection And What Can Trigger It?

Viewed 128

I am looking at events in a dump from Java Flight Recorder and I see a VM Operation GC_HeapInspection that took 6 seconds.

This occurs right at the point at which other monitoring reports a similar delay.

Interestingly, the verbose gc logs don't report any GC longer than 160 ms.

I am planning on doing another test with the following to see if the delay is due to the time to do a safepoint

-XX:+PrintGCApplicationStoppedTime -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1

However, for this question I'd like to know what is GC_HeapInspection and what can trigger it?

1 Answers

If I'm not mistaken, the GC_HeapInspection is when the JVM is looking through your heap so that it can find objects that can be garbage collected. This means it scans through all memory and then it checks the references of every single object. It is (probably)* triggered right before the GC itself, or before an STW event.

Since this is just the inspection, it probably* isn't logged as a GC. As long as you aren't using the Serial GC or the Parallel GC, it shouldn't stop your application. (Only slow it to some extent. Unless there was an STW event, which would definitely be shorter than all your other GCs.)

*Note: this is not from any documentation, I just made the assumption that HeapInspection means it is inspecting the heap, then worked off of the things that I know from there.

Related