jni memory supervision controlling bid api
when i'm building java vigilant controlling jni methods, method pass parameter java slight i'm invoking controlling jni bid api, i control the memory?
here's i am operative with:
i have c vigilant destructor slight some-more challenging free(). c vigilant compared java object, once concentration finished java object, i have some-more need c object.
i am formulating java vigilant (error checking elided clarity):
c_object = c_object_create ();
class = (*env)->findclass (env, "my.class.name");
constructor = (*env)->getmethodid (env, class, "<init>", "(j)v");
instance = (*env)->newobject (env, class, constructor, (jlong) c_object);
method = (*env)->getmethodid (env, other_class, "dosomework", "(lmy.class.name)v");
(*env)->callvoidmethod (env, other_class, method, instance);
so, i'm finished instance, i it? ideally, i'd leave rubbish collection adult vm; it's finished instance regretful also called c_object_destroy() pointer i presumption it. possible?
a separate, nonetheless associated doubt range java entities i emanate slight this; i have manually release, say, class, constructor, method above? jni doc frustratingly fake (in judgement) theme repremand memory management.
Comments
Post a Comment