annotate test/runtime/NMT/UnsafeMallocLimit2.java @ 20613:50054b63f0aa

8057043: Type annotations not retained during class redefine / retransform Reviewed-by: coleenp, sspitsyn, jfranck
author aeriksso
date Wed, 22 Oct 2014 13:59:56 +0200
parents 1ff288f0dae4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20509
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
1 /*
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
4 *
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
7 * published by the Free Software Foundation.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
8 *
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
13 * accompanied this code).
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
14 *
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
18 *
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
21 * questions.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
22 */
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
23
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
24 /*
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
25 * @test
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
26 * @bug 8058818
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
27 * @library /testlibrary
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
28 * @build UnsafeMallocLimit2
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
29 * @run main/othervm -Xmx32m -XX:NativeMemoryTracking=off UnsafeMallocLimit2
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
30 */
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
31
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
32 import com.oracle.java.testlibrary.*;
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
33 import sun.misc.Unsafe;
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
34
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
35 public class UnsafeMallocLimit2 {
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
36
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
37 public static void main(String args[]) throws Exception {
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
38 if (Platform.is32bit()) {
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
39 Unsafe unsafe = Utils.getUnsafe();
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
40 try {
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
41 // Allocate greater than MALLOC_MAX and likely won't fail to allocate,
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
42 // so it hits the NMT code that asserted.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
43 // Test that this doesn't cause an assertion with NMT off.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
44 // The option above overrides if all the tests are run with NMT on.
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
45 unsafe.allocateMemory(0x40000000);
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
46 System.out.println("Allocation succeeded");
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
47 } catch (OutOfMemoryError e) {
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
48 System.out.println("Allocation failed");
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
49 }
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
50 } else {
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
51 System.out.println("Test only valid on 32-bit platforms");
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
52 }
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
53 }
1ff288f0dae4 8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms
coleenp
parents:
diff changeset
54 }