Under Linux, how to check which garbage collection algorithm the Java virtual machine uses? The method is relatively simple, the statement is as follows:
[testuser@vmtest]$ java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=128150272 -XX:MaxHeapSize=2050404352 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
The -XX:+UseParallelGC in the above result indicates that the new generation uses ParallelGC.
Article reference: