Here you can find the source of free(ByteBuffer buffer)
public static void free(ByteBuffer buffer)
//package com.java2s; //License from project: Apache License import sun.misc.Cleaner; import sun.nio.ch.DirectBuffer; import java.nio.ByteBuffer; public class Main { public static void free(ByteBuffer buffer) { if (buffer.isDirect()) { Cleaner cleaner = ((DirectBuffer) buffer).cleaner(); if (cleaner != null) { cleaner.clean();/* www . j a v a 2s . c om*/ } } } }