Android app storage heap continues to grow

I get random (from memory) crashes in my application, so I started to analyze my heap. I noticed that if you switch from Activity A to Activity B, the heap increases (due to lazy loading of many images) from 27 MB to 35 MB. However, when I complete () activity B to return to Activity A, the heap size remains unchanged even when running GC!

It’s annoying that the transition to activity B once again increases the heap to 42 MB. I can do it as times can, and the pile will only increase.

This is the lazy image upload library I am using:

LazyList https://github.com/thest1/LazyList

These are heap screenshots

to: http://i.stack.imgur.com/7eTzm.png

after: http://i.stack.imgur.com/txeC6.png

converted heap dump file available upon request

UPDATE

From my debugging, it seems to be a problem from the LazyList library, but I'm still not 100% sure. Here is a link to people commenting on the library:

https://github.com/thest1/LazyList/issues/20

+5
source share
3 answers

, (, , , ). , , , , , ( ) , , onDestroy onStop ( ).

, hprof , , . .

+1

, , . Intent.FLAG_ACTIVITY_REORDER_TO_FRONT .

+1

I think these may be the images you use. Android BitmapFactory creates immutable bitmaps, and any changes you make to these bitmaps will therefore be separated from the original image.

Even worse, even if you say it recycle , it will depend on your links if it is garbage collected.

0
source

All Articles