I know that when my jni method comes to it end and I've been using jfloatArray I should then call :
env->ReleaseFloatArrayElements(vec,in,0);
What about the jfloat
,how to do the same with single primitives that aren't array types ?
You only have to clean up in cases where the JNI
interface may have allocated memory or other resources. Basic types, like jfloat
, are typedef's for basic C++ *types* (usually, float), and are passed around by copy; when you declare a jfloat
, it's just a floating point type on the stack, and disappears when you leave its scope.