In my android application I make extensive use of a native method that returns some data.
However after a number of calls I obtain a crash.
The native called method is :
static jbyteArray JNIGetIcon(JNIEnv* e, jclass clazz)
{
ByteBuffer buff;
buff.Write(*icon, 48, 32, r66Api::IBitmap::TEncoding::EEnc_Rgba8888);
jbyteArray result = GetEnv()->NewByteArray(buff.Size());
GetEnv()->SetByteArrayRegion(result, 0, buff.Size(), (jbyte*) buff.GetData());
return result;
}
Could someone point me to what I'm doing wrong ?
the crash log is:
02-10 18:33:32.075 W/dalvikvm(10644*10644): ReferenceTable overflow (max=1024)
02-10 18:33:32.075 W/dalvikvm(10644*10644): Last 10 entries in JNI pinned array reference table:
02-10 18:33:32.075 W/dalvikvm(10644*10644): 1014: 0x2fc77de0 cls=[C (28 bytes)
02-10 18:33:32.075 W/dalvikvm(10644*10644): 1015: 0x2fc79b88 cls=[C (28 bytes)
02-10 18:33:32.075 W/dalvikvm(10644*10644): 1016: 0x2fc79c38 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1017: 0x2fc79ef8 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1018: 0x2fc79fa8 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1019: 0x2fc7a050 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1020: 0x2fc7a0f0 cls=[C (28 bytes)
02-10 18:33:32.105 W/dalvikvm(10644*10644): 1021: 0x2fc7a190 cls=[C (28 bytes)
02-10 18:33:32.105 W/dalvikvm(10644*10644): 1022: 0x2fc7a240 cls=[C (28 bytes)
02-10 18:33:32.105 W/dalvikvm(10644*10644): 1023: 0x2fc7a2e8 cls=[C (28 bytes)
02-10 18:33:32.115 W/dalvikvm(10644*10644): JNI pinned array reference table summary (1024 entries):
02-10 18:33:32.115 W/dalvikvm(10644*10644): 6 of [C 20B (5 unique)
02-10 18:33:32.115 W/dalvikvm(10644*10644): 1013 of [C 28B (237 unique)
02-10 18:33:32.125 W/dalvikvm(10644*10644): 2 of [C 36B (2 unique)
02-10 18:33:32.125 W/dalvikvm(10644*10644): 1 of [C 52B
02-10 18:33:32.125 W/dalvikvm(10644*10644): 1 of [C 68B
02-10 18:33:32.125 W/dalvikvm(10644*10644): 1 of [C 92B
02-10 18:33:32.125 W/dalvikvm(10644*10644): Memory held directly by native code is 7020 bytes
02-10 18:33:32.135 E/dalvikvm(10644*10644): Failed adding to JNI pinned array ref table (1024 entries)
02-10 18:33:32.135 I/dalvikvm(10644*10644): "main" prio=5 tid=3 RUNNABLE
02-10 18:33:32.135 I/dalvikvm(10644*10644): | group="main" sCount=0 dsCount=0 s=N obj=0x2aaca308 self=0xbe08
02-10 18:33:32.135 I/dalvikvm(10644*10644): | sysTid=10644 nice=0 sched=0/0 cgrp=unknown handle=1877224116
02-10 18:33:32.135 I/dalvikvm(10644*10644): at android.graphics.Canvas.drawText(Native Method)
02-10 18:33:32.145 I/dalvikvm(10644*10644): at android.text.BoringLayout.draw(BoringLayout.java:363)
02-10 18:33:32.145 I/dalvikvm(10644*10644): at android.widget.TextView.onDraw(TextView.java:4052)
02-10 18:33:32.155 I/dalvikvm(10644*10644): at android.view.View.draw(View.java:6535)
02-10 18:33:32.155 I/dalvikvm(10644*10644): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
02-10 18:33:32.155 I/dalvikvm(10644*10644): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.View.draw(View.java:6538)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.View.buildDrawingCache(View.java:6297)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.View.getDrawingCache(View.java:6086)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.ViewGroup.drawChild(ViewGroup.java:1456)
02-10 18:33:32.175 I/dalvikvm(10644*10644): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
I think you're looking at the wrong function. According to the log message you've got a whole bunch of pinned character arrays (the "[C"). 1013 of them to be exact.
Look for a GetStringChars or GetStringCritical call that doesn't have a matching Release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With