Examples of allocateMemory()


Examples of sun.misc.Unsafe.allocateMemory()

      throws NoSuchFieldException, IllegalAccessException {
    // work around permissions issues
    Field f = Unsafe.class.getDeclaredField("theUnsafe");
    f.setAccessible(true);
    Unsafe unsafe = (Unsafe)f.get(null);
    long addr = unsafe.allocateMemory(100);

    // test of endianness
    unsafe.putLong(addr, 1);
    System.out.println(unsafe.getByte(addr));
View Full Code Here

Examples of sun.misc.Unsafe.allocateMemory()

  @Test(groups = "fast")
  public void testSanity() throws Exception {
    Unsafe unsafe = UnsafeAccessor.get();

    int size = 1024 * 1024;
    long ptr = unsafe.allocateMemory(size);
    long writePtr = ptr;
   
    for (int i = 0; i < size; i++) {
      byte b = (byte)(i % 127);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.