I found the JVM flags here. Is there a more detailed explaination of what exactly they do?
Asked
Active
Viewed 5.4k times
2 Answers
9
Setting this flags writes all the garbage collections made by the JVM to a log file (or stdout, but then it is less useful), and these can be analysed by tools such as the ones mentioned here. Using this information you can fine tune your garbage collection configuration.

Community
- 1
- 1

David Rabinowitz
- 29,904
- 14
- 93
- 125
-
Using the above mentioned flags, is it possible to get the details of previous GC cycles (of time when these flags were not set)? – TheLoneKing Jan 29 '15 at 14:31
-
What do you mean by "previous GC cycles"? – David Rabinowitz Jan 29 '15 at 15:12
9
Rather on Sun's, use -Xloggc:gc.log
to log to a file, -verbose:gc
is also a common switch for this.
Also, ensure -XX:+PrintGCDetails
and -XX:+PrintGCTimeStamps
(note the plus + sign). The timestamp switch is redundant but good to include.

Greg Mattes
- 33,090
- 15
- 73
- 105

Jé Queue
- 10,359
- 13
- 53
- 61
-
would you elaborate what -verbose:gc does? Since this answer is confusing for those who are trying to get some help. And upvoters must be only those who already know this. – Aqeel Ashiq Apr 02 '18 at 09:45
-
@SyedAqeelAshiq seems a bit mean about the upvotes...but `-verbose:gc` is a mechanism to log Garbage Collection events in a verbose manner by which they can be parsed and post- or runtime-evalutated as to the required VM ergonomics. :-) – Jé Queue Apr 04 '18 at 20:41
-
7Purpose of SO is to provide high quality answers, to those who want to get some help. I was searching for PrintGC flag, but this answer confused me, and had to spend few hours finding difference between PrintGC and verbose:gc. Perhaps you should update your answer to mention the difference. And add complete sentences. – Aqeel Ashiq Apr 05 '18 at 05:16
-
4This does not answer the question - what is the difference between those two options? – em_bo Nov 20 '19 at 21:44
-
1`-verbose:gc` is an alias for `-XX:+PrintGC`; see https://stackoverflow.com/questions/49609051/difference-between-xxprintgc-and-verbosegc – Richard Steele Feb 14 '20 at 16:11