I am getting the “[ERROR] dalvikvm: JNI ERROR (app bug): local reference table overflow (max=512)” issue when simply calling Ti.Contacts.getAllPeople(). Literally, that ONE line of code is causing the error.
- I have 2900 contacts (and I know plenty of people with more), so I am not an abnormal use case.
- I know it is this one line because I have removed any other code around it (after the permissions of course), and the call works on Android 6.0+, but does not work on versions prior to Android 6.0.
- It works perfectly fine when I run it against an emulator with 0 contacts, or even 5 contacts. I suspect that it is not releasing the memory when it iterates over the contacts that it is retrieving.
The environments that I tested this on were:
1. Multiple Android emulators, but they all follow the same specs (besides the screen size) as the attached image shows
2. On a Galaxy S4 running Android 4.4.2
Here is a snippet of the code: