Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between -XX:-UseParallelGC and -XX:+UseParallelGC

What is the difference between -XX:+UseParallelGC and -XX:-UseParallelGC? Most links indicate the first, but http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html mentions the second.

Thank you.

like image 629
xpapad Avatar asked Jun 18 '12 16:06

xpapad


People also ask

What is UseParallelGC?

The parallel scavenge collector (Enabled using -XX:UseParallelGC). This is like the previous parallel copying collector, but the algorithm is tuned for gigabyte heaps (over 10GB) on multi-CPU machines. This collection algorithm is designed to maximize throughput while minimizing pauses.

Is Java GC stop the world?

Some surviving objects are aged and eventually move to the old generation. Stop the World Event - All minor garbage collections are "Stop the World" events. This means that all application threads are stopped until the operation completes. Minor garbage collections are always Stop the World events.

What is :+ UseG1GC?

Key Command Line Switches. -XX:+UseG1GC - Tells the JVM to use the G1 Garbage collector. -XX:MaxGCPauseMillis=200 - Sets a target for the maximum GC pause time. This is a soft goal, and the JVM will make its best effort to achieve it. Therefore, the pause time goal will sometimes not be met.

Does G1 stop the world?

After space-reclamation, the collection cycle restarts with another young-only phase. As backup, if the application runs out of memory while gathering liveness information, G1 performs an in-place stop-the-world full heap compaction (Full GC) like other collectors.


2 Answers

From the documentation:

Boolean options are turned on with -XX:+<option> and turned off with -XX:-<option>

So it means that -XX:+UseParallelGC will turn on the parallel garbage collection, and -XX:-UseParallelGC will turn it off.

like image 109
Makoto Avatar answered Oct 08 '22 23:10

Makoto


The line:

-XX:+UseParallelGC

Enables the ParallelGC. Note the + sign

The line:

-XX:-UseParallelGC

Disables it. Note the - sign.

like image 27
Maurício Linhares Avatar answered Oct 08 '22 23:10

Maurício Linhares