- Arrays are subject to being moved by the GC, so even if you could get the address they could move.
- Arrays are limited to around 16 GB, and that's if you're packing data into longs.
- Accessing an array involves a bounds check, which may float out of a loop, but may well not.
- Arrays cannot be allocated with memory that is anything except mapped private.
I use Unsafe to put memory into a location where I can get a stable native address in order to make native calls using it. Using an array would not allow that.
On HotSpot arrays are limited to 2 GB
At least J9, Azul and now Graal, and then there is the plethora of embedded ones, but those ones wouldn't be able to use that much memory anyway.
While J9 can give you larger arrays AFAIK you're not guaranteed to get a single, contiguous memory region. You won't notice in Java but JNI criticals may return copies.
I haven't tested Zing, but Zulu is just HotSpot.