Non-blocking calls must use direct buffers. The JVM may move arrays around as part of its memory management tasks, if an array being used in the C code is moved to another memory location, an error will occur. Direct buffers are allocated outside of the normal garbage collected heap, and thus will not be moved by the JVM.
Before these bindings are released for public use, an assert should be added to any method using a buffer to verify that the buffer is direct. See 481bec5 as an example of how this would be done.
Non-blocking calls must use direct buffers. The JVM may move arrays around as part of its memory management tasks, if an array being used in the C code is moved to another memory location, an error will occur. Direct buffers are allocated outside of the normal garbage collected heap, and thus will not be moved by the JVM.
Before these bindings are released for public use, an assert should be added to any method using a buffer to verify that the buffer is direct. See 481bec5 as an example of how this would be done.