What do -XX:-PrintGC and XX:-PrintGCDetails flags do?
Asked Answered
S

2

16

I found the JVM flags here. Is there a more detailed explaination of what exactly they do?

Stendhal answered 29/11, 2009 at 12:29 Comment(0)
D
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.

Dallman answered 29/11, 2009 at 12:41 Comment(2)
Using the above mentioned flags, is it possible to get the details of previous GC cycles (of time when these flags were not set)?Basis
What do you mean by "previous GC cycles"?Dallman
C
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.

Calcimine answered 30/11, 2009 at 5:52 Comment(5)
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.Bulge
@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. :-)Immortality
Purpose 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.Bulge
This does not answer the question - what is the difference between those two options?Outrelief
-verbose:gc is an alias for -XX:+PrintGC; see #49609551Hiding

© 2022 - 2024 — McMap. All rights reserved.