我是靠谱客的博主 甜美红酒,最近开发中收集的这篇文章主要介绍android 内存泄漏分析过程详解1 运行自动化测试工具; 2 在运行之初观察内存分配情况; 3 匿名内存增长很厉害,增长15M左右,匿名内存出现了泄漏。,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
1 运行自动化测试工具;
跑用例,譬如执行100遍
2 在运行之初观察内存分配情况;
2.1 查看进程号
C:UsersAdministrator>adb shell ps | find "camera"
camera 292 1 114960 14452 ffffffff b6f178bc S /system/bin/mm-qcamera-daemon
system 7833 233 512888 19552 ffffffff 400c1920 S com.vivo.cameraparamluma
u0_a71 8179 233 652844 79924 ffffffff 400c1920 S com.android.camera
system 7833 233 512888 19552 ffffffff 400c1920 S com.vivo.cameraparamluma
u0_a71 8179 233 652844 79924 ffffffff 400c1920 S com.android.camera
2.2 查看进程中各部分所占内存情况,进程中内存分为两个部分(dalvik与native),详细解释见http://blog.csdn.net/xyz_lmn/article/details/7001892
C:UsersAdministrator>adb shell dumpsys meminfo com.android.camera
Applications Memory Usage (kB):
Uptime: 24925133 Realtime: 31366996
** MEMINFO in pid 8179 [com.android.camera] **
Pss Private Private Swapped Heap Heap Heap
Total Dirty Clean Dirty Size Alloc Free
------ ------ ------ ------ ------ ------ ------
Native Heap 0 0 0 0 14024 9860 455
Dalvik Heap 32338 32236 0 0 34692 25734 8958
Dalvik Other 2820 2680 0 0
Stack 260 260 0 0
Other dev 7509 7476 4 0
.so mmap 4905 1716 588 0
.apk mmap 606 0 240 0
.ttf mmap 449 0 336 0
.dex mmap 3690 52 2400 0
Other mmap 112 4 76 0
Unknown 5005 4988 0 0
TOTAL 57694 49412 3644 0 48716 35594 9413
Objects
Views: 446 ViewRootImpl: 1
AppContexts: 3 Activities: 1
Assets: 3 AssetManagers: 3
Local Binders: 63 Proxy Binders: 25
Death Recipients: 0
OpenSSL Sockets: 0
SQL
MEMORY_USED: 0
PAGECACHE_OVERFLOW: 0 MALLOC_SIZE: 0
Uptime: 24925133 Realtime: 31366996
** MEMINFO in pid 8179 [com.android.camera] **
Pss Private Private Swapped Heap Heap Heap
Total Dirty Clean Dirty Size Alloc Free
------ ------ ------ ------ ------ ------ ------
Native Heap 0 0 0 0 14024 9860 455
Dalvik Heap 32338 32236 0 0 34692 25734 8958
Dalvik Other 2820 2680 0 0
Stack 260 260 0 0
Other dev 7509 7476 4 0
.so mmap 4905 1716 588 0
.apk mmap 606 0 240 0
.ttf mmap 449 0 336 0
.dex mmap 3690 52 2400 0
Other mmap 112 4 76 0
Unknown 5005 4988 0 0
TOTAL 57694 49412 3644 0 48716 35594 9413
Objects
Views: 446 ViewRootImpl: 1
AppContexts: 3 Activities: 1
Assets: 3 AssetManagers: 3
Local Binders: 63 Proxy Binders: 25
Death Recipients: 0
OpenSSL Sockets: 0
SQL
MEMORY_USED: 0
PAGECACHE_OVERFLOW: 0 MALLOC_SIZE: 0
2.3 查看进程跑起来后各库所占用内存情况。
此时如果所用的机器是user版本的话,需要将所编译eng版本的
system/xbin/showmap push到手机 system/xbin 目录,并且修改权限为可执行
adb push ./system/xbin/showmap system/xbin
adb chmod 777 system/xbin/showmap
C:UsersAdministrator>adb shell showmap 8179
virtual shared shared private private
size RSS PSS clean dirty clean dirty # object
-------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
884 776 426 588 0 188 0 3 /data/app/com.android.camera-2.apk
2664 1972 1972 0 0 1972 0 1 /data/dalvik-cache/data@app@com.android.camera-2.apk@classes.dex
128 56 1 0 56 0 0 1 /dev/__properties__
16384 4232 1003 0 3344 0 888 4 /dev/ashmem/dalvik-LinearAlloc (deleted)
2568 1736 919 0 840 0 896 25 /dev/ashmem/dalvik-aux-structure (deleted)
4096 0 0 0 0 0 0 1 /dev/ashmem/dalvik-bitmap-1 (deleted)
4096 312 312 0 0 0 312 1 /dev/ashmem/dalvik-bitmap-2 (deleted)
2052 264 264 0 0 0 264 1 /dev/ashmem/dalvik-card-table (deleted)
259024 25836 25836 0 0 0 25836 3 /dev/ashmem/dalvik-heap (deleted)
1500 420 420 0 0 0 420 1 /dev/ashmem/dalvik-jit-code-cache (deleted)
87384 0 0 0 0 0 0 1 /dev/ashmem/dalvik-mark-stack (deleted)
3120 3120 781 0 2440 0 680 1 /dev/ashmem/dalvik-zygote (deleted)
2040 4 4 0 0 4 0 1 /dev/binder
6628 3352 3324 0 56 0 3296 82 /dev/kgsl-3d0
12 12 1 8 4 0 0 2 /system/bin/app_process
68 56 8 48 4 0 4 3 /system/bin/linker
4 4 2 4 0 0 0 1 /system/fonts/AndroidEmoji.ttf
112 4 4 0 0 4 0 1 /system/fonts/DroidNaskhUI-Regular.ttf
16 4 4 0 0 4 0 1 /system/fonts/DroidSansArmenian.ttf
224 4 4 0 0 4 0 1 /system/fonts/DroidSansEthiopic-Regular.ttf
7560 300 195 180 0 120 0 1 /system/fonts/DroidSansFallbackBBK.ttf
24 4 4 0 0 4 0 1 /system/fonts/DroidSansGeorgian.ttf
32 0 0 0 0 0 0 1 /system/fonts/DroidSansHebrew-Bold.ttf
32 16 12 8 0 8 0 1 /system/fonts/DroidSansHebrew-Regular.ttf
1396 24 16 16 0 8 0 1 /system/fonts/NanumGothic.ttf
3252 8 4 8 0 0 0 1 /system/fonts/NotoColorEmoji.ttf
104 4 4 0 0 4 0 1 /system/fonts/NotoSansBengaliUI-Bold.ttf
108 8 8 0 0 8 0 1 /system/fonts/NotoSansBengaliUI-Regular.ttf
120 0 0 0 0 0 0 1 /system/fonts/NotoSansDevanagariUI-Bold.ttf
124 12 12 0 0 12 0 1 /system/fonts/NotoSansDevanagariUI-Regular.ttf
76 8 8 0 0 8 0 1 /system/fonts/NotoSansKannadaUI-Bold.ttf
80 8 8 0 0 8 0 1 /system/fonts/NotoSansKannadaUI-Regular.ttf
44 16 16 0 0 16 0 1 /system/fonts/NotoSansKhmerUI-Bold.ttf
44 16 16 0 0 16 0 1 /system/fonts/NotoSansKhmerUI-Regular.ttf
36 12 12 0 0 12 0 1 /system/fonts/NotoSansLaoUI-Bold.ttf
36 8 8 0 0 8 0 1 /system/fonts/NotoSansLaoUI-Regular.ttf
56 0 0 0 0 0 0 1 /system/fonts/NotoSansMalayalamUI-Bold.ttf
56 8 8 0 0 8 0 1 /system/fonts/NotoSansMalayalamUI-Regular.ttf
4 4 2 4 0 0 0 1 /system/fonts/NotoSansSymbols-Regular.ttf
40 0 0 0 0 0 0 1 /system/fonts/NotoSansTamilUI-Bold.ttf
36 12 12 0 0 12 0 1 /system/fonts/NotoSansTamilUI-Regular.ttf
112 8 8 0 0 8 0 1 /system/fonts/NotoSansTeluguUI-Bold.ttf
112 12 12 0 0 12 0 1 /system/fonts/NotoSansTeluguUI-Regular.ttf
20 0 0 0 0 0 0 1 /system/fonts/NotoSansThaiUI-Bold.ttf
24 8 8 0 0 8 0 1 /system/fonts/NotoSansThaiUI-Regular.ttf
468 28 14 28 0 0 0 1 /system/fonts/Padauk-book.ttf
432 28 28 0 0 28 0 1 /system/fonts/Padauk-bookbold.ttf
80 24 12 16 0 8 0 1 /system/fonts/Roboto-Bold.ttf
80 12 8 4 0 8 0 1 /system/fonts/Roboto-Regular.ttf
4 0 0 0 0 0 0 1 /system/framework/WfdCommon.jar
76 8 0 8 0 0 0 1 /system/framework/WfdCommon.odex
4 0 0 0 0 0 0 1 /system/framework/android.policy.jar
340 172 45 172 0 0 0 1 /system/framework/android.policy.odex
8 0 0 0 0 0 0 1 /system/framework/apache-xml.jar
1348 32 3 32 0 0 0 1 /system/framework/apache-xml.odex
4 0 0 0 0 0 0 1 /system/framework/bouncycastle.jar
1092 104 22 92 0 12 0 1 /system/framework/bouncycastle.odex
4 0 0 0 0 0 0 1 /system/framework/conscrypt.jar
368 44 3 44 0 0 0 1 /system/framework/conscrypt.odex
4 0 0 0 0 0 0 1 /system/framework/core-junit.jar
28 8 0 8 0 0 0 1 /system/framework/core-junit.odex
4 0 0 0 0 0 0 1 /system/framework/core.jar
3168 1444 263 1376 0 68 0 1 /system/framework/core.odex
76 0 0 0 0 0 0 1 /system/framework/ext.jar
1480 172 17 172 0 0 0 1 /system/framework/ext.odex
1480 460 146 412 0 48 0 2 /system/framework/framework-res.apk
4 0 0 0 0 0 0 1 /system/framework/framework.jar
9856 5004 1094 4184 456 312 52 191 /system/framework/framework.odex
4 0 0 0 0 0 0 1 /system/framework/framework2.jar
2060 884 186 856 0 28 0 1 /system/framework/framework2.odex
4 0 0 0 0 0 0 1 /system/framework/mms-common.jar
132 8 0 8 0 0 0 1 /system/framework/mms-common.odex
4 0 0 0 0 0 0 1 /system/framework/oem-services.jar
4 4 0 4 0 0 0 1 /system/framework/oem-services.odex
8 0 0 0 0 0 0 1 /system/framework/okhttp.jar
212 12 0 12 0 0 0 1 /system/framework/okhttp.odex
4 0 0 0 0 0 0 1 /system/framework/org.codeaurora.Performance.jar
8 8 0 8 0 0 0 1 /system/framework/org.codeaurora.Performance.odex
4 0 0 0 0 0 0 1 /system/framework/qcmediaplayer.jar
24 8 0 8 0 0 0 1 /system/framework/qcmediaplayer.odex
4 0 0 0 0 0 0 1 /system/framework/qcom.fmradio.jar
64 16 5 12 0 4 0 1 /system/framework/qcom.fmradio.odex
4 0 0 0 0 0 0 1 /system/framework/services.jar
3800 80 11 80 0 0 0 1 /system/framework/services.odex
4 0 0 0 0 0 0 1 /system/framework/telephony-common.jar
1540 20 1 20 0 0 0 1 /system/framework/telephony-common.odex
8 0 0 0 0 0 0 1 /system/framework/telephony-msim.jar
180 12 0 12 0 0 0 1 /system/framework/telephony-msim.odex
4 0 0 0 0 0 0 1 /system/framework/vcard.jar
164 8 0 8 0 0 0 1 /system/framework/vcard.odex
4 0 0 0 0 0 0 1 /system/framework/vivo-framework.jar
2356 52 6 52 0 0 0 1 /system/framework/vivo-framework.odex
4 0 0 0 0 0 0 1 /system/framework/vivo-media.jar
264 128 57 128 0 0 0 1 /system/framework/vivo-media.odex
1960 172 34 168 0 4 0 2 /system/framework/vivo-res.apk
4 0 0 0 0 0 0 1 /system/framework/voip-common.jar
168 12 1 12 0 0 0 1 /system/framework/voip-common.odex
4 0 0 0 0 0 0 1 /system/framework/webviewchromium.jar
764 100 22 88 0 12 0 1 /system/framework/webviewchromium.odex
20 20 9 12 0 0 8 3 /system/lib/hw/gralloc.msm8916.so
284 280 148 0 136 0 144 4 /system/lib/hw/memtrack.msm8916.so
340 80 21 36 28 0 16 4 /system/lib/libEGL.so
16 8 0 0 8 0 0 3 /system/lib/libETC1.so
316 8 0 0 8 0 0 4 /system/lib/libGLES_trace.so
28 28 7 16 8 4 0 3 /system/lib/libGLESv1_CM.so
32 20 2 12 8 0 0 3 /system/lib/libGLESv2.so
8324 220 6 0 220 0 0 5 /system/lib/libLLVM.so
208 8 0 0 8 0 0 3 /system/lib/libRS.so
80 8 0 0 8 0 0 4 /system/lib/libRScpp.so
64 12 0 0 12 0 0 3 /system/lib/libandroid.so
732 344 85 244 44 48 8 4 /system/lib/libandroid_runtime.so
156 84 12 72 4 0 8 4 /system/lib/libandroidfw.so
236 28 0 0 28 0 0 4 /system/lib/libaudioflinger.so
20 8 0 0 8 0 0 4 /system/lib/libaudioparameter.so
16 8 0 0 8 0 0 3 /system/lib/libaudioutils.so
268 8 0 0 8 0 0 5 /system/lib/libbcc.so
216 12 4 0 8 0 4 4 /system/lib/libbcinfo.so
180 148 18 120 24 0 4 4 /system/lib/libbinder.so
364 232 33 188 20 0 24 4 /system/lib/libc.so
216 72 13 32 36 0 4 3 /system/lib/libcamera_client.so
32 12 4 0 8 0 4 4 /system/lib/libcamera_metadata.so
68 20 0 0 20 0 0 5 /system/lib/libcommon_time_client.so
12 8 0 0 8 0 0 3 /system/lib/libconnectivitymanager.so
20 8 0 0 8 0 0 3 /system/lib/libcorkscrew.so
944 76 1 0 76 0 0 5 /system/lib/libcrypto.so
44 44 5 36 4 0 4 3 /system/lib/libcutils.so
96 16 0 0 16 0 0 3 /system/lib/libdrmframework.so
32 8 0 0 8 0 0 3 /system/lib/libdrmframework_jni.so
816 588 72 504 40 32 12 4 /system/lib/libdvm.so
16 8 0 0 8 0 0 3 /system/lib/libeffects.so
176 52 1 0 52 0 0 3 /system/lib/libexif.so
92 12 0 0 12 0 0 4 /system/lib/libexpat.so
328 164 49 152 12 0 0 3 /system/lib/libft2.so
24 12 1 4 8 0 0 3 /system/lib/libgabi++.so
28 8 0 0 8 0 0 4 /system/lib/libgccdemangle.so
256 116 17 76 36 0 4 4 /system/lib/libgui.so
12 12 0 4 8 0 0 3 /system/lib/libhardware.so
32 8 0 0 8 0 0 4 /system/lib/libhardware_legacy.so
296 172 39 160 8 4 0 3 /system/lib/libharfbuzz_ng.so
220 164 34 148 8 4 4 4 /system/lib/libhwui.so
1252 236 65 192 28 12 4 4 /system/lib/libicui18n.so
1020 424 104 340 40 40 4 4 /system/lib/libicuuc.so
92 56 6 44 12 0 0 3 /system/lib/libinput.so
260 248 236 24 0 0 224 5 /system/lib/libiomx_vivo.so
28 8 0 0 8 0 0 3 /system/lib/libiss_svc.so
208 112 14 96 8 4 4 4 /system/lib/libjavacore.so
80 8 0 0 8 0 0 3 /system/lib/libjavacrypto.so
48 8 0 0 8 0 0 5 /system/lib/libjhead.so
16 8 0 0 8 0 0 3 /system/lib/libjhead_jni.so
12 8 0 0 8 0 0 3 /system/lib/libjnigraphics.so
220 116 41 100 8 8 0 4 /system/lib/libjpeg.so
20 20 0 12 8 0 0 3 /system/lib/liblog.so
104 72 7 64 8 0 0 3 /system/lib/libm.so
568 332 203 64 88 176 4 3 /system/lib/libmedia.so
220 32 11 12 12 8 0 4 /system/lib/libmedia_jni.so
20 20 9 12 0 0 8 3 /system/lib/libmemalloc.so
12 8 0 0 8 0 0 3 /system/lib/libmemtrack.so
80 8 0 0 8 0 0 4 /system/lib/libmtp.so
24 24 9 12 4 4 4 3 /system/lib/libnativehelper.so
32 8 0 0 8 0 0 3 /system/lib/libnbaio.so
28 8 0 0 8 0 0 3 /system/lib/libnetutils.so
128 72 9 64 8 0 0 3 /system/lib/libpng.so
20 8 0 0 8 0 0 3 /system/lib/libpowermanager.so
20 8 0 0 8 0 0 3 /system/lib/libqcomfm_jni.so
32 28 12 20 0 0 8 3 /system/lib/libqdutils.so
160 156 135 28 0 0 128 5 /system/lib/libqservice.so
164 136 23 0 116 0 20 5 /system/lib/librs_jni.so
52 36 6 28 4 0 4 4 /system/lib/libselinux.so
1948 444 90 336 72 20 16 4 /system/lib/libskia.so
344 12 4 0 8 0 4 5 /system/lib/libsonivox.so
16 16 10 8 0 0 8 3 /system/lib/libsoundpool.so
24 8 0 0 8 0 0 3 /system/lib/libspeexresampler.so
328 12 0 4 8 0 0 4 /system/lib/libsqlite.so
248 20 0 0 20 0 0 4 /system/lib/libssl.so
1084 308 93 276 32 0 0 3 /system/lib/libstagefright.so
148 100 53 0 48 0 52 4 /system/lib/libstagefright_amrnb_common.so
28 8 0 0 8 0 0 3 /system/lib/libstagefright_avc_common.so
12 8 0 0 8 0 0 3 /system/lib/libstagefright_enc_common.so
72 8 0 0 8 0 0 3 /system/lib/libstagefright_foundation.so
116 16 0 0 16 0 0 4 /system/lib/libstagefright_omx.so
16 8 0 0 8 0 0 3 /system/lib/libstagefright_yuv.so
12 12 0 4 8 0 0 3 /system/lib/libstdc++.so
212 116 27 104 8 0 4 3 /system/lib/libstlport.so
12 12 0 4 8 0 0 3 /system/lib/libsync.so
44 44 10 36 4 0 4 3 /system/lib/libui.so
16 8 0 0 8 0 0 3 /system/lib/libusbhost.so
88 84 11 76 4 0 4 4 /system/lib/libutils.so
532 8 0 0 8 0 0 3 /system/lib/libval_2.0.so
12 8 0 0 8 0 0 3 /system/lib/libval_common.so
224 8 0 0 8 0 0 4 /system/lib/libvideoeditor_core.so
92 12 0 0 12 0 0 4 /system/lib/libvideoeditor_jni.so
24 8 0 0 8 0 0 3 /system/lib/libvideoeditor_osal.so
20 8 0 0 8 0 0 3 /system/lib/libvideoeditor_videofilters.so
228 112 30 0 84 0 28 5 /system/lib/libvideoeditorplayer.so
16680 2948 1654 2588 0 0 360 4 /system/lib/libvlcjni_vivo.so
112 16 8 0 8 0 8 4 /system/lib/libvorbisidec.so
20796 1088 36 0 1088 0 0 4 /system/lib/libwebviewchromium.so
316 308 222 0 88 0 220 4 /system/lib/libwebviewchromium_plat_support.so
20 8 0 0 8 0 0 4 /system/lib/libwpa_client.so
100 80 13 72 8 0 0 4 /system/lib/libz.so
37176 176 103 100 0 76 0 2 /system/usr/icu/icudt51l.dat
548 4 0 4 0 0 0 1 /system/usr/share/zoneinfo/tzdata
116 112 82 36 0 0 76 4 /system/vendor/lib/egl/eglsubAndroid.so
168 148 43 136 4 0 8 4 /system/vendor/lib/egl/libEGL_adreno.so
208 136 132 0 4 128 4 4 /system/vendor/lib/egl/libGLESv1_CM_adreno.so
1244 668 176 436 136 80 16 6 /system/vendor/lib/egl/libGLESv2_adreno.so
16 16 0 8 8 0 0 3 /system/vendor/lib/libNimsWrap.so
92 44 33 8 4 0 32 7 /system/vendor/lib/libadreno_utils.so
156 76 23 64 4 0 8 4 /system/vendor/lib/libgsl.so
24 20 8 4 8 0 8 4 /system/vendor/lib/libqc-opt.so
68 12 0 0 12 0 0 3 /system/vendor/lib/libqct_resampler.so
4332 1376 689 1164 0 16 196 5 /system/vendor/lib/libsc-a3xx.so
6760 3676 3089 0 604 0 3072 114 [anon]
4 0 0 0 0 0 0 1 [sigpage]
1012 4 4 0 0 0 4 1 [stack:8182]
1012 4 4 0 0 0 4 1 [stack:8185]
1012 4 4 0 0 0 4 1 [stack:8186]
1012 8 8 0 0 0 8 1 [stack:8187]
1012 4 4 0 0 0 4 1 [stack:8188]
1012 4 4 0 0 0 4 1 [stack:8189]
1012 4 4 0 0 0 4 1 [stack:8190]
1012 8 8 0 0 0 8 1 [stack:8191]
1012 20 20 0 0 0 20 1 [stack:8192]
1012 4 4 0 0 0 4 1 [stack:8197]
1012 4 4 0 0 0 4 1 [stack:8198]
1012 4 4 0 0 0 4 1 [stack:8226]
1012 4 4 0 0 0 4 1 [stack:8242]
1012 8 8 0 0 0 8 1 [stack:8243]
1012 4 4 0 0 0 4 1 [stack:8248]
1012 4 4 0 0 0 4 1 [stack:8270]
1012 12 12 0 0 0 12 1 [stack:8290]
1012 12 12 0 0 0 12 1 [stack:8291]
1012 4 4 0 0 0 4 1 [stack:8293]
1012 4 4 0 0 0 4 1 [stack:8294]
1012 8 8 0 0 0 8 1 [stack:8295]
1012 16 16 0 0 0 16 1 [stack:8296]
1012 8 8 0 0 0 8 1 [stack:8297]
1012 12 12 0 0 0 12 1 [stack:8298]
136 32 28 0 4 0 28 1 [stack]
4 0 0 0 0 0 0 1 [vectors]
2404 0 0 0 0 0 0 2 anon_inode:dmabuf
-------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
virtual shared shared private private
size RSS PSS clean dirty clean dirty # object
-------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
582956 69596 45942 17284 11028 3652 37632 958 TOTAL
virtual shared shared private private
size RSS PSS clean dirty clean dirty # object
-------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
884 776 426 588 0 188 0 3 /data/app/com.android.camera-2.apk
2664 1972 1972 0 0 1972 0 1 /data/dalvik-cache/data@app@com.android.camera-2.apk@classes.dex
128 56 1 0 56 0 0 1 /dev/__properties__
16384 4232 1003 0 3344 0 888 4 /dev/ashmem/dalvik-LinearAlloc (deleted)
2568 1736 919 0 840 0 896 25 /dev/ashmem/dalvik-aux-structure (deleted)
4096 0 0 0 0 0 0 1 /dev/ashmem/dalvik-bitmap-1 (deleted)
4096 312 312 0 0 0 312 1 /dev/ashmem/dalvik-bitmap-2 (deleted)
2052 264 264 0 0 0 264 1 /dev/ashmem/dalvik-card-table (deleted)
259024 25836 25836 0 0 0 25836 3 /dev/ashmem/dalvik-heap (deleted)
1500 420 420 0 0 0 420 1 /dev/ashmem/dalvik-jit-code-cache (deleted)
87384 0 0 0 0 0 0 1 /dev/ashmem/dalvik-mark-stack (deleted)
3120 3120 781 0 2440 0 680 1 /dev/ashmem/dalvik-zygote (deleted)
2040 4 4 0 0 4 0 1 /dev/binder
6628 3352 3324 0 56 0 3296 82 /dev/kgsl-3d0
12 12 1 8 4 0 0 2 /system/bin/app_process
68 56 8 48 4 0 4 3 /system/bin/linker
4 4 2 4 0 0 0 1 /system/fonts/AndroidEmoji.ttf
112 4 4 0 0 4 0 1 /system/fonts/DroidNaskhUI-Regular.ttf
16 4 4 0 0 4 0 1 /system/fonts/DroidSansArmenian.ttf
224 4 4 0 0 4 0 1 /system/fonts/DroidSansEthiopic-Regular.ttf
7560 300 195 180 0 120 0 1 /system/fonts/DroidSansFallbackBBK.ttf
24 4 4 0 0 4 0 1 /system/fonts/DroidSansGeorgian.ttf
32 0 0 0 0 0 0 1 /system/fonts/DroidSansHebrew-Bold.ttf
32 16 12 8 0 8 0 1 /system/fonts/DroidSansHebrew-Regular.ttf
1396 24 16 16 0 8 0 1 /system/fonts/NanumGothic.ttf
3252 8 4 8 0 0 0 1 /system/fonts/NotoColorEmoji.ttf
104 4 4 0 0 4 0 1 /system/fonts/NotoSansBengaliUI-Bold.ttf
108 8 8 0 0 8 0 1 /system/fonts/NotoSansBengaliUI-Regular.ttf
120 0 0 0 0 0 0 1 /system/fonts/NotoSansDevanagariUI-Bold.ttf
124 12 12 0 0 12 0 1 /system/fonts/NotoSansDevanagariUI-Regular.ttf
76 8 8 0 0 8 0 1 /system/fonts/NotoSansKannadaUI-Bold.ttf
80 8 8 0 0 8 0 1 /system/fonts/NotoSansKannadaUI-Regular.ttf
44 16 16 0 0 16 0 1 /system/fonts/NotoSansKhmerUI-Bold.ttf
44 16 16 0 0 16 0 1 /system/fonts/NotoSansKhmerUI-Regular.ttf
36 12 12 0 0 12 0 1 /system/fonts/NotoSansLaoUI-Bold.ttf
36 8 8 0 0 8 0 1 /system/fonts/NotoSansLaoUI-Regular.ttf
56 0 0 0 0 0 0 1 /system/fonts/NotoSansMalayalamUI-Bold.ttf
56 8 8 0 0 8 0 1 /system/fonts/NotoSansMalayalamUI-Regular.ttf
4 4 2 4 0 0 0 1 /system/fonts/NotoSansSymbols-Regular.ttf
40 0 0 0 0 0 0 1 /system/fonts/NotoSansTamilUI-Bold.ttf
36 12 12 0 0 12 0 1 /system/fonts/NotoSansTamilUI-Regular.ttf
112 8 8 0 0 8 0 1 /system/fonts/NotoSansTeluguUI-Bold.ttf
112 12 12 0 0 12 0 1 /system/fonts/NotoSansTeluguUI-Regular.ttf
20 0 0 0 0 0 0 1 /system/fonts/NotoSansThaiUI-Bold.ttf
24 8 8 0 0 8 0 1 /system/fonts/NotoSansThaiUI-Regular.ttf
468 28 14 28 0 0 0 1 /system/fonts/Padauk-book.ttf
432 28 28 0 0 28 0 1 /system/fonts/Padauk-bookbold.ttf
80 24 12 16 0 8 0 1 /system/fonts/Roboto-Bold.ttf
80 12 8 4 0 8 0 1 /system/fonts/Roboto-Regular.ttf
4 0 0 0 0 0 0 1 /system/framework/WfdCommon.jar
76 8 0 8 0 0 0 1 /system/framework/WfdCommon.odex
4 0 0 0 0 0 0 1 /system/framework/android.policy.jar
340 172 45 172 0 0 0 1 /system/framework/android.policy.odex
8 0 0 0 0 0 0 1 /system/framework/apache-xml.jar
1348 32 3 32 0 0 0 1 /system/framework/apache-xml.odex
4 0 0 0 0 0 0 1 /system/framework/bouncycastle.jar
1092 104 22 92 0 12 0 1 /system/framework/bouncycastle.odex
4 0 0 0 0 0 0 1 /system/framework/conscrypt.jar
368 44 3 44 0 0 0 1 /system/framework/conscrypt.odex
4 0 0 0 0 0 0 1 /system/framework/core-junit.jar
28 8 0 8 0 0 0 1 /system/framework/core-junit.odex
4 0 0 0 0 0 0 1 /system/framework/core.jar
3168 1444 263 1376 0 68 0 1 /system/framework/core.odex
76 0 0 0 0 0 0 1 /system/framework/ext.jar
1480 172 17 172 0 0 0 1 /system/framework/ext.odex
1480 460 146 412 0 48 0 2 /system/framework/framework-res.apk
4 0 0 0 0 0 0 1 /system/framework/framework.jar
9856 5004 1094 4184 456 312 52 191 /system/framework/framework.odex
4 0 0 0 0 0 0 1 /system/framework/framework2.jar
2060 884 186 856 0 28 0 1 /system/framework/framework2.odex
4 0 0 0 0 0 0 1 /system/framework/mms-common.jar
132 8 0 8 0 0 0 1 /system/framework/mms-common.odex
4 0 0 0 0 0 0 1 /system/framework/oem-services.jar
4 4 0 4 0 0 0 1 /system/framework/oem-services.odex
8 0 0 0 0 0 0 1 /system/framework/okhttp.jar
212 12 0 12 0 0 0 1 /system/framework/okhttp.odex
4 0 0 0 0 0 0 1 /system/framework/org.codeaurora.Performance.jar
8 8 0 8 0 0 0 1 /system/framework/org.codeaurora.Performance.odex
4 0 0 0 0 0 0 1 /system/framework/qcmediaplayer.jar
24 8 0 8 0 0 0 1 /system/framework/qcmediaplayer.odex
4 0 0 0 0 0 0 1 /system/framework/qcom.fmradio.jar
64 16 5 12 0 4 0 1 /system/framework/qcom.fmradio.odex
4 0 0 0 0 0 0 1 /system/framework/services.jar
3800 80 11 80 0 0 0 1 /system/framework/services.odex
4 0 0 0 0 0 0 1 /system/framework/telephony-common.jar
1540 20 1 20 0 0 0 1 /system/framework/telephony-common.odex
8 0 0 0 0 0 0 1 /system/framework/telephony-msim.jar
180 12 0 12 0 0 0 1 /system/framework/telephony-msim.odex
4 0 0 0 0 0 0 1 /system/framework/vcard.jar
164 8 0 8 0 0 0 1 /system/framework/vcard.odex
4 0 0 0 0 0 0 1 /system/framework/vivo-framework.jar
2356 52 6 52 0 0 0 1 /system/framework/vivo-framework.odex
4 0 0 0 0 0 0 1 /system/framework/vivo-media.jar
264 128 57 128 0 0 0 1 /system/framework/vivo-media.odex
1960 172 34 168 0 4 0 2 /system/framework/vivo-res.apk
4 0 0 0 0 0 0 1 /system/framework/voip-common.jar
168 12 1 12 0 0 0 1 /system/framework/voip-common.odex
4 0 0 0 0 0 0 1 /system/framework/webviewchromium.jar
764 100 22 88 0 12 0 1 /system/framework/webviewchromium.odex
20 20 9 12 0 0 8 3 /system/lib/hw/gralloc.msm8916.so
284 280 148 0 136 0 144 4 /system/lib/hw/memtrack.msm8916.so
340 80 21 36 28 0 16 4 /system/lib/libEGL.so
16 8 0 0 8 0 0 3 /system/lib/libETC1.so
316 8 0 0 8 0 0 4 /system/lib/libGLES_trace.so
28 28 7 16 8 4 0 3 /system/lib/libGLESv1_CM.so
32 20 2 12 8 0 0 3 /system/lib/libGLESv2.so
8324 220 6 0 220 0 0 5 /system/lib/libLLVM.so
208 8 0 0 8 0 0 3 /system/lib/libRS.so
80 8 0 0 8 0 0 4 /system/lib/libRScpp.so
64 12 0 0 12 0 0 3 /system/lib/libandroid.so
732 344 85 244 44 48 8 4 /system/lib/libandroid_runtime.so
156 84 12 72 4 0 8 4 /system/lib/libandroidfw.so
236 28 0 0 28 0 0 4 /system/lib/libaudioflinger.so
20 8 0 0 8 0 0 4 /system/lib/libaudioparameter.so
16 8 0 0 8 0 0 3 /system/lib/libaudioutils.so
268 8 0 0 8 0 0 5 /system/lib/libbcc.so
216 12 4 0 8 0 4 4 /system/lib/libbcinfo.so
180 148 18 120 24 0 4 4 /system/lib/libbinder.so
364 232 33 188 20 0 24 4 /system/lib/libc.so
216 72 13 32 36 0 4 3 /system/lib/libcamera_client.so
32 12 4 0 8 0 4 4 /system/lib/libcamera_metadata.so
68 20 0 0 20 0 0 5 /system/lib/libcommon_time_client.so
12 8 0 0 8 0 0 3 /system/lib/libconnectivitymanager.so
20 8 0 0 8 0 0 3 /system/lib/libcorkscrew.so
944 76 1 0 76 0 0 5 /system/lib/libcrypto.so
44 44 5 36 4 0 4 3 /system/lib/libcutils.so
96 16 0 0 16 0 0 3 /system/lib/libdrmframework.so
32 8 0 0 8 0 0 3 /system/lib/libdrmframework_jni.so
816 588 72 504 40 32 12 4 /system/lib/libdvm.so
16 8 0 0 8 0 0 3 /system/lib/libeffects.so
176 52 1 0 52 0 0 3 /system/lib/libexif.so
92 12 0 0 12 0 0 4 /system/lib/libexpat.so
328 164 49 152 12 0 0 3 /system/lib/libft2.so
24 12 1 4 8 0 0 3 /system/lib/libgabi++.so
28 8 0 0 8 0 0 4 /system/lib/libgccdemangle.so
256 116 17 76 36 0 4 4 /system/lib/libgui.so
12 12 0 4 8 0 0 3 /system/lib/libhardware.so
32 8 0 0 8 0 0 4 /system/lib/libhardware_legacy.so
296 172 39 160 8 4 0 3 /system/lib/libharfbuzz_ng.so
220 164 34 148 8 4 4 4 /system/lib/libhwui.so
1252 236 65 192 28 12 4 4 /system/lib/libicui18n.so
1020 424 104 340 40 40 4 4 /system/lib/libicuuc.so
92 56 6 44 12 0 0 3 /system/lib/libinput.so
260 248 236 24 0 0 224 5 /system/lib/libiomx_vivo.so
28 8 0 0 8 0 0 3 /system/lib/libiss_svc.so
208 112 14 96 8 4 4 4 /system/lib/libjavacore.so
80 8 0 0 8 0 0 3 /system/lib/libjavacrypto.so
48 8 0 0 8 0 0 5 /system/lib/libjhead.so
16 8 0 0 8 0 0 3 /system/lib/libjhead_jni.so
12 8 0 0 8 0 0 3 /system/lib/libjnigraphics.so
220 116 41 100 8 8 0 4 /system/lib/libjpeg.so
20 20 0 12 8 0 0 3 /system/lib/liblog.so
104 72 7 64 8 0 0 3 /system/lib/libm.so
568 332 203 64 88 176 4 3 /system/lib/libmedia.so
220 32 11 12 12 8 0 4 /system/lib/libmedia_jni.so
20 20 9 12 0 0 8 3 /system/lib/libmemalloc.so
12 8 0 0 8 0 0 3 /system/lib/libmemtrack.so
80 8 0 0 8 0 0 4 /system/lib/libmtp.so
24 24 9 12 4 4 4 3 /system/lib/libnativehelper.so
32 8 0 0 8 0 0 3 /system/lib/libnbaio.so
28 8 0 0 8 0 0 3 /system/lib/libnetutils.so
128 72 9 64 8 0 0 3 /system/lib/libpng.so
20 8 0 0 8 0 0 3 /system/lib/libpowermanager.so
20 8 0 0 8 0 0 3 /system/lib/libqcomfm_jni.so
32 28 12 20 0 0 8 3 /system/lib/libqdutils.so
160 156 135 28 0 0 128 5 /system/lib/libqservice.so
164 136 23 0 116 0 20 5 /system/lib/librs_jni.so
52 36 6 28 4 0 4 4 /system/lib/libselinux.so
1948 444 90 336 72 20 16 4 /system/lib/libskia.so
344 12 4 0 8 0 4 5 /system/lib/libsonivox.so
16 16 10 8 0 0 8 3 /system/lib/libsoundpool.so
24 8 0 0 8 0 0 3 /system/lib/libspeexresampler.so
328 12 0 4 8 0 0 4 /system/lib/libsqlite.so
248 20 0 0 20 0 0 4 /system/lib/libssl.so
1084 308 93 276 32 0 0 3 /system/lib/libstagefright.so
148 100 53 0 48 0 52 4 /system/lib/libstagefright_amrnb_common.so
28 8 0 0 8 0 0 3 /system/lib/libstagefright_avc_common.so
12 8 0 0 8 0 0 3 /system/lib/libstagefright_enc_common.so
72 8 0 0 8 0 0 3 /system/lib/libstagefright_foundation.so
116 16 0 0 16 0 0 4 /system/lib/libstagefright_omx.so
16 8 0 0 8 0 0 3 /system/lib/libstagefright_yuv.so
12 12 0 4 8 0 0 3 /system/lib/libstdc++.so
212 116 27 104 8 0 4 3 /system/lib/libstlport.so
12 12 0 4 8 0 0 3 /system/lib/libsync.so
44 44 10 36 4 0 4 3 /system/lib/libui.so
16 8 0 0 8 0 0 3 /system/lib/libusbhost.so
88 84 11 76 4 0 4 4 /system/lib/libutils.so
532 8 0 0 8 0 0 3 /system/lib/libval_2.0.so
12 8 0 0 8 0 0 3 /system/lib/libval_common.so
224 8 0 0 8 0 0 4 /system/lib/libvideoeditor_core.so
92 12 0 0 12 0 0 4 /system/lib/libvideoeditor_jni.so
24 8 0 0 8 0 0 3 /system/lib/libvideoeditor_osal.so
20 8 0 0 8 0 0 3 /system/lib/libvideoeditor_videofilters.so
228 112 30 0 84 0 28 5 /system/lib/libvideoeditorplayer.so
16680 2948 1654 2588 0 0 360 4 /system/lib/libvlcjni_vivo.so
112 16 8 0 8 0 8 4 /system/lib/libvorbisidec.so
20796 1088 36 0 1088 0 0 4 /system/lib/libwebviewchromium.so
316 308 222 0 88 0 220 4 /system/lib/libwebviewchromium_plat_support.so
20 8 0 0 8 0 0 4 /system/lib/libwpa_client.so
100 80 13 72 8 0 0 4 /system/lib/libz.so
37176 176 103 100 0 76 0 2 /system/usr/icu/icudt51l.dat
548 4 0 4 0 0 0 1 /system/usr/share/zoneinfo/tzdata
116 112 82 36 0 0 76 4 /system/vendor/lib/egl/eglsubAndroid.so
168 148 43 136 4 0 8 4 /system/vendor/lib/egl/libEGL_adreno.so
208 136 132 0 4 128 4 4 /system/vendor/lib/egl/libGLESv1_CM_adreno.so
1244 668 176 436 136 80 16 6 /system/vendor/lib/egl/libGLESv2_adreno.so
16 16 0 8 8 0 0 3 /system/vendor/lib/libNimsWrap.so
92 44 33 8 4 0 32 7 /system/vendor/lib/libadreno_utils.so
156 76 23 64 4 0 8 4 /system/vendor/lib/libgsl.so
24 20 8 4 8 0 8 4 /system/vendor/lib/libqc-opt.so
68 12 0 0 12 0 0 3 /system/vendor/lib/libqct_resampler.so
4332 1376 689 1164 0 16 196 5 /system/vendor/lib/libsc-a3xx.so
6760 3676 3089 0 604 0 3072 114 [anon]
4 0 0 0 0 0 0 1 [sigpage]
1012 4 4 0 0 0 4 1 [stack:8182]
1012 4 4 0 0 0 4 1 [stack:8185]
1012 4 4 0 0 0 4 1 [stack:8186]
1012 8 8 0 0 0 8 1 [stack:8187]
1012 4 4 0 0 0 4 1 [stack:8188]
1012 4 4 0 0 0 4 1 [stack:8189]
1012 4 4 0 0 0 4 1 [stack:8190]
1012 8 8 0 0 0 8 1 [stack:8191]
1012 20 20 0 0 0 20 1 [stack:8192]
1012 4 4 0 0 0 4 1 [stack:8197]
1012 4 4 0 0 0 4 1 [stack:8198]
1012 4 4 0 0 0 4 1 [stack:8226]
1012 4 4 0 0 0 4 1 [stack:8242]
1012 8 8 0 0 0 8 1 [stack:8243]
1012 4 4 0 0 0 4 1 [stack:8248]
1012 4 4 0 0 0 4 1 [stack:8270]
1012 12 12 0 0 0 12 1 [stack:8290]
1012 12 12 0 0 0 12 1 [stack:8291]
1012 4 4 0 0 0 4 1 [stack:8293]
1012 4 4 0 0 0 4 1 [stack:8294]
1012 8 8 0 0 0 8 1 [stack:8295]
1012 16 16 0 0 0 16 1 [stack:8296]
1012 8 8 0 0 0 8 1 [stack:8297]
1012 12 12 0 0 0 12 1 [stack:8298]
136 32 28 0 4 0 28 1 [stack]
4 0 0 0 0 0 0 1 [vectors]
2404 0 0 0 0 0 0 2 anon_inode:dmabuf
-------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
virtual shared shared private private
size RSS PSS clean dirty clean dirty # object
-------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
582956 69596 45942 17284 11028 3652 37632 958 TOTAL
2.4 查看该进程内存实时变化情况
C:UsersAdministrator>perl.exe D:内存管理内存管理pidmem.pl -i 1 8179
rss(8179) sharedDirty privateDirty | total_used total_free
74160K 11292K 41932K | 621308K 306668K
74140K 11288K 41916K | 592036K 335940K
79092K 11288K 46868K | 589612K 338364K
78224K 11288K 46000K | 606724K 321252K
79652K 11288K 47428K | 612064K 315912K
74160K 11292K 41932K | 621308K 306668K
74140K 11288K 41916K | 592036K 335940K
79092K 11288K 46868K | 589612K 338364K
78224K 11288K 46000K | 606724K 321252K
79652K 11288K 47428K | 612064K 315912K
2.5 用例跑过一段时间后,看一下内存增长情况,
在2.4步骤中会有反馈。并重复步骤2.2与 2.3 查看测试结束后
该进程中各部分内存占用情况是否有变化。
2.6 如果内存出现大幅增长,需要抓取 hprof 文件来分析
C:UsersAdministrator>adb shell am dumpheap 8179 /storage/sdcard0/08152110.hprof
C:UsersAdministrator>adb pull /storage/sdcard0/08152110.hprof D:/tools
2832 KB/s (32496307 bytes in 11.202s)
2832 KB/s (32496307 bytes in 11.202s)
2.7 分析后发现整个内存增长幅度很大
而实际上 VM 这边能解析到的内存泄漏却很少:
此时,我们就很怀疑是 native 层出现了内存泄漏了。
对比 showmap 结果,看出在[anon] 部分有大幅增长。而
【anon】 是匿名使用的内存,一般为显示占用的
Line 258: 6760 3676 3089 0 604 0 3072 114 [anon]
Line 1318: 21756 18716 18157 0 576 0 18140 163 [anon]
Line 1318: 21756 18716 18157 0 576 0 18140 163 [anon]
3 匿名内存增长很厉害,增长15M左右,匿名内存出现了泄漏。
最后
以上就是甜美红酒为你收集整理的android 内存泄漏分析过程详解1 运行自动化测试工具; 2 在运行之初观察内存分配情况; 3 匿名内存增长很厉害,增长15M左右,匿名内存出现了泄漏。的全部内容,希望文章能够帮你解决android 内存泄漏分析过程详解1 运行自动化测试工具; 2 在运行之初观察内存分配情况; 3 匿名内存增长很厉害,增长15M左右,匿名内存出现了泄漏。所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复