Friday, February 28, 2014

Call jni in android, the emergence ReferenceTable overflow (max = 1024)


Starting android's brother recently jni, generally is to be a license plate recognition feature, but there has been ReferenceTable overflow (max = 1024) this error, quit the program throughout the java layer when the cycle is called jni recognition algorithms, to say the online search No release resources, but it is not the case, a brother can not do anything, I implore you to help, be grateful! Codes & log below,


Code:
extern "C" JNIEXPORT jdouble JNICALL Java_com_opencv_lpr_LibLPR_LPRprocess (
JNIEnv * env, jobject obj, jintArray imgbuf, jint w, jint h, jintArray scanArea, jlongArray BPaddress, jintArray result)
{
jint * cimgbuf = env-> GetIntArrayElements (imgbuf, 0);
jint * cscanArea = env-> GetIntArrayElements (scanArea, 0);
jlong ​​* cBPaddress = env-> GetLongArrayElements (BPaddress, 0);
jint * cresult = env-> GetIntArrayElements (result, 0);

...

env-> ReleaseIntArrayElements (result, cresult, 0);
env-> ReleaseLongArrayElements (BPaddress, cBPaddress, 0);
env-> ReleaseIntArrayElements (scanArea, cscanArea, 0);
env-> ReleaseIntArrayElements (imgbuf, cimgbuf, 0);

return ...
}



Log follows:
05-02 14:50:16.815: W / dalvikvm (8147): ReferenceTable overflow (max = 1024)
05-02 14:50:16.815: W / dalvikvm (8147): JNI pinned array reference table (0x68088300) dump:
05-02 14:50:16.815: W / dalvikvm (8147): Last 10 entries (of 1024):
05-02 14:50:16.815: W / dalvikvm (8147): 1023: 0x4276a740 int [] (10 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1022: 0x4276a6e8 long [] (8 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1021: 0x42752700 int [] (4 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1020: 0x477cf448 int [] (72000 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1019: 0x4276a740 int [] (10 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1018: 0x4276a6e8 long [] (8 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1017: 0x42750118 int [] (4 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1016: 0x47788f30 int [] (72000 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1015: 0x4276a740 int [] (10 elements)
05-02 14:50:16.815: W / dalvikvm (8147): 1014: 0x4276a6e8 long [] (8 elements)
05-02 14:50:16.815: W / dalvikvm (8147): Summary:
05-02 14:50:16.815: W / dalvikvm (8147): 256 of int [] (4 elements) (256 unique instances)
05-02 14:50:16.815: W / dalvikvm (8147): 256 of int [] (10 elements) (1 unique instances)
05-02 14:50:16.815: W / dalvikvm (8147): 256 of int [] (72000 elements) (256 unique instances)
05-02 14:50:16.815: W / dalvikvm (8147): 256 of long [] (8 elements) (1 unique instances)
05-02 14:50:16.815: E / dalvikvm (8147): Failed adding to JNI pinned array ref table (1024 entries)
05-02 14:50:16.815: I / dalvikvm (8147): "main" prio = 5 tid = 1 RUNNABLE
05-02 14:50:16.815: I / dalvikvm (8147): | group = "main" sCount = 0 dsCount = 0 obj = 0x41c8a700 self = 0x400b2010
05-02 14:50:16.815: I / dalvikvm (8147): | sysTid = 8147 nice = 0 sched = 0/0 cgrp = apps handle = 1074671408
05-02 14:50:16.815: I / dalvikvm (8147): | schedstat = (0 0 0) utm = 116 stm = 48 core = 0
05-02 14:50:16.815: I / dalvikvm (8147): at org.opencv.core.Mat.nPutB (Native Method)
05-02 14:50:16.815: I / dalvikvm (8147): at org.opencv.core.Mat.put (Mat.java: 2537)
05-02 14:50:16.815: I / dalvikvm (8147): at org.opencv.android.JavaCameraView.onPreviewFrame (JavaCameraView.java: 239)
05-02 14:50:16.815: I / dalvikvm (8147): at com.test.camera.CvJavaCameraView.onPreviewFrame (CvJavaCameraView.java: 119)
05-02 14:50:16.845: I / dalvikvm (8147): at android.hardware.Camera $ EventHandler.handleMessage (Camera.java: 775)
05-02 14:50:16.845: I / dalvikvm (8147): at android.os.Handler.dispatchMessage (Handler.java: 99)
05-02 14:50:16.845: I / dalvikvm (8147): at android.os.Looper.loop (Looper.java: 137)
05-02 14:50:16.845: I / dalvikvm (8147): at android.app.ActivityThread.main (ActivityThread.java: 4797)
05-02 14:50:16.845: I / dalvikvm (8147): at java.lang.reflect.Method.invokeNative (Native Method)
05-02 14:50:16.845: I / dalvikvm (8147): at java.lang.reflect.Method.invoke (Method.java: 511)
05-02 14:50:16.845: I / dalvikvm (8147): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 804)
05-02 14:50:16.845: I / dalvikvm (8147): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 571)
05-02 14:50:16.845: I / dalvikvm (8147): at dalvik.system.NativeStart.main (Native Method)
05-02 14:50:16.845: E / dalvikvm (8147): VM aborting<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Problem solving, colleagues found is due to return, jni methods with multiple return, but released only in the last return, so the shares of non-normal, then finish on the implementation of the program within the resources released to the effect, the effect
Reply:
I also appeared in 1024 the landlord Hello JNI overflow but I did not write my problem is calling JNI functions appear in it? Or call java did not release or not to read too much you can tell me thank you

No comments:

Post a Comment