Sorry if this is sounds more like a question than an actual issue. I found no better place to ask this (if there's such a place, please let me know!)
I have a native function that allocates a string to the heap and returns a pointer to it. When I call this function using jnr-ffi, everything works as expected and I get a java string at the other side. However, I'm unsure whether I'm leaking memory by doing this. I'm assuming jnr-ffi is copying the string memory at some point, but is it free-ing the memory that was allocated by the native code?
If not, is there a way I can have my native library safely return a string without leaking memory?