c++ - JNI DeleteLocalRef Clarification -



c++ - JNI DeleteLocalRef Clarification -

question 1:

jstring jstrkey; for(int i=1;i<=1000;++i) { lpwstr strkey = l"string"; jstrkey = env->newstring((jchar *)strkey, wcslen(strkey)); } env->deletelocalref(jstrkey);

question 2:

for(int i=1;i<=1000++i) { lpwstr strkey = l"string"; jstring jstrkey = env->newstring((jchar *)strkey, wcslen(strkey)); env->deletelocalref(jstrkey); }

am using deletelocalref in both questions?

especially in question 1, deleting local ref after loop. think correct, , need not phone call deletelocalref within loop since not creating new local ref.

so no issues respect usage of deletelocalref right?

in both cases should phone call deletelocalref() within loop because each newstring() crerates new local ref.

local references discarded jni on homecoming native method, process has nil java garbage collection. usually, don't need worry local references. local ref table quite small, hence must discard unused references created on long loop.

c++ jni

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -