Android memory leak test data processing--procrank,setprop,getprop (RPM)

Source: Internet
Author: User

Several concepts commonly used in 1.Android memory testing.

Vss--virtual set size virtual memory consumption (contains memory consumed by shared libraries)
Rss--resident set size actual physical memory used (contains memory consumed by shared libraries)
Pss--proportional set size actual physical memory used (proportional allocation of memory consumed by shared libraries)
Uss--unique Set Size: Physical memory occupied by the process alone (does not contain memory consumed by shared libraries)
In general, the memory consumption size is as follows: Vss>=rss>=pss>=uss

The 2.Android Procrank command provides the data for the above concepts---------not all Android systems have integrated the Procrank command.

For memory leak testing, the USS Data is one of the best ways to display process memory leaks. Cause: The USS is able to fully display the physical memory of the process exclusive. The memory consumption of a running standalone process can be displayed normally. When the process is killed, the memory consumption of the USS display can be real feedback to the system.

Corresponds to the Android API:

1.final Activitymanager am = (activitymanager) getsystemservice (Activity_service);
2.android.os.debug.memoryinfo[] Memoryinfoarray = Am.getprocessmemoryinfo (New Int[]{android.os.process.mypid ()});

Where the Memoryinfo class provides API interface to help us get memory data

Uss:gettotalprivatedirty ()

Rss:gettotalshareddirty ()

PSS:GETTOTALPSS ()

Procrank command: # Procrank
Procrank
PID Vss Rss Pss Uss cmdline
481 31536K 30936K 14337K 9956K system_server
475 26128K 26128K 10046K 5992K zygote
526 25108K 25108K 9225K 5384K android.process.acore
523 22388K 22388K 7166K 3432K com.android.phone
574 21632K 21632K 6109K 2468K com.android.settings
521 20816K 20816K 6050K 2776K jp.co.omronsoft.openwnn
474 3304K 3304K 1097K 624k/system/bin/mediaserver
PNS 304K 304K 289K 288k/sbin/adbd
720K 720K 261K 212k/system/bin/rild
601 412K 412K 225K 216K Procrank
1 204K 204K 185K 184k/init
388K 388K 182K 172k/system/bin/qemud
284 384K 384K 160K 148K Top
376K 376K 148K 136k/system/bin/vold

The exported data can be filtered by the process name using the Exel table and then inserted in the USS Line chart relative to the process. You can clearly see if there is a memory leak.

3.getprop command:

#getprop

4.setprop Key value

Example: Setting a function in the status bar is not available: SetProp Persist.gn.monkeytest.status 1================= This property is not owned by every Android system.

Restart your phone after Setup is successful. The purpose of the setup is to prevent the monkey test process from pulling the status bar down and then disconnecting USB debugging.

Android memory leak test data processing--procrank,setprop,getprop (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.