Dear Alan, On Sun, Dec 11, 2016 at 6:16 AM, Alan Bateman <alan.bate...@oracle.com> wrote:
> > The alternative is of course: > > ByteBuffer wrap(long address, int capacity) > void unmap(MappedByteBuffer) > > The wrap method allow be similar to JNI's NewDirectByteBuffer for those > that are managing the underlying memory themselves. This makes it a more > advanced method to avoid too much temptation to free the memory underlying > a buffer created with ByteBuffer.allocateDirect. We can't do much with > unmap but that at least won't be widely used. I previously patched Netty to use the Runnable cleaner, so I have some interesting in this discussion. Having a public method "ByteBuffer wrap(long adddress, int capacity) in the standard would simplify Netty code. Netty currently use the cleaner on ByteBuffers allocated by ByteBuffer.allocateDirect, but I believe that can be changed. Carsten