我正在分发面包瓦并获得LocalReferenceTableOverflow
。
它在以下代码中
static void saveBlocks(void *info, BRMerkleBlock *blocks[], size_t count){
__android_log_print(ANDROID_LOG_DEBUG, "Message from C: ", "saveBlocks");
if (!_peerManager){
return;
}
JNIEnv *env = getEnv();
jmethodID mid;
if (!env) return;
if (count != 1) {
__android_log_print(ANDROID_LOG_ERROR, "Message from C: ", "deleting %zu blocks", count);
mid = (*env)->GetStaticMethodID(env, _peerManagerClass, "deleteBlocks", "()V");
(*env)->CallStaticVoidMethod(env, _peerManagerClass, mid);
}
//call java methods
//Find the class and populate the array of objects of this class
jobjectArray blockObjectArray = (*env)->NewObjectArray(env, (jsize) count, _blockClass, 0);
for (size_t i = 0; i < count; i++) {
if (!_peerManager) return;
uint8_t buf[BRMerkleBlockSerialize(blocks[i], NULL, 0)];
size_t len = BRMerkleBlockSerialize(blocks[i], buf, sizeof(buf));
jbyteArray result = (*env)->NewByteArray(env, (jsize) len);
jobject blockObject;
(*env)->SetByteArrayRegion(env, result, 0, (jsize) len, (jbyte *) buf);
mid = (*env)->GetMethodID(env, _blockClass, "<init>", "([BI)V");
__android_log_print(ANDROID_LOG_DEBUG, "huhu", "hier bin ich gleich");
blockObject = (*env)->NewObject(env, _blockClass, mid, result, blocks[i]->height); // this line
__android_log_print(ANDROID_LOG_DEBUG, "huhu", "hier bin ich");
(*env)->SetObjectArrayElement(env, blockObjectArray, i, blockObject);
(*env)->DeleteLocalRef(env, result);
(*env)->DeleteLocalRef(env, blockObject);
}
mid = (*env)->GetStaticMethodID(env, _peerManagerClass, "saveBlocks",
"([Lcom/breadwallet/presenter/entities/BlockEntity;)V");
(*env)->CallStaticVoidMethod(env, _peerManagerClass, mid, blockObjectArray);
}
logcat的:
05-13 01:52:11.644 28316-28449/com.eMarkwallet D/com.breadwallet.wallet.BRPeerManager: saveBlocks: 1
05-13 01:52:11.644 28316-28449/com.eMarkwallet D/Message from C:: saveBlocks
05-13 01:52:11.644 28316-28449/com.eMarkwallet D/Message from C:: getEnv peerManager
05-13 01:52:11.644 28316-28449/com.eMarkwallet D/huhu: hier bin ich gleich
05-13 01:52:11.646 28316-28449/com.eMarkwallet A/art: art/runtime/indirect_reference_table.cc:132] JNI ERROR (app bug): local reference table overflow (max=512)
05-13 01:52:11.646 28316-28449/com.eMarkwallet A/art: art/runtime/indirect_reference_table.cc:132] local reference table dump:
05-13 01:52:11.646 28316-28449/com.eMarkwallet A/art: art/runtime/indirect_reference_table.cc:132] Last 10 entries (of 512):
05-13 01:52:11.646 28316-28449/com.eMarkwallet A/art: art/runtime/indirect_reference_table.cc:132] 511: 0x12e9c880 byte[] (80 elements)
05-13 01:52:11.646 28316-28449/com.eMarkwallet A/art: art/runtime/indirect_reference_table.cc:132] 510: 0x12c51700 com.breadwallet.presenter.entities.BlockEntity[] (1 elements)
05-13 01:52:11.646 28316-28449/com.eMarkwallet A/art: art/runtime/indirect_reference_table.cc:132] 509: 0x12c51140 com.breadwallet.presenter.entities.BlockEntity[] (1 elements)
谢谢!