FULL PRODUCT VERSION :
1.8.0_66 and early
ADDITIONAL OS VERSION INFORMATION :
3.13.0-62-generic #102~precise1-Ubuntu SMP Wed Aug 12 14:09:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
There is potential problem in map() method in implementation of sun.nio.ch.FileChannelImpl class.
The problem is that the "new FileChannelImpl.Unmapper(...)" and later newMappedByteBuffer(...) invorkation will not wrapped in try-catch, but object creation MAY cause to throw OutOfMemoryError. If this happens, the previously mapped memory is not unmapped, and no way to release it.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
RandomAccessFile raf = new RandomAccessFile("/tmp/1.tmp", "rw");
FileChannel fc = raf.getChannel();
...do fill heap...
MappedByteBuffer buf = fc.map(FileChannel.MapMode.READ_WRITE, start, len);
//MAY off-heap memory leak
This bug can be reproduced rarely.