Closed alexstyl closed 2 years ago
Closing this as no longer relevant.
Querying all contacts without any Columns should be light in memory. Also 99% of the times you won't need to keep any contacts in memory, as the ContactPredicate
allow you to find any contact you need optimally (i.e. for matching phone numbers to contacts)
Use the profiler that comes with Android Studio to investigate how much memory is required by Contact Store when fetching contacts.
More specifically, I would like to understand how much memory is required when doing a query for all contacts of the device. Testing with 1000 contacts sould be enough for testing.
You can use an app such as this to populate the device with multiple contacts.
More info
Someone reported a crash from production from a low end device. The crash seems to be related to Cursor allocation.
The user also mentioned that their app crashes with a similar crash from Room:
Both crashes seem to be related to memory allocation. I can think of ways of reducing the memory required by Contact Store, but we need to understand the memory required first.
Device Specs
https://www.gsmarena.com/tecno_pouvoir_3-9866.php