-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have the following code in a c++ "listener class" (more or less), which calls some function of a Java object. I suspect there's a memory leak:
JNIEnv *env = NULL;
vm_->AttachCurrentThread(&env, NULL);
const jclass cls = env->FindClass(...);
const jmethodID meth = env->GetMethodID(…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Dear colleagues,
I need raise an exception from C++ code. Raised exception must contain text and code of error.
So common form:
ThrowNew(jclass clazz, const char *msg)
is not applicable. That is why I want create my own instance of java class:
public class MyException extends Exception
that…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi.
While I do my best to clean JNI objects to free native memory in the end of the usage, there are still some that hang around for a long time, wasting system native memory.
Is there any way to force the GC to give priority in collection of these JNI proxies?
I mean is there a way to cause GC…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
As an example for later use in Android I wrote a simple callback interface. While doing so i ran into the following error or bug or whatever. In C the two commented lines are supposed to be executed resulting in calling the C callback onChange. But instead i get an UnsatisfiedLinkError. Calling the…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm having some difficulty with JNI. I'm using JNI to call some Java methods from a C++ program. This implementation of JNI is working fine.
The goal of the Java program is to send commands over USB to a LEGO robot using LEJOS. This works fine when running the Java program by itself but for some…
>>> More