简体   繁体   中英

What these GC logs mean?

I just have got information on performance improvemet using GC tuning.

I am trying to print GC logs like below, Test is my class file.

java -Xms2m -Xmx64m -XX:+PrintGCDetails Test
and
java -Xms2m -Xmx64m -XX:+UseSerialGC -XX:+PrintGCDetails Test

every time i am getting GC logs in below format

Heap
 def new generation   total 1152K, used 347K [0x00000000f6e00000, 0x00000000f6f40000, 0x00000000f8350000)
  eden space 1024K,  33% used [0x00000000f6e00000, 0x00000000f6e56f68, 0x00000000f6f00000)
  from space 128K,   0% used [0x00000000f6f00000, 0x00000000f6f00000, 0x00000000f6f20000)
  to   space 128K,   0% used [0x00000000f6f20000, 0x00000000f6f20000, 0x00000000f6f40000)
 tenured generation   total 768K, used 0K [0x00000000f8350000, 0x00000000f8410000, 0x00000000fae00000)
   the space 768K,   0% used [0x00000000f8350000, 0x00000000f8350000, 0x00000000f8350200, 0x00000000f8410000)
 compacting perm gen  total 21248K, used 2345K [0x00000000fae00000, 0x00000000fc2c0000, 0x0000000100000000)
   the space 21248K,  11% used [0x00000000fae00000, 0x00000000fb04a620, 0x00000000fb04a800, 0x00000000fc2c0000)
No shared spaces configured.

I also tried with -XX:+PrintGCTimeStamps vm argument but it prints same output.

I am already trying to understand these logs in google since days now.

Format explained in google is

8109.128: [GC [PSYoungGen: 109884K->14201K(139904K)] 691015K->595332K(1119040K), 0.0454530 secs]

which i can understand.

Questions
1) how can i print GC logs in format i mentioned later.
2) can any one explain me logs i got?

yes.... I got it by myself

I was under misconception that GC is at all happening, but was not happening so it showed me spaces used in different generations,

As I was running a test application my application is small enough to not cause GC. I inserted System.gc() in code for some condition and got expected GC logs.

[GC 645K->288K(121344K), 0.0042354 secs]
[Full GC 288K->238K(121344K), 0.0219605 secs]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM