我遇到了崩溃
03-08 19:08:30.734: E/dalvikvm(3821): JNI ERROR (app bug): local reference table overflow (max=512)
03-08 19:08:30.734: W/dalvikvm(3821): JNI local reference table (0x58ca9a48) dump:
03-08 19:08:30.734: W/dalvikvm(3821): Last 10 entries (of 512):
03-08 19:08:30.734: W/dalvikvm(3821): 511: 0x415005a0 java.lang.Class<android.util.Log>
03-08 19:08:30.734: W/dalvikvm(3821): 510: 0x41cd9688 byte[] (8 elements)
03-08 19:08:30.734: W/dalvikvm(3821): 509: 0x41cc9410 java.lang.Class<ob.android.Stream>
03-08 19:08:30.734: W/dalvikvm(3821): 508: 0x41cd9668 byte[] (8 elements)
03-08 19:08:30.734: W/dalvikvm(3821): 507: 0x41cc9410 java.lang.Class<ob.android.Stream>
03-08 19:08:30.734: W/dalvikvm(3821): 506: 0x41cd9648 byte[] (8 elements)
03-08 19:08:30.734: W/dalvikvm(3821): 505: 0x41cc9410 java.lang.Class<ob.android.Stream>
03-08 19:08:30.742: W/dalvikvm(3821): 504: 0x41cd9628 byte[] (8 elements)
03-08 19:08:30.742: W/dalvikvm(3821): 503: 0x41cc9410 java.lang.Class<ob.android.Stream>
03-08 19:08:30.742: W/dalvikvm(3821): 502: 0x41cd9608 byte[] (8 elements)
03-08 19:08:30.742: W/dalvikvm(3821): Summary:
03-08 19:08:30.742: W/dalvikvm(3821): 256 of java.lang.Class (5 unique instances)
03-08 19:08:30.742: W/dalvikvm(3821): 2 of java.lang.String (2 unique instances)
03-08 19:08:30.742: W/dalvikvm(3821): 252 of byte[] (8 elements) (252 unique instances)
03-08 19:08:30.742: W/dalvikvm(3821): 1 of java.lang.String[] (2 elements)
03-08 19:08:30.742: W/dalvikvm(3821): 1 of ob.android.Stream
03-08 19:08:30.742: E/dalvikvm(3821): Failed adding to JNI local ref table (has 512 entries)
03-08 19:08:30.742: I/dalvikvm(3821): "main" prio=5 tid=1 RUNNABLE
03-08 19:08:30.742: I/dalvikvm(3821): | group="main" sCount=0 dsCount=0 obj=0x414f6508 self=0x40fc5a60
03-08 19:08:30.742: I/dalvikvm(3821): | sysTid=3821 nice=0 sched=0/0 cgrp=apps handle=1075121968
03-08 19:08:30.742: I/dalvikvm(3821): | schedstat=( 795410159 854705788 2161 ) utm=46 stm=32 core=0
03-08 19:08:30.742: I/dalvikvm(3821): at android.util.Log.println_native(Native Method)
03-08 19:08:30.742: I/dalvikvm(3821): at android.util.Log.v(Log.java:119)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.Stream.onResponse(Stream.java:57)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.Stream.stream(Native Method)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.Stream.<init>(Stream.java:30)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.MainActivity.startRecording(MainActivity.java:194)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.MainActivity.access$0(MainActivity.java:192)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.MainActivity$3.doAction(MainActivity.java:120)
03-08 19:08:30.742: I/dalvikvm(3821): at ob.android.view.ViewFactory$1.onClick(ViewFactory.java:41)
03-08 19:08:30.742: I/dalvikvm(3821): at android.view.View.performClick(View.java:4222)
03-08 19:08:30.742: I/dalvikvm(3821): at android.widget.CompoundButton.performClick(CompoundButton.java:100)
03-08 19:08:30.742: I/dalvikvm(3821): at android.view.View$PerformClick.run(View.java:17273)
03-08 19:08:30.750: I/dalvikvm(3821): at android.os.Handler.handleCallback(Handler.java:615)
03-08 19:08:30.750: I/dalvikvm(3821): at android.os.Handler.dispatchMessage(Handler.java:92)
03-08 19:08:30.750: I/dalvikvm(3821): at android.os.Looper.loop(Looper.java:137)
03-08 19:08:30.750: I/dalvikvm(3821): at android.app.ActivityThread.main(ActivityThread.java:4895)
03-08 19:08:30.750: I/dalvikvm(3821): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 19:08:30.750: I/dalvikvm(3821): at java.lang.reflect.Method.invoke(Method.java:511)
03-08 19:08:30.750: I/dalvikvm(3821): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
03-08 19:08:30.750: I/dalvikvm(3821): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
03-08 19:08:30.750: I/dalvikvm(3821): at dalvik.system.NativeStart.main(Native Method)
03-08 19:08:30.750: E/dalvikvm(3821): VM aborting
03-08 19:08:30.750: A/libc(3821): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 3821 (ob.android)
以下代码被连续调用,您认为突然的应用程序崩溃可能是什么问题。我希望它能够顺利而持续地运行。
SPropRecord* propRec = parseSPropParameterSets(fSubsession.fmtp_spropparametersets(), propNum);
__android_log_print(ANDROID_LOG_VERBOSE, "RTSP", "Frame: %c", propRec->sPropBytes);
jmethodID mid;
jclass handlerClass = env9->FindClass("ob/android/Stream");
if (handlerClass == NULL) {
__android_log_print(ANDROID_LOG_VERBOSE, "RTSP-Error", "Class");
}
mid = env9->GetStaticMethodID(handlerClass, "onResponse", "([B)V");
if (mid == NULL) {
__android_log_print(ANDROID_LOG_VERBOSE, "RTSP-Error", "Method");
}
jbyteArray jbArray = env9->NewByteArray((int)propRec->sPropLength);
env9->SetByteArrayRegion(jbArray, 0, (int)propRec->sPropLength, (jbyte*)propRec->sPropBytes);
//jobject theClass = env9->FindClass("ob/android/Stream");
env9->CallStaticVoidMethod(handlerClass, mid, jbArray);
env9->DeleteLocalRef(jbArray);
我正在发布jbArray引用,还有什么我应该发布的。
答案 0 :(得分:4)
你应该释放handlerClass。实际上,你不需要每次都调用FindClass,因为只需调用一次GetStaticMethodID(handlerClass,“onResponse”,“([B] V”)一次就可以在后续迭代中重用方法id。