Explicitly frees the memory used by the given direct byte buffer.
If the memory is known to already have been freed then this is a no-op.
Once the memory has been freed then operations requiring access to the
memory will throw an IllegalStateException
.
Note this is is possible that the memory is freed by code that reaches
into the address and explicitly frees it 'beneith' us -- this is bad
form.
if ((directBuffer == null) || (!directBuffer.isDirect())) {
throw new IllegalArgumentException();
}
DirectByteBuffer buf = (DirectByteBuffer) directBuffer;
buf.free();