Potential off-heap memory leak on Netty file transfer (MAPPED mode)

Description

Currently, Worker uses MappedByteBuffer as the default mode for Netty file transfer, which includes a potential memory leak issue increasingly swallowing system memory. The attached snapshots illustrate this situation. It's because the off-heap mapping, once established, will not dependent upon the file channel that was used to create it. Closing the channel, in particular, has no effect upon the validity of the mapping. See JDK-4724038 for the details: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4724038

In addition, the use of heap ByteBuffer (ByteBuffer.allocate) would also introduce memory "leak" issues:
http://www.evanjones.ca/java-bytebuffer-leak.html

Environment

None

Status

Assignee

Calvin Jia

Reporter

Pengfei Xuan

Labels

Fix versions

Affects versions

1.0.1
0.8.2
1.1.0

Priority

Critical
Configure