hotspot/test/gc/metaspace/TestMetaspaceInitialization.java
author duke
Wed, 05 Jul 2017 20:30:11 +0200
changeset 30019 e7dbbef69d12
parent 24847 37c354b113fe
child 38152 80e5da81fb2c
permissions -rw-r--r--
Merge
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
/*
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
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
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    27
 * @bug 8042933
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    28
 * @summary Tests to initialize metaspace with a very low MetaspaceSize
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    29
 * @library /testlibrary
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    30
 * @run main/othervm -XX:MetaspaceSize=2m TestMetaspaceInitialization
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    31
 */
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    32
public class TestMetaspaceInitialization {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    33
    private class Internal {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    34
        public int x;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    35
        public Internal(int x) {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    36
            this.x = x;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    37
        }
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
    private void test() {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    41
        ArrayList<Internal> l = new ArrayList<>();
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    42
        l.add(new Internal(17));
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    43
    }
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
    public static void main(String[] args) {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    46
        new TestMetaspaceInitialization().test();
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    47
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    48
}