Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MappedByteBuffer(nio) when performing many IO operations causes OutOfMemory

838083Feb 9 2011 — edited Feb 22 2011
Hi, 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 22 2011
Added on Feb 9 2011
23 comments
3,485 views