gpt4 book ai didi

android - JNI 错误(应用程序错误): local reference table overflow (max=512)

转载 作者:可可西里 更新时间:2023-11-01 16:17:53 25 4
gpt4 key购买 nike

我正在尝试运行 LibSVMAndroidClassification带有我自己的数据集的 Android 项目。它与已经提供的数据集一起工作得很好,当我使用我的 csv 100 行(小于原始大小的 1%)时它也工作得很好。但是当我尝试使用例如 1000 行的“Train CSV”时,我看到了这个错误。我什至尝试在 Manifest.xml 中设置 android:largeHeap="true"但没有任何改进。

这是我的 logcat 转储。

10-31 17:49:06.745: E/dalvikvm(2008): JNI ERROR (app bug): local reference table overflow (max=512)
10-31 17:49:06.745: W/dalvikvm(2008): JNI local reference table (0x754057e0) dump:
10-31 17:49:06.745: W/dalvikvm(2008): Last 10 entries (of 512):
10-31 17:49:06.745: W/dalvikvm(2008): 511: 0x42d900b0 double
10-31 17:49:06.745: W/dalvikvm(2008): 510: 0x42a19698 int
10-31 17:49:06.745: W/dalvikvm(2008): 509: 0x42d8ff78 double
10-31 17:49:06.745: W/dalvikvm(2008): 508: 0x42a195f0 int
10-31 17:49:06.745: W/dalvikvm(2008): 507: 0x42d8fe40 double
10-31 17:49:06.745: W/dalvikvm(2008): 506: 0x42a19548 int
10-31 17:49:06.745: W/dalvikvm(2008): 505: 0x42d8fd08 double
10-31 17:49:06.745: W/dalvikvm(2008): 504: 0x42a194a0 int
10-31 17:49:06.745: W/dalvikvm(2008): 503: 0x42d8fbd0 double
10-31 17:49:06.745: W/dalvikvm(2008): 502: 0x42a193f8 int
10-31 17:49:06.745: W/dalvikvm(2008): Summary:
10-31 17:49:06.745: W/dalvikvm(2008): 5 of java.lang.Class (4 unique instances)
10-31 17:49:06.745: W/dalvikvm(2008): 3 of java.lang.String (3 unique instances)
10-31 17:49:06.745: W/dalvikvm(2008): 249 of int (249 unique instances)
10-31 17:49:06.745: W/dalvikvm(2008): 1 of int
10-31 17:49:06.745: W/dalvikvm(2008): 250 of double (250 unique instances)
10-31 17:49:06.745: W/dalvikvm(2008): 1 of java.lang.String
10-31 17:49:06.745: W/dalvikvm(2008): 1 of int[]
10-31 17:49:06.745: W/dalvikvm(2008): 1 of edu.sinica.citi.mac.android.actclassification.ActClassificationActivity
10-31 17:49:06.745: W/dalvikvm(2008): 1 of double[]
10-31 17:49:06.745: E/dalvikvm(2008): Failed adding to JNI local ref table (has 512 entries)
10-31 17:49:06.745: I/dalvikvm(2008): "main" prio=5 tid=1 RUNNABLE
10-31 17:49:06.745: I/dalvikvm(2008): | group="main" sCount=0 dsCount=0 obj=0x42027710 self=0x420115f0
10-31 17:49:06.745: I/dalvikvm(2008): | sysTid=2008 nice=0 sched=0/0 cgrp=apps handle=1074106620
10-31 17:49:06.745: I/dalvikvm(2008): | state=R schedstat=( 774483646 137982240 4930 ) utm=59 stm=18 core=1
10-31 17:49:06.745: I/dalvikvm(2008): at edu.sinica.citi.mac.android.actclassification.ActClassificationActivity.svmtrain(Native Method)
10-31 17:49:06.745: I/dalvikvm(2008): at edu.sinica.citi.mac.android.actclassification.ActClassificationActivity.train_csv(ActClassificationActivity.java:329)
10-31 17:49:06.745: I/dalvikvm(2008): at edu.sinica.citi.mac.android.actclassification.ActClassificationActivity$2.onClick(ActClassificationActivity.java:125)
10-31 17:49:06.745: I/dalvikvm(2008): at android.view.View.performClick(View.java:4249)
10-31 17:49:06.745: I/dalvikvm(2008): at android.view.View$PerformClick.run(View.java:17764)
10-31 17:49:06.745: I/dalvikvm(2008): at android.os.Handler.handleCallback(Handler.java:730)
10-31 17:49:06.745: I/dalvikvm(2008): at android.os.Handler.dispatchMessage(Handler.java:92)
10-31 17:49:06.745: I/dalvikvm(2008): at android.os.Looper.loop(Looper.java:137)
10-31 17:49:06.745: I/dalvikvm(2008): at android.app.ActivityThread.main(ActivityThread.java:5137)
10-31 17:49:06.745: I/dalvikvm(2008): at java.lang.reflect.Method.invokeNative(Native Method)
10-31 17:49:06.745: I/dalvikvm(2008): at java.lang.reflect.Method.invoke(Method.java:525)
10-31 17:49:06.745: I/dalvikvm(2008): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:752)
10-31 17:49:06.745: I/dalvikvm(2008): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:568)
10-31 17:49:06.745: I/dalvikvm(2008): at miui.dexspy.DexspyInstaller.main(DexspyInstaller.java:171)
10-31 17:49:06.745: I/dalvikvm(2008): at dalvik.system.NativeStart.main(Native Method)
10-31 17:49:06.745: E/dalvikvm(2008): VM aborting
10-31 17:49:06.745: A/libc(2008): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 2008 (tclassification)

我在谷歌上搜索了很多,但我仍然无法理解这背后的背景和原因。许多人在不同的情况下都遇到过同样的错误。什么是指向解决方案的合适指针?

提前致谢!

最佳答案

您最好使用 DeleteLocalRef 删除以后永远不会使用的本地引用。例如

for (int i = 0; i < 512; i++)
{
jobject obj = env->GetObjectArrayElement(array, i);
//your code here
env->DeleteLocalRef(obj);
}

关于android - JNI 错误(应用程序错误): local reference table overflow (max=512),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26685491/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com