< prev index next >

test/runtime/memory/ReserveMemory.java

Print this page




  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
  26  * @key regression
  27  * @bug 8012015
  28  * @summary Make sure reserved (but uncommitted) memory is not accessible
  29  * @library /testlibrary /../../test/lib
  30  * @modules java.base/sun.misc
  31  *          java.management
  32  * @build ReserveMemory
  33  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  34  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  35  * @run main ReserveMemory
  36  */
  37 
  38 import com.oracle.java.testlibrary.*;
  39 
  40 import sun.hotspot.WhiteBox;
  41 
  42 public class ReserveMemory {
  43   private static boolean isWindows() {
  44     return System.getProperty("os.name").toLowerCase().startsWith("win");
  45   }
  46 
  47   private static boolean isOsx() {
  48     return System.getProperty("os.name").toLowerCase().startsWith("mac");
  49   }
  50 
  51   public static void main(String args[]) throws Exception {
  52     if (args.length > 0) {
  53       WhiteBox.getWhiteBox().readReservedMemory();
  54 
  55       throw new Exception("Read of reserved/uncommitted memory unexpectedly succeeded, expected crash!");
  56     }
  57 
  58     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(


  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
  26  * @key regression
  27  * @bug 8012015
  28  * @summary Make sure reserved (but uncommitted) memory is not accessible
  29  * @library /testlibrary /../../test/lib
  30  * @modules java.base/sun.misc
  31  *          java.management
  32  * @build ReserveMemory
  33  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  34  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  35  * @run main ReserveMemory
  36  */
  37 
  38 import jdk.test.lib.*;
  39 
  40 import sun.hotspot.WhiteBox;
  41 
  42 public class ReserveMemory {
  43   private static boolean isWindows() {
  44     return System.getProperty("os.name").toLowerCase().startsWith("win");
  45   }
  46 
  47   private static boolean isOsx() {
  48     return System.getProperty("os.name").toLowerCase().startsWith("mac");
  49   }
  50 
  51   public static void main(String args[]) throws Exception {
  52     if (args.length > 0) {
  53       WhiteBox.getWhiteBox().readReservedMemory();
  54 
  55       throw new Exception("Read of reserved/uncommitted memory unexpectedly succeeded, expected crash!");
  56     }
  57 
  58     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
< prev index next >