In my android application the onDestroy method on the Activity is never called before the application runs out of memory. I can call finish() on the onStop() method of the activity and will never run out of memory, however then I lose the back button functionality.
Sorry I can't be any more specific about the issue. Everything I have read is that android is supposed to call the onDestroy() and finish() when resources get low however this is never called.
I would like the activities at the bottom of the stack to have finish() called on them. They aren't and I eventually run out of memory.
I call: adb shell dumpsys meminfo com.mypackage
And I see the activity count always incrementing until the OutOfMemoryError. If I call finish() on the activities at onStop() then the activity count will stay around 30 and no OOME.
Thanks for any advice. Memory management on android is a disaster, thanks for tips you have.