I cannot memory map large files. Map Failed. OutOfMemoryError

56 views Asked by At

Here is my code:

FileChannel fc = new RandomAccessFile(afile.getAbsolutePath(), "r").getChannel();
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());

Here are the errors:

java.io.IOException: Map failed
Caused by: java.lang.OutOfMemoryError: Map failed

I'm attempting to map a file of 1.5GB on a 32bit system.

I thought that nio was supposed to address this issue. Am I doing something wrong?

Regards.

0

There are 0 answers