adb Shell Dumpsys Command

Source: Internet
Author: User

One, view memory
Android program memory is divided into 2 parts: native and Dalvik,dalvik are the Java heaps we normally call, the objects we create are assigned here, and bitmap are allocated directly on native, and the limit for memory is native+ Dalvik cannot exceed the maximum limit. Android program memory is generally limited to 16M, of course, there are 24M. use the following command to view the memory usage of the program:adb shell Dumpsys meminfo $package _name or $pid//Use the program's package name or process IDuse Com.tencent.qqpimsecure as an example:

    具体每一项代表什么,参考:http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android#2299813,我们比较关心的是这2行:

Where size is the required memory, and allocated is allocated memory, the corresponding 2 columns are native and Dalvik, and when the total is the maximum limit of the individual program memory, Oom is likely to occur.

Most of the time, the occurrence of Oom is doing some picture-related operations, the following suggestions to minimize the occurrence of this situation:

1.decode bitmap 的时候,尽量配置下Options,例如:inSameSize
2.Bitmap使用完以后,调用 bitmap.recycle()来释放内存
3.如果应用是基于图片的应用,尽量采用LazyLoad和DymanicRecycle
4.decode bitmap 的时候,将decode代码trycatch出来,catchoom error,避免程序crash,可以在catch里面做一些释放内存操作

http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android/2299813#2299813

Second, view the APK information
ADB Shell Dumpsys Package com.examle.xx

Third, other

Dumpsys Simple Introduction: The command user to print out the current system information, the default print out all service information, you can add activity parameters after the command, only print out the activity-related information.

The following parameters are available:Surfaceflinger, accessibility, account, activity, Alarm, appwidget, audio, backup, battery, batteryinfo, Bluetooth, b LUETOOTH_A2DP, clipboard, connectivity, content, Cpuinfo, Device_policy, Devicestoragemonitor, Diskstats, Dropbox, Entropy, hardware, hdmi, Input_method, Iphonesubinfo, isms, location, Media.audio_flinger, Media.audio_policy, Media.camera, Media.player, Meminfo, Mount, netstat, network_management, notification, package, permission, phone, power , search, sensor, Simphonebook, StatusBar, Telephony.registry, throttle, Uimode, usagestats, vibrator, wallpaper, WiFi, WI Ndow Example: >adb shell Dumpsys package>package.txt Package>package.txtis to use the pipe to print the information in Package.txt, and then use a text editor to open it to help us better search and analyze. Open Package.txt, some of which are as follows:Libraries:Android.test.runner-/system/framework/android.test.runner.jarCom.jayway.android.robotium-/system/framework/robotium.jarCom.mediatek.location.provider-/system/framework/com.mediatek.location.provider.jarcom.google.widevine.software.drm-/system/framework/com.google.widevine.software.drm.jarJavax.obex-/system/framework/javax.obex.jarcom.android.future.usb.accessory-/system/framework/com.android.future.usb.accessory.jarCom.android.location.provider-/system/framework/com.android.location.provider.jar Features:Android.hardware.wifiandroid.hardware.location.networkAndroid.hardware.telephonyandroid.hardware.locationAndroid.software.sipAndroid.hardware.touchscreen.multitouch.jazzhandAndroid.hardware.touchscreen.multitouchAndroid.hardware.screen.landscapeandroid.hardware.screen.portraitAndroid.hardware.faketouchAndroid.hardware.cameraAndroid.hardware.wifi.directandroid.hardware.usb.accessoryandroid.hardware.touchscreen.multitouch.distinctAndroid.hardware.bluetoothAndroid.software.sip.voipAndroid.hardware.sensor.lightAndroid.hardware.microphoneAndroid.hardware.location.gpsandroid.hardware.telephony.gsmAndroid.hardware.camera.frontAndroid.software.live_wallpaperAndroid.hardware.touchscreenAndroid.hardware.sensor.accelerometer

adb Shell Dumpsys Command

Related Article

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.