Profiling Out Of Memory Exception on Android devices
Last week at work we noticed a huge amount of OutOfMemoryExceptions being reported in the Android app that I work with through Crashlytics.
These exceptions are very tricky! They are very difficult to reproduce in a controlled environment, and can have a lot to do with hardware specs of specific devices as well as special conditions due to the usage of the phone (apps/background services etc) at the point of the crash. And not to mention that debugging memory is really hard.
If you ever find yourself in a situation where you have to start digging into the profiler, then I highly recomend that you watch this video from start to end before starting. It is an excellent tutorial which will explain concepts such as Dominator Tree, or the difference between Shallow and Retained Heap. Or just how to extract a memorydump from your device to analyze: