Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed adding to JNI pinned array ref table (1024 entries) #6090

Open
i-n-g-o opened this issue Jul 30, 2018 · 2 comments
Open

Failed adding to JNI pinned array ref table (1024 entries) #6090

i-n-g-o opened this issue Jul 30, 2018 · 2 comments
Labels

Comments

@i-n-g-o
Copy link
Contributor

i-n-g-o commented Jul 30, 2018

when running a videograbber on a device the application is continuously pinning the image data array:

W/dalvikvm: JNI: pin count on array 0x4234bf90 ([F) is now 1022

when a maximum pin count of 1024 is reached, the application crashes:

W/dalvikvm: ReferenceTable overflow (max=1024)
W/dalvikvm: JNI pinned array reference table (0x52e34008) dump:
W/dalvikvm:   Last 10 entries (of 1024):
W/dalvikvm:      1023: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1022: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1021: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1020: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1019: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1018: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1017: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1016: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1015: 0x4234bf90 float[] (16 elements)
W/dalvikvm:      1014: 0x4234bf90 float[] (16 elements)
W/dalvikvm:   Summary:
W/dalvikvm:      1024 of float[] (16 elements) (1 unique instances)
E/dalvikvm: Failed adding to JNI pinned array ref table (1024 entries)
I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0x42063de0 self=0x42052478
I/dalvikvm:   | sysTid=29053 nice=0 sched=0/0 cgrp=apps handle=1074315604
I/dalvikvm:   | state=R schedstat=( 0 0 0 ) utm=4183 stm=554 core=0
I/dalvikvm:     at cc.openframeworks.OFAndroidVideoGrabber.newFrame(Native Method)
I/dalvikvm:     at cc.openframeworks.OFAndroidVideoGrabber.onPreviewFrame(OFAndroidVideoGrabber.java:345)
I/dalvikvm:     at android.hardware.Camera$EventHandler.handleMessage(Camera.java:980)
I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:102)
I/dalvikvm:     at android.os.Looper.loop(Looper.java:136)
I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:5139)
I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:515)
I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
E/dalvikvm: VM aborting
A/libc: Fatal signal 6 (SIGABRT) at 0x0000717d (code=-6), thread 29053 (.grabberTestAnd)
Application terminated.

looking into ofxAndroidVideoGrabber.cpp i can see that the byte-array gets released when not used anymore: env->ReleaseByteArrayElements(array, (jbyte*)currentFrame, 0); but somehow the pin-count on the array is not reduced.

i tried what is proposed in this stackoverflow post: https://stackoverflow.com/questions/18668135/jni-memory-leak-from-byte-array#18668319 without any change in the behaviour.

of code:

void ofApp::setup(){
	grabber.initGrabber(320, 240);
}
void ofApp::update(){
	grabber.update();
}
@i-n-g-o
Copy link
Contributor Author

i-n-g-o commented Jul 31, 2018

even when completely disabling the use of the jbyteArray in Java_cc_openframeworks_OFAndroidVideoGrabber_newFrame the pin count would ascend.
??

@arturoc
Copy link
Member

arturoc commented Aug 1, 2018

how long more or less does this take to happen? i've been trying with my phone for a while but i can't see this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants