I am trying to allocate memory using sun.misc.Unsafe.allocateMemory() and access it in native code.
however, it seems the long value returned by allocateMemory doesn't quite work as the right address in C code.
Unsafe unsafe = getUnsafe(); long address = unsafe.allocateMemory(64); for (int i = 0; i < 64; i += 8) unsafe.putByte(memory + i, (byte) 0xFF); nativeMethod(address); However in my native code when I try to access 'address' as a pointer, it doesn't work :(
Update: I have attached an image showing the issue. I passed the 'address' to the native code, however, examining the memory at that location doesnt show the 0xFF values I put in there.
Image: https://i.sstatic.net/KoIYG.png
