Sahil Gupta
Sahil Gupta

Reputation: 2166

Minor GC causes Stop the world pauses in java?

Language: Java

I am not sure whether Minor GC causes all the application thread to wait until the GC process completes in java. Please shed some light.

Upvotes: 0

Views: 802

Answers (1)

the8472
the8472

Reputation: 43042

That's implementation-dependent.

If you're using the hotspot VM you can print information on GC STW pauses via -XX:+PrintGCApplicationStoppedTime. If you want to print all STW pauses (not just GC ones) you can use -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1 [source].

Other JVMs may behave differently. A commonly cited example is Azul's Zing and their pauseless collector - although it actually does have pauses, but those are constant-time.

Also, do note that there is no invariant relating wall time spent in GC to GC-STW pauses. I.e. STW time could be shorter, equal or longer than GC time.

Upvotes: 4

Related Questions