user1329339
user1329339

Reputation: 1335

How can I see what garbage collector is running by looking at gc logs?

How can I see what garbage collector (CMS, Parallel and so on) is running by looking at gc logs for minor and major collection? I don't have access to the command line options set to java (the sysadm for the appserver wont let me see them). I do have rather verbose gc logs.

Upvotes: 8

Views: 3292

Answers (3)

Pierluigi Vernetto
Pierluigi Vernetto

Reputation: 2050

quoting the book "Java Performance" by Charlie Hunt, the name of the young generation space used in the GC logs changes with the GC used:

PSYoungGen => ParallelGC
ParNew =>  CMS
DefNew  => SerialGC

I am not sure about G1

Upvotes: 2

Alexey Ragozin
Alexey Ragozin

Reputation: 8379

You can find GC log samples for all HotSpot JVM garbage collection algorithms in this article.

-XX:+PrintGCDetails should be enabled tosee that level of details in GC log.

Upvotes: 1

Victor Sorokin
Victor Sorokin

Reputation: 12006

Exact format of GC messages depends on JVM version and JVM settings. You can see samples at Oracle tutorial about GC tuning.

DefNew is default collector. It's either serial or parallel, which one is chosen depends, again, on JVM version/settings. You can see your default settings in JDK 6 using java -XX:+PrintCommandLineFlags -version. On my system it prints:

-XX:MaxHeapSize=1073741824 -XX:ParallelGCThreads=4 -XX:+PrintCommandLineFlags -XX:+UseParallelGC

which means Parallel GC is DefNew for me. You can check this SO question and one of it's answers references this table, may be it will help you.

UPDATE Default Old Gen GC in JDK 6 is ParallelOldGC, see this enlightening pdf. In particular, you can change Old Gen GC to newer Concurrent-mark-sweep one using -XX:+UseConcMarkSweepGC JVM option.

Upvotes: 3

Related Questions