There is a very small risk when using direct ByteBuffer that the buffer instance will be GC'ed and the buffer's memory reclaimed while the memory address is still be used by a buffer method.
This can be fixed by judiciously using Reference.reachabilityFence to keep references alive for the duration of use. Performance reasons held up such use but further analysis has revealed that it is possible to annotate Reference.reachabilityFence with @ForceInline (rather than @DontInline) since the HotSpot compilers currently track the usage scope of variables via bytecode analysis rather than IR analysis. So even if a compiler performs dead code elimination any eliminated variables will still live beyond their use (in accordance with the bytecode usage). Other non-HotSpot compilers may differ in this behaviour.