小弟在學習GC的過程中,遇到JVM參數未生效的問題,一時不知道怎麼解決,請路過大神幫幫忙指點指點,小弟謝過!
運行環境為:Win7 64bit, 4 core.
1,程序如下
public class PSGCDirectOldDemo {
/**
* @para args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
Thread.sleep(20000);
byte[] bytes = new byte[1024 * 1024 * 2];
byte[] bytes2 = new byte[1024 * 1024 * 2];
byte[] bytes3 = new byte[1024 * 1024 * 2];
System.out.println("ready to direct allocate to old");
Thread.sleep(3000);
byte[] bytes4 = new byte[1024 * 1024 * 4];
Thread.sleep(3000);
}
}
2, 編譯後,使用java PSGCDirectOldDemo -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+UseParallelGC 命令運行;
3,但是執行結果顯示運行參數"-Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+UseParallelGC"並未生效, S0和S1都為5M,Eden為32M, SurvivorRatio=5/32也不為8.
C:\Users\Administrator.LB-20130824QUJC>jstat -gc 8436 240
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 655.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 6799.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 10895.5 85504.0 0.0 21504.0 2445.9 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 11551.0 85504.0 0.0 21504.0 2452.6 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 11551.0 85504.0 0.0 21504.0 2452.6 0 0.000 0 0.000 0.000
5120.0 5120.0 0.0 0.0 32768.0 11551.0 85504.0 0.0 21504.0 2452.6 0 0.000 0 0.000 0.000
請高手、大神幫幫忙看看,小生尚位初學,有很多東西還不怎麼明白,先在此謝過!
原因已找到,個人粗心所致,參數位置顛倒造成的。。。