I want to understand the difference between:
-XX:+PrintGC
and -verbose:gc
Apparently these look similar.
This article doesn't list the verbose:gc
http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html
I also saw these two questions: How to redirect verbose garbage collection output to a file? and https://stackoverflow.com/a/1818039/2266682 but couldn't get much understanding.
In JDK 8 -verbose:gc
is an exact alias for -XX:+PrintGC
.
However, -verbose:gc
is a standard option, while -XX:+PrintGC
is not.
-XX:+PrintGC
is deprecated since JDK 9 in favor of unified logging option -Xlog:gc
, see JEP 158.
-verbose:gc
still works in JDK 9 and 10.