Allow to override how wrapped direct ByteBuffer are allocated to make it easier to extend
Also allow to override how direct ByteBuffers are freed
Merge remote-tracking branch: upstream/master