如何修复错误“JNI ERROR(app bug):全局引用表溢出(max = 65535)”

时间:2017-03-04 13:40:52

标签: android delphi firemonkey

我的应用程序崩溃(非常罕见)并报告此错误:

 "JNI ERROR (app bug): global reference table overflow (max=65535)"
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109] JNI ERROR (app bug): global reference table overflow (max=65535)
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109] global reference table dump:
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]   Last 10 entries (of 65533):
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65532: 0x134039c0 java.lang.String "cocalac"
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65531: 0x76dd9200 android.graphics.Typeface
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65530: 0x13403940 java.lang.String " "
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65529: 0x13403860 java.lang.String "sans-serif-light"
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65528: 0x1328c940 android.graphics.Paint
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65527: 0x13403840 java.lang.String "sans-serif-light"
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65526: 0x134038a0 java.lang.String "sans-serif-light"
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65525: 0x134038c0 java.lang.String "#todo"
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65524: 0x13403940 java.lang.String " "
03-04 14:22:05.974: A/art(15796): sart/runtime/indirect_reference_table.cc:109]     65523: 0x134038e0 java.lang.String "... more[+]"

导致此错误的原因以及如何解决此问题?

1 个答案:

答案 0 :(得分:3)

您需要在完成后释放全局引用。 Jni对内存池保留了一些限制,以便检测内存泄漏。请参阅这个有明确解释的答案。 Why do we need to delete global references