< prev index next >
hotspot/test/gc/g1/TestHumongousShrinkHeap.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 31,45 ****
* @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
* -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
* TestHumongousShrinkHeap
*/
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.util.ArrayList;
import java.util.List;
- import sun.management.ManagementFactoryHelper;
import static com.oracle.java.testlibrary.Asserts.*;
public class TestHumongousShrinkHeap {
public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
--- 31,45 ----
* @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
* -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
* TestHumongousShrinkHeap
*/
+ import com.sun.management.HotSpotDiagnosticMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.util.ArrayList;
import java.util.List;
import static com.oracle.java.testlibrary.Asserts.*;
public class TestHumongousShrinkHeap {
public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
*** 80,92 ****
assertLessThan(muFree.getCommitted(), muFull.getCommitted(), String.format(
"committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
+ "%s = %s%n%s = %s",
MIN_FREE_RATIO_FLAG_NAME,
! ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
MAX_FREE_RATIO_FLAG_NAME,
! ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
));
}
private void allocate() {
--- 80,94 ----
assertLessThan(muFree.getCommitted(), muFull.getCommitted(), String.format(
"committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
+ "%s = %s%n%s = %s",
MIN_FREE_RATIO_FLAG_NAME,
! ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
! .getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
MAX_FREE_RATIO_FLAG_NAME,
! ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
! .getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
));
}
private void allocate() {
< prev index next >