-2

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

user1629977
  • 437
  • 1
  • 5
  • 21
  • Have you read over the Android doc [Loading Large Bitmaps Efficiently](https://developer.android.com/training/displaying-bitmaps/load-bitmap.html)? – Tigger Jun 22 '16 at 07:38
  • yes i read the doc. – user1629977 Jun 22 '16 at 07:40
  • The library seems to be dead. The last update was 2 years ago. Can you switch to an alternate like Glide, Picasso, Volley or do you have to use it? Other than that we cannot do much without some code. – GPuschka Jun 22 '16 at 07:45
  • @GPuschka ohh i just saw that. please guide me which one is best so library auto recover full doc of **loading large bitmaps efficiently** ? – user1629977 Jun 22 '16 at 07:50
  • i am looking free library – user1629977 Jun 22 '16 at 07:52
  • As far as I know they are all free. But I cannot tell which is best since I did not use all of them. But there is surely a discussion about that somewhere on the internet. – GPuschka Jun 22 '16 at 07:54
  • thanks i am turning into picasso. i will be back with my update – user1629977 Jun 22 '16 at 07:57
  • Possible duplicate of [Android:java.lang.OutOfMemoryError: Failed to allocate a 23970828 byte allocation with 2097152 free bytes and 2MB until OOM](http://stackoverflow.com/questions/32244851/androidjava-lang-outofmemoryerror-failed-to-allocate-a-23970828-byte-allocatio) – Harshad Pansuriya Jun 22 '16 at 08:05

2 Answers2

1

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!

Eduard B.
  • 6,735
  • 4
  • 27
  • 38
-1

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

android:largeHeap="true"
Robert
  • 5,278
  • 43
  • 65
  • 115
  • 2
    You shouldn't use `android:largeHeap="true"` unless you are working with very large bitmaps. Think of apps like Photoshop. Most of the time, OOMs are due to memory leaks, which can be fixed. – Eduard B. Jun 22 '16 at 08:19