Java · Hard · Pro
Direct ByteBuffer — off-heap memory and Cleaner?
JavaMemory & JVMSenior
Direct ByteBuffer
ByteBuffer.allocateDirect allocates off-heap memory for zero-copy I/O with channels and sockets. Cleaner (or phantom references) eventually frees native memory when the buffer is collected.