1

From Android docs, it appears that onLowMemory and onTrimMemory callbacks only start triggering when whole device is getting low on memory.

However, from what I understand, on Android, every app has limited per-app heap. Even if rest of the phone has plenty of memory, my app can gradually fill up its own heap with various caches and crash with OutOfMemoryException while onTrimMemory would never be called.

There are ways to track memory usage, but all of those are polling-based.

Is there a callback similar to onTrimMemory that also takes per-app into account?

Matej Drobnič
  • 981
  • 10
  • 18

0 Answers0