0

I have some strange behaviour. On Nexus 5 (5.0.2) and Galaxy S5 (4.4.2) I have a lot of memory issue when browsing my app. I know most of them is due to rendering Bitmap. I'm using a lot of ImageView on my app, and put inside picture from server with Glide Library.

For example on Nexus, the heap size grown until 200 MB, what is is taking too much it is the Byte array, arround 160 MB when navigating on the app the size keep growing for both until I reach the size mentioned, and I got memory issue.

What is it strange, is that on a small memory phone Xperia (4.1.1) I do not got theses memory issue, the heap size is arround 30-40 MB, and the byte Array is arround 25MB. Even when navigate on the app, these value always stay arround this...

Why I got a different behavior?

I know for memory issue there is no easy fix. But I'm really disapointed of this behavior, I was expecting the opposite : More memory issue on the less powerfull phone!

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254
Chol
  • 2,097
  • 2
  • 16
  • 26
  • 1
    Are you showing resized images? http://developer.android.com/training/displaying-bitmaps/index.html – Vektor88 Jan 30 '15 at 11:31
  • 1
    [Check this](https://github.com/nostra13/Android-Universal-Image-Loader) – Skynet Jan 30 '15 at 11:32
  • 1
    If it is because of bitmaps rendering, I think you might need to create scaled bitmaps to show. Sometimes, it doesn't matter how much the heap has grown. Only a single bitmap rendering can throw this error. I think it might be because you are taking a very large photo taken from HD camera and converting it into bitmap. – DroidDev Jan 30 '15 at 11:32
  • http://stackoverflow.com/questions/18675557/what-is-the-maximum-amount-of-ram-an-app-can-use you must have to use piccaso , volley or universal lib to show image on imageview in entire application. Above lib are good and handle all the bitmap problem – duggu Jan 30 '15 at 11:33
  • @Vektor88: I'm not resizing picture, I have tried with picasso and it was worth! DroidDev: Actually is good picture from server, but the size of jpeg are around 150-200Ko Duggu: Theses Library are well better than Glide? I can try to use picasso (i already have the lib in my app) to see if it change anything! – Chol Jan 30 '15 at 11:48
  • @Duggu Glide is no different than those you listed... it's really effective. – TWiStErRob Jul 06 '15 at 13:10
  • @Chol file is not the same as in-memory Bitmap size. jpeg compresses stuff but Android needs uncompressed Bitmaps (that are backed by byte[] usually). So the Bitmap size will be `width*height*bitdepth`. Note that if you load a 1kb fully white png which has 3000*2000 dimensions file it will still be loaded as 24MB (3000*2000*32bits) in memory. – TWiStErRob Jul 06 '15 at 13:14

0 Answers0