java - Custom memory allocation inside JNI native function -


i need allocate array of bytes inside jni c-function. transmit array java code byte[] object. know there function newbytearray, takes input size of byte array, can’t use custom memory allocation functions. in case need use specific nonstandard malloc-like allocation function linux. there should no additional copying because of limited resources.

if use byte[], must allocate java heap , allow control memory management.

however, can use bytebuffer, allows perform memory management in native code. can allocate chunk of memory in native code , access java without copy.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -