Вопрос

When I launch and exit my app several times its RAM usage increases reaching over 500 mb. When I checked memory dump using adb shell dumpsys meminfo I checked unknown pss value is cause of problem. What is reason of large pss value and how I can reduce pss value.

Shared  Private     Heap     Heap     Heap

                   Pss    Dirty    Dirty     Size    Alloc     Free

                ------   ------   ------   ------   ------   ------

       Native        0        0        0   534460   531827     1604
       Dalvik    51013    17868    50664    90480    82266     8214
       Cursor        0        0        0                           
       Ashmem        0        0        0                           
    Other dev    14292       52    14288                           
     .so mmap     3810     2320     1720                           
    .jar mmap        0        0        0                           
    .apk mmap     1305        0        0                           
    .ttf mmap        0        0        0                           
    .dex mmap     2960        0        0                           
   Other mmap     1738      440      236                           
      Unknown   504718      296   384284                           
        TOTAL   579836    20976   451192   624940   614093     9818
Это было полезно?

Решение

I found out reason of high RAM usage. When I analyzed native heap dump of app I got to know that instances of library libharfbuzz.so was taking up huge space and that library is used for displaying fonts, so when I checked code there were lot of instances of TypeFace cretaed in code at number of places. As TypeFace are allocated in native memory and it makes native heap size large thats why RAM usage was more. I removed those instances and created single TypeFace instance and used it in my app and RAM usage was decreased.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top