hotspot/test/gc/metaspace/TestMetaspaceInitialization.java
author jmasa
Mon, 13 Jun 2016 14:10:09 -0700
changeset 39692 57f307f875e0
parent 38152 80e5da81fb2c
child 40631 ed82623d7831
permissions -rw-r--r--
8024945: Remove check on minimum size of MetaspaceSize Reviewed-by: kbarrett, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     1
/*
39692
57f307f875e0 8024945: Remove check on minimum size of MetaspaceSize
jmasa
parents: 38152
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     4
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     8
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    13
 * accompanied this code).
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    14
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    18
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    21
 * questions.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    22
 */
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    23
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    24
import java.util.ArrayList;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    25
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    26
/* @test TestMetaspaceInitialization
39692
57f307f875e0 8024945: Remove check on minimum size of MetaspaceSize
jmasa
parents: 38152
diff changeset
    27
 * @bug 8024945
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    28
 * @summary Tests to initialize metaspace with a very low MetaspaceSize
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 24847
diff changeset
    29
 * @modules java.base/jdk.internal.misc
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    30
 * @library /testlibrary
39692
57f307f875e0 8024945: Remove check on minimum size of MetaspaceSize
jmasa
parents: 38152
diff changeset
    31
 * @run main/othervm -XX:MetaspaceSize=0 TestMetaspaceInitialization
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    32
 */
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    33
public class TestMetaspaceInitialization {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    34
    private class Internal {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    35
        public int x;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    36
        public Internal(int x) {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    37
            this.x = x;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    38
        }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    39
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    40
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    41
    private void test() {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    42
        ArrayList<Internal> l = new ArrayList<>();
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    43
        l.add(new Internal(17));
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    44
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    45
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    46
    public static void main(String[] args) {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    47
        new TestMetaspaceInitialization().test();
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    48
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    49
}