test/gc/g1/TestHumongousShrinkHeap.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test TestHumongousShrinkHeap
  26  * @bug 8036025 8056043

  27  * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects
  28  * @library /testlibrary
  29  * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap
  30  */
  31 
  32 import java.lang.management.ManagementFactory;
  33 import java.lang.management.MemoryUsage;
  34 import java.util.ArrayList;
  35 import java.util.List;
  36 import sun.management.ManagementFactoryHelper;
  37 import static com.oracle.java.testlibrary.Asserts.*;
  38 
  39 public class TestHumongousShrinkHeap {
  40 
  41     public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
  42     public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
  43 
  44     private static final List<List<byte[]>> garbage = new ArrayList();
  45     private static final int REGION_SIZE = 1024 * 1024; // 1M
  46     private static final int LISTS_COUNT = 10;




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test TestHumongousShrinkHeap
  26  * @bug 8036025 8056043
  27  * @requires vm.gc=="G1" | vm.gc=="null"
  28  * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects
  29  * @library /testlibrary
  30  * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap
  31  */
  32 
  33 import java.lang.management.ManagementFactory;
  34 import java.lang.management.MemoryUsage;
  35 import java.util.ArrayList;
  36 import java.util.List;
  37 import sun.management.ManagementFactoryHelper;
  38 import static com.oracle.java.testlibrary.Asserts.*;
  39 
  40 public class TestHumongousShrinkHeap {
  41 
  42     public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
  43     public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
  44 
  45     private static final List<List<byte[]>> garbage = new ArrayList();
  46     private static final int REGION_SIZE = 1024 * 1024; // 1M
  47     private static final int LISTS_COUNT = 10;