1. 程式人生 > >Minor GC 中 MaxTenuringThreshold 和 TargetSurvivorRatio 引數說明

Minor GC 中 MaxTenuringThreshold 和 TargetSurvivorRatio 引數說明

以-Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=1 -XX:+UseSerialGC -XX:MaxTenuringThreshold=3 -XX:+PrintTenuringDistribution -XX:+PrintGCDetails
執行上述程式碼。
[GC [DefNew
Desired survivor size 1736704 bytes, new threshold 3 (max 3)
- age   1:     363408 bytes,     363408 total
: 2529K->354K(6848K), 0.0017645 secs] 2529K->354K(17088K), 0.0018275 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC [DefNew
Desired survivor size 1736704 bytes, new threshold 3 (max 3)
- age   1:     314616 bytes,     314616 total
- age   2:     363176 bytes,     677792 total
: 2748K->661K(6848K), 0.0009114 secs] 2748K->661K(17088K), 0.0009399 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC [DefNew
Desired survivor size 1736704 bytes, new threshold 3 (max 3)
- age   1:     314616 bytes,     314616 total
- age   2:     314600 bytes,     629216 total
- age   3:     363176 bytes,     992392 total
: 3042K->969K(6848K), 0.0010587 secs] 3042K->969K(17088K), 0.0010872 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC [DefNew
Desired survivor size 1736704 bytes, new threshold 3 (max 3)
- age   1:     314616 bytes,     314616 total
- age   2:     314600 bytes,     629216 total
- age   3:     314600 bytes,     943816 total
: 3341K->921K(6848K), 0.0012151 secs] 3341K->1276K(17088K), 0.0012443 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
ok
Heap
 def new generation   total 6848K, used 3049K [0x32310000, 0x32d10000, 0x32d10000)
  eden space 3456K,  61% used [0x32310000, 0x32524128, 0x32670000)
  from space 3392K,  27% used [0x32670000, 0x327566c8, 0x329c0000)
  to   space 3392K,   0% used [0x329c0000, 0x329c0000, 0x32d10000)
 tenured generation   total 10240K, used 354K [0x32d10000, 0x33710000, 0x33710000)
   the space 10240K,   3% used [0x32d10000, 0x32d68aa8, 0x32d68c00, 0x33710000)
 compacting perm gen  total 12288K, used 369K [0x33710000, 0x34310000, 0x37710000)
   the space 12288K,   3% used [0x33710000, 0x3376c430, 0x3376c600, 0x34310000)
    ro space 10240K,  51% used [0x37710000, 0x37c3b700, 0x37c3b800, 0x38110000)
    rw space 12288K,  54% used [0x38110000, 0x387a76c0, 0x387a7800, 0x38d10000)



參考:
      http://cr.openjdk.java.net/~andrew/jdk6-hs14-merge/webrev.01/hotspot/src/share  /vm/gc_implementation/shared/ageTable.cpp.frames.html
      http://blog.bluedavy.com/?p=70
      http://java.sun.com/performance/reference/whitepapers/tuning.html
      http://java.sun.com/docs/hotspot/gc1.4.2/faq.html
      http://www.javaworld.com/javaworld/jw-01-2002/jw-0111-hotspotgc.html