equal
deleted
inserted
replaced
29 * @modules java.base/jdk.internal.misc |
29 * @modules java.base/jdk.internal.misc |
30 * java.management |
30 * java.management |
31 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory |
31 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory |
32 */ |
32 */ |
33 |
33 |
34 import jdk.test.lib.unsafe.UnsafeHelper; |
|
35 import jdk.internal.misc.Unsafe; |
34 import jdk.internal.misc.Unsafe; |
36 import static jdk.test.lib.Asserts.*; |
35 import static jdk.test.lib.Asserts.*; |
37 |
36 |
38 public class AllocateMemory { |
37 public class AllocateMemory { |
39 public static void main(String args[]) throws Exception { |
38 public static void main(String args[]) throws Exception { |
40 Unsafe unsafe = UnsafeHelper.getUnsafe(); |
39 Unsafe unsafe = Unsafe.getUnsafe(); |
41 |
40 |
42 // Allocate a byte, write to the location and read back the value |
41 // Allocate a byte, write to the location and read back the value |
43 long address = unsafe.allocateMemory(1); |
42 long address = unsafe.allocateMemory(1); |
44 assertNotEquals(address, 0L); |
43 assertNotEquals(address, 0L); |
45 |
44 |