Replies: 1 comment 7 replies
-
Annotate your methods or classes with |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'm looking for a solution to avoid allocation and/or copy if possible (on non direct
ByteBuffer
with backed array), and reading theBytePointer
class I have potential improvement idea.public BytePointer(ByteBuffer buffer)
constructor says:I made some research and I figured out that sometimes (and depending on Java implementation) we can access
byte[]
objects from native side without copy, using JNI methodsGetPrimitiveArrayCritical(...)
andReleasePrimitiveArrayCritical(...)
.So... Maybe I'm wrong but here is my idea.
Native side
Java side
I can't find any precise documentation on JNI/JVM implementation variance. But maybe the test (
isNativeDoCopy()
) could be done once and we can improveBytePointer
depending on its result, by avoiding allocation and copy if possible? Or do you already know more informations about that?Beta Was this translation helpful? Give feedback.
All reactions