Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Error "JNI ERROR (app bug): global reference table overflow (max=65535)"

My app crashes (very rarely) and reports this error:

 "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[+]"

What causes this error and how to fix it?

like image 248
Vyacheslav Avatar asked Mar 04 '17 13:03

Vyacheslav


1 Answers

You need to release the global references as and when you are done with it. Jni has kept some limitation on the memory pool in order to detect the memory leaks. Refer to this answer which has clear explanation. Why do we need to delete global references

like image 101
siva Avatar answered Oct 13 '22 03:10

siva