I have a region of memory wrapped with JNI NewDirectByteBuffer
. I would like to run free/release code in the cleaner of the ByteBuffer
. Is there a way to do this or do I have to offer a custom free method that the user will have to call with the ByteBuffer
?
Edit
To clarify, I allocated the memory myself and called NewDirectByteBuffer
myself. I would like to know how I should coordinate the clean up with the cleaner.