MappedByteBuffer(nio) when performing many IO operations causes OutOfMemory
838083Feb 9 2011 — edited Feb 22 2011Hi, I am using MappedByteBuffer(nio) to write into files.
On some scenarios where there is a need for many writes (handling gaps),
I get out of memory during the map operation:
cachedBuff = fileChannel.map(FileChannel.MapMode.READ_WRITE, baseAddress, endAddress - baseAddress);
I get out of memory.
I am working with jdk1.6
I tried tunning different memory parameters such as:
MaxDirectMemorySize, UseLargePages, MaxPermSize, XMS, XMX,XSS, -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:MaxGCPauseMillis=25 -XX:NewRatio=2 -XX:AdaptiveSizePolicyOutputInterval=1
Nothing worked.
The heap+non heap does not contain a lot of memory.
Any ideas what i can do? Is the memory used by nio garbage collected? how can I unmap the memory? how can i clean up?
Thanks