In my application I keep receiving crash reports where the root cause is an OutOfMemoryError.
The app is quite image heavy (I use Picasso for all the image loading) and also has a WebView component that is used to display all kinds of content from text and images to embedded videos and animated GIFs.
I used Square's LeakCanary in some places but was unable to find consistent leaks. With my understanding of Android's runtimes being quite incomplete, this leads me to my main question:
Does an OutOfMemory always need to have a leak as the root cause or is it possible/probable that one occurs for other reasons? Which other reasons would that be? The garbage collector working not fast enough? Simply using too much heap space for (e.g.) Bitmaps? Is there anything that can be done about these problems?
EDIT: To make it more clear what I need to know: I am quite certain that no single allocation I am doing is exceeding the total available heap space. It is just that occasionally I seem to get too much space used up so that some random allocation after that fails; at least the crashes are actually quite rare and not easily reproducable. Is that a reasonably certain sign of an earlier leak or is it still possible that I just have "too much going on" at once and there really is nothing the GC could have freed to make the current allocation work?END EDIT
If you think I should keep looking for memory leaks: Apart from
Activitys, which LeakCanary tracks automatically what are some good places to look for leaks?