Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

query about "dumpsys meminfo" in android

Tags:

android

memory

When I run "adb shell dumpsys meminfo" on android 4.2, I get the result like

                                 Shared  Private     Heap     Heap     Heap
               Pss    Dirty    Dirty     Size    Alloc     Free
            ------   ------   ------   ------   ------   ------
   Native       28        8       28    16404    12256     3663
   Dalvik    14062    10060    13736    20032    15254     4778
   Cursor        0        0        0                           
   Ashmem        0        0        0                           
Other dev     4762     9556        0                           
 .so mmap    11699     1824     1500                           
.jar mmap        0        0        0                           
.apk mmap      368        0        0                           
.ttf mmap      811        0        0                           
.dex mmap     3736        0        0                               
Other mmap      114       16       32                           
   Unknown    12064      544    12052                           
     TOTAL    47644    22008    27348    36436    27510     8441

I have read the page of How do I discover memory usage of my application in Android?, but still have several questions:

  • Why the native Pss, shared dirty private dirty is very small?
  • the heap size should be smaller than Pss?
  • What does Unknown mean? Seems very big.
  • If I want to know how much memory my app uses, which data should I use? The Total Pss? But it doesn't include the native Pss which is nealy zero?
like image 952
Hui Liu Avatar asked Nov 02 '22 17:11

Hui Liu


1 Answers

Please refer to the question How do I discover memory usage of my application in Android?. I would also like you to refer to Detail VSS,RSS,PSS,USS link. The most appropriate data to use for a particular app is USS (Unique Set Size ) as

USS is the total private memory for a process, i.e. that memory that is completely unique to that process . USS is an extremely useful number because it indicates the true incremental cost of running a particular process. When a process is killed, the USS is the total memory that is actually returned to the system. USS is the best number to watch when initially suspicious of memory leaks in a process.

which you can get by adb shell procrank | grep <your.package.name>

like image 141
Nirmit Srivastava Avatar answered Nov 08 '22 08:11

Nirmit Srivastava