package lime.jvm._003._006._005;
/**
* @Author : Liangmy
* @Description :
* @Date : Created in 2020/1/6 下午8:56
* @Modified By :
* VM Args : -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:-HandlePromotionFailure
* JDK 6 U 24 之前 : java -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+UseSerialGC -XX:-HandlePromotionFailure -XX:+PrintGCDetails lime.jvm._003._006._005.TestHandlePromotion
* JDK 6 U 24 之后 : HandlePromotionFailure 不起作用了。
*/
public class TestHandlePromotion {
private static final int _1MB = 1024 * 1024;
public static void main(String[] args) {
byte[] allocation1, allocation2, allocation3, allocation4, allocation5, allocation6, allocation7;
allocation1 = new byte[2 * _1MB];
allocation2 = new byte[2 * _1MB];
allocation3 = new byte[2 * _1MB];
allocation1 = null;
allocation4 = new byte[2 * _1MB];
allocation5 = new byte[2 * _1MB];
allocation6 = new byte[2 * _1MB];
allocation4 = null;
allocation5 = null;
allocation6 = null;
allocation7 = new byte[2 * _1MB];
}
}