1. ReferenceTable overflow (max=512)  内存泄露,程序运行一段时间就挂掉了.
在利用反射调用java中的函数需要释放掉查找到的类
void publishJavaProgress(JNIEnv * env, jobject obj, jint progress)
{
     jclass   clazz   =   (*env)->FindClass(env,"com/itcast/lame/LameActivity"); //String
     if (clazz == 0)     LOGI("dont find class");
     jmethodID   methodid =  (*env)->GetMethodID(env, clazz, "setConvertProgress", "(I)V");
     if (methodid == 0)         LOGI("dont find method");
     (*env)->CallVoidMethod(env,obj,methodid,progress);
     (*env)->DeleteLocalRef(env, clazz);    //此释放掉!!!
}





相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2021-12-05
  • 2021-06-15
  • 2021-07-11
  • 2021-12-26
  • 2021-12-09
猜你喜欢
  • 2021-06-23
  • 2021-10-13
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案