I have a big file, it\'s expected to be around 12 GB. I want to load it all into memory on a beefy 64-bit machine with 16 GB RAM, but I think Java does not support byte arra
I think the idea of memory-mapping the file (using the CPU's virtual memory hardware) is the right approach. Except that MappedByteBuffer has the same limitation of 2Gb as native arrays. This guy claims to have solved the problem with a pretty simple alternative to MappedByteBuffer:
http://nyeggen.com/post/2014-05-18-memory-mapping-%3E2gb-of-data-in-java/
https://gist.github.com/bnyeggen/c679a5ea6a68503ed19f#file-mmapper-java
Unfortunately the JVM crashes when you read beyond 500Mb.