android查看程序运行内存

比如看图库程序:

adb shell top | grep com.android.gallery3d

结果如下:

16916  0   0% S    14 322884K  46520K  fg u0_a19   com.android.gallery3d
16916  0  10% S    14 325884K  46528K  fg u0_a19   com.android.gallery3d
16916  0  20% R    14 325936K  46592K  fg u0_a19   com.android.gallery3d
16916  1  30% R    15 329024K  58564K  fg u0_a19   com.android.gallery3d
16916  0  32% S    14 327984K  61264K  fg u0_a19   com.android.gallery3d
16916  0   4% S    14 327928K  61064K  fg u0_a19   com.android.gallery3d
16916  0   0% S    14 327928K  61064K  fg u0_a19   com.android.gallery3d

每隔3s左右刷新一次,中间两个xxK就是内存占用,第一个是VSS - Virtual Set Size 虚拟耗用内存(包含共享库占用的内存)
第二个是RSS - Resident Set Size 实际使用物理内存(包含共享库占用的内存)

原文地址:https://www.cnblogs.com/jayceli/p/2750937.html