fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Fresco does not work well on Lollipop and upper.

Open tbruceyu opened this issue 11 years ago • 3 comments

Fresco save bitmaps in the Android java VM heap on the Lollipop and upper. But it seems that Lollipop memory strategy dose not perform well on these devices. Facebook app runs on my Samsung Note4 would easily take almost 170M java heap memory! If load the local camera images, memory usage raise up to 211M. Please refer to the following output. Since this device is not rooted, I can't provide the hprof dumps. But I can do that if we would do the future work.

$ adb shell dumpsys meminfo com.facebook.katana
Applications Memory Usage (kB):
Uptime: 24045894 Realtime: 182766077

** MEMINFO in pid 2941 [com.facebook.katana] **
                   Pss  Private  Private  Swapped     Heap     Heap     Heap
                 Total    Dirty    Clean    Dirty     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------
  Native Heap        0        0        0        0    96228    96228    51227
  Dalvik Heap   183464   183420        4    25504   211055   201411     9644
 Dalvik Other     1388     1388        0        0
        Stack     1532     1532        0        0
       Cursor        2        0        0        0
       Ashmem      128      128        0        0
    Other dev   111553   102592       12        0
     .so mmap    13889      604     7816     1388
    .apk mmap     2151        0      964        0
    .ttf mmap     3742        0     3240        0
    .dex mmap    78828        0    78136        0
    code mmap     4804        0     2560        0
   image mmap     8544     2300     2828        0
   Other mmap     1233        4      776        0
     Graphics    49920    49920        0        0
           GL   177804   177804        0        0
      Unknown    80796    80624      152     2380
        TOTAL   719778   600316    96488    29272   307283   297639    60871

 Objects
               Views:     1284         ViewRootImpl:        3
         AppContexts:       13           Activities:        9
              Assets:        6        AssetManagers:        6
       Local Binders:      104        Proxy Binders:       59
    Death Recipients:        1
     OpenSSL Sockets:        1

 SQL
         MEMORY_USED:     5359
  PAGECACHE_OVERFLOW:     4036          MALLOC_SIZE:       62

 DATABASES
      pgsz     dbsz   Lookaside(b)          cache  Dbname
         4      340            334      113/52/12  /data/data/com.facebook.katana/databases/contacts_db2
         4       36             30        17/43/6  /data/data/com.facebook.katana/databases/composer_db
         4      192             80        20/49/9  /data/data/com.facebook.katana/databases/notifications_db
         4       28             33         8/43/3  /data/data/com.facebook.katana/databases/admined_pages_db
         4       24             52         8/40/3  /data/data/com.facebook.katana/databases/minutiae_db
         4       56             30        49/44/4  /data/data/com.facebook.katana/databases/analytics_db2
         4      136             31    1237/1274/4  /data/data/com.facebook.katana/databases/prefs_db
         4      224             61         9/44/4  /data/data/com.facebook.katana/databases/qe_db
         4       28             44        16/53/7  /data/data/com.facebook.katana/databases/timeline_db
         4      240            128     451/102/14  /data/data/com.facebook.katana/databases/newsfeed_db
         4       44             51        12/36/5  /data/data/com.facebook.katana/databases/photos_db
         4      148            201      397/64/10  /data/data/com.facebook.katana/databases/threads_db2
         4     1520            196    1432/191/25  /data/data/com.facebook.katana/databases/graphql_cache
         4       28             49        10/43/3  /data/data/com.facebook.katana/databases/offline_mode_db

 Asset Allocations
    zip:/data/app/com.facebook.katana-1/base.apk:/resources.arsc: 8284K
    zip:/data/app/com.facebook.katana-1/base.apk:/assets/fonts/Roboto-Bold.ttf:
114K
    zip:/data/app/com.facebook.katana-1/base.apk:/assets/fonts/Roboto-Medium.ttf: 114K

tbruceyu avatar Sep 03 '15 14:09 tbruceyu

@tbruceyu, thank you very much for this investigation, we'll investigate it further. Can you please tell us how did you use the app? E.g. scrolling news feed, navigating to timeline, browsing photos etc. This will help us identify whether the issue is in some of the app components (e.g. not resizing local images when we should) or there is a flaw in Fresco memory management. Thanks!

plamenko avatar Sep 03 '15 16:09 plamenko

Hi @plamenko , This issue is very easy to reproduce. I scrolled many news and browse the social photos.While I have scrolled down mass items, I scrolled up to the top again to click "What's on your mind", choose "Photo/Video", scroll the local photos down and up and then long click one photo to enter the photo tag page. Switch the images left and right. I runs an timing script(adb shell dumpsys meminfo com.facebook.katana | grep Heap) to monitor the app memory. After the java heap memory reach to about 260M, the ANR issue occured. But I can't see any useful information in the /data/anr/trace.txt, and the "dumpsys meminfo com.facebook.katana" command is always blocking. I dumped some other system status information in this link: http://www.bashshell.cn/Samsung_Note4.zip. Hope this is helpful. Thanks.

image

tbruceyu avatar Sep 03 '15 17:09 tbruceyu

Going to treat as a duplicate of #574

tyronen avatar Dec 11 '15 10:12 tyronen