I'm looking for some guidelines on caching and reusing Bridj JNI objects between multiple JNI calls. I found that caching JNI objects vastly speeds up calling C functions over JNI but it also causes some numerical stability issues. Basically, sometimes the same C function with the same arguments produces different results.
I found this page discussing how to cache JNI objects. http://www.latkin.org/blog/2016/02/01/jni-object-lifetimes-quick-reference/
Does anyone do it in BridJ, any hints on how to cache primitives, structs, pointers, etc.?
Link to the same question on stackoverflow: https://stackoverflow.com/questions/45770502/how-to-properly-cache-bridj-jni-objects-in-java-scala