After discarding UseSerialGC, there are three concrete groups of collection strategies one could choose:

  • UseParallelGC: for high throughput
  • UseConcMarkSweepGC: for low latency, has been proposed to be replaced by g1gc
  • UseG1GC: for low latency

The last one maintains logical generations, so there are no separate policy for young/old generation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/zsh -e

# GC="-XX:+UseSerialGC"

# GC="-XX:+UseParallelGC"
# GC="-XX:+UseParallelOldGC"

# GC="-XX:+UseParNewGC"
# GC="-XX:+UseConcMarkSweepGC"

# GC="-XX:+UseG1GC"

java \
$GC \
-XX:+PrintCommandLineFlags -version &> 1 | \
head -n 1 | \
tr ' ' '\n'

References