Deciphering Android Garbage collection (GC) logs

http://infinitesproutingthoughts.wordpress.com/2013/06/21/deciphering-android-garbage-collection-gc-logs/

More often  android adb log dumps below text for GC:


19:30:22.188 26517 26519 D dalvikvm: GC_CONCURRENT freed 82K, 7% free 7524K/8035K, paused 12ms+25ms, total 82ms

GC_CONCURRENT =  all the dalvik VM ‘s thread are being garbage collected.

Freed = 82K,  this cycle of Garbage collection freed 82KilloBytes .

7% free = Free % of  total Java heap(not including native).

7524K/8035K = allocated / total heap.

That is as per  above log: with this GC cycle android VM, freed 82K memory and now total memory foot-print of Java heap is 8035K, out of that 7524K is allocated and rest (7%) is free.

Tip: To find the Java Heap usage for a particular java process(app/service/content provider).i.e(any process forked from Zygote) use below command:

# adb shell ps | grep -i  ”andriod_process_name”

# adb logcat | grep “above_returned_process_id” | grep  ”GC_”

Ex: #adb shell ps | grep -i “com.android.chrome”   (say PID = 2345)

#adb shell ps | grep  2345 | grep  ”GC-”

This should display above explained GC logs, whenever there is GC allocation (GC_cocurrent, GC_alloc, ..etc).

This would be handy and efficient then using “adb shell dumpysys meminfo PID”, as the dumpsys runs in process itself, hence making it bit slow.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值