内存耗用:VSS/RSS/PSS/USS

异常信息有:

------ PROCRANK (procrank) ------


  PID      Vss      Rss      Pss      Uss  cmdline


 2540   55172K   52076K   32177K   30596K  com.xxx.yyy


 1259   65212K   48196K   26297K   23476K  system_server


 1601   39740K   38220K   19066K   17492K  com.android.settings


 1363   32636K   32624K   13923K   12788K  com.android.phone


 5663   31356K   31336K   12313K   10916K  com.estrongs.android.pop


 5740   31464K   31448K   11851K   10168K  com.android.launcher


 1510   25188K   25152K    9039K    8180K  android.process.media


 1651   27600K   27584K    8733K    7572K  com.android.deskclock


 1369   29400K   26536K    8165K    6904K  com.android.systemui


 3340   26816K   26784K    8068K    6768K  com.wd.AndroidDaemon


 3004   26324K   26304K    8031K    6624K  com.cooliris.media


 3870   25648K   25612K    8019K    6836K  com.tencent.qqpimsecure


 4872   21516K   21476K    6224K    5268K  com.google.android.apps.maps


 1423   22528K   22508K    5948K    5056K  com.android.inputmethod.pinyin


 5796   23056K   23028K    5741K    4548K  com.android.mms


 5217   21680K   21628K    5458K    4560K  android.process.acore


 4165   21052K   21004K    5301K    4368K  com.qihoo360.mobilesafe


 1756   21768K   21744K    4776K    3852K  com.android.quicksearchbox


 1080   25020K   24956K    4010K    1696K  zygote


 3449   19116K   19064K    3752K    2868K  com.wd.AndroidDaemon:service


 1367   19040K   18996K    3264K    2468K  cn.cbc.cmmb.sdk


 1068    4900K    4836K    2702K    2148K  /system/bin/mediaserver


 1362   17472K   17424K    2570K    1820K  com.yeezonetech.firewall


 5861   16156K   16112K    2216K    1424K  com.android.defcontainer


 1584    1020K    1016K     772K     764K  logcat


 6014     772K     764K     555K     552K  procrank


 1044    1588K    1584K     451K     312K  /system/bin/engpcclient


 3898     668K     664K     416K     408K  logcat


 1086    1068K    1064K     344K     228K  /system/bin/synergy_service


 1147     584K     580K     332K     328K  /system/bin/phoneserver


 1079     888K     888K     318K     296K  /system/bin/rild_sp


 1039     268K     268K     248K     248K  /sbin/adbd


 2935     456K     452K     236K     232K  /data/xmesg


 1076     620K     616K     228K     192K  /system/bin/vold


    1     264K     264K     196K     156K  /init


 1077     572K     568K     194K     160K  /system/bin/netd


 1093     656K     652K     191K     176K  /system/bin/cmmbserver


 1577     720K     716K     178K     156K  vhub


 1040     700K     692K     176K     156K  /system/bin/nvitemd


 1579     708K     704K     173K     152K  vhub


 1574     700K     696K     169K     148K  vhub


 1565     700K     692K     165K     144K  vhub1


 6012     428K     424K     149K     144K  /system/bin/dumpstate


 1083     428K     420K     111K      96K  /system/bin/dbus-daemon


 1084     364K     360K     108K     104K  /system/bin/installd


  639     148K     148K     108K      68K  /sbin/ueventd


 6010     352K     344K     107K      76K  /system/bin/sh


 1085     432K     424K     106K      80K  /system/bin/keystore


 1583     352K     348K     104K      96K  logcat


 1232     368K     360K     103K      96K  hciattach


 1046     344K     340K      96K      92K  /system/bin/engmodemclient


 1038     324K     316K      95K      64K  /system/bin/sh


 1094     216K     216K      94K      52K  /system/xbin/busybox


 1091     216K     216K      94K      52K  /system/xbin/busybox


 1097     208K     208K      88K      48K  /system/xbin/busybox


 1092     428K     420K      88K      80K  /system/bin/akmd8975


 1231     304K     296K      87K      84K  csrbluezcoexsniffer


 1582     200K     200K      86K      48K  /system/xbin/busybox


 6011     324K     316K      84K      80K  bugreport


 1045     312K     308K      84K      80K  /system/bin/engservice


 1043     312K     308K      80K      76K  /system/bin/modemd


 1067     288K     280K      79K      76K  /system/bin/servicemanager


 1047     300K     292K      75K      72K  /system/bin/vcharged


 1089     296K     288K      71K      64K  /system/bin/logwrapper


 1090     296K     288K      71K      64K  /system/bin/logwrapper


 1042     284K     276K      63K      60K  /system/bin/sprd_monitor


 1060     276K     268K      63K      60K  open_ttyNK


 1078     256K     248K      55K      52K  /system/bin/debuggerd


[procrank: 0.8s elapsed]


经查阅:


VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存)RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存)PSS- Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存)USS- Unique Set Size 进程独自占用的物理内存(不包含共享库占用的内存)

一般来说内存占用大小有如下规律:VSS >= RSS >= PSS >= USS

Overview

The aim of this post is to provide information that will assist in interpreting memory reports from various tools so the true memory usage for Linux processes and the system can be determined.

Android has a tool calledprocrank(/system/xbin/procrank), which lists out the memory usage of Linux processes in order from highest to lowest usage. The sizes reported per process are VSS, RSS, PSS, and USS.

For the sake of simplicity in this description, memory will be expressed in terms of pages, rather than bytes. Linux systems like ours manage memory in 4096 byte pages at the lowest level.

VSS(reported as VSZ from ps) isthe total accessible address space of a process.This size also includes memory that may not be resident in RAM like mallocs that have been allocated but not written to. VSS is of very little use for determing real memory usage of a process.

RSSis thetotal memory actually held in RAM for a process.RSS can be misleading, because it reports the total all of the shared libraries that the process uses, even though a shared library is only loaded into memory once regardless of how many processes use it. RSS is not an accurate representation of the memory usage for a single process.

PSSdiffers from RSS in that it reports the proportional size of its shared libraries, i.e. if three processes all use a shared library that has 30 pages, that library will only contribute 10 pages to the PSS that is reported for each of the three processes. PSS is a very useful number because when the PSS for all processes in the system are summed together, that is a good representation for the total memory usage in the system. When a process is killed, the shared libraries that contributed to its PSS will be proportionally distributed to the PSS totals for the remaining processes still using that library. In this way PSS can be slightly misleading, because when a process is killed, PSS does not accurately represent the memory returned to the overall system.

USSisthe 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 ofmemory leaksin a process.

For systems that have Python available, there is also a nice tool calledsmemthat will report memory statistics including all of these categories.





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值