java.lang.OutOfMemoryError: Failed to allocate a 3225612 byte allocation with 886384 free bytes and 865KB until OOM

3.6k views Asked by At

Really having this issue. Sorry because this question many times has been asked. but it was needed. I am displaying large images after scale down. So My app looks like as Flipboard app. User can flip the pages right or left. I used recycle() so it will free the each bitmap. But when user will swipe 8 -9 pages it is working but after that app crash and some time not crash. Only issue is due to memory.

I am looking a way that i will catch the exception silently and free app memory. is it good way or possible? is any other solution?

i am using this library for displaying the images https://github.com/androidquery/androidquery

2

There are 2 answers

1
Ashish Gaur On

I guess it will solve your problem, just paste this in your application tag in manifest file

android:largeHeap="true"
0
Eduard B. On

It sounds like you have a memory leak. There are multiple tools to find out what is causing it.

  • LeakCanary, a very nice library from Square
  • Allocation Tracker in Android Studio
  • Eclipse Memory Analyzer (MAT) to analyze a heap dump

Good luck finding the culprit!