Edited:
glide
to load images. I\'m getting Out of
In order to prevent Out of Memory error one can just make precautions to make sure that it will not occurs. So the answer of this question is actually a bunch of suggestions one can suggest. So do I.
As suggested by @Reaz Murshed I am also recommending to have the images in several different sizes. Apart from this I would like to add few more things that might help you analyze this issue and solve it.
As far as I remember OOM was always a usage error, largeHeap
will just delay it; or if it's a large load then maybe it's not possible. So I am suggesting you to follow this link to diagnose for memory leaks.
Stack traces of
OutOfMemoryErrors
don't help at all for diagnosing them. It just tells you it's broken and something filled up the memory. This filling happens much before the actual exception was thrown. This also implies that usually whatever throws theOOM
is not actually the culprit. The only exception to this is when the amount of wannabe allocated memory is simply too big, for example: an array to be allocated is bigger than the maximum memory, then you know that some calculation went really wrong, like a 32000x32000@4 image would take around 4GB of memory.If you can reproduce: get a heap dump and analyze your app's usage. Normal OOM diagnostic steps:
Reproduce exception (wait till you see it in LogCat)
Take a heap dump(To analyze memory leaks)
Analyze it for big objects and leaks
In above shared link there is few another links regarding how to take heap dump?
and issues that are identical with this one.
So I suggest you to analyze for memory leaks and take necessary steps to prevent OOM.
Hope this will help you.