Via :http://stackoverflow.com/questions/4976566/what-do-gc-for-malloc-gc-explicit-and-other-gc-mean-in-android-logcat

Another place where the Dalvik garbage collector messages are explained is in this video:Google I/O 2011: Memory management for Android Apps

At about 14 minutes into the presentation, he breaks down the message format. (BTW, that video has really good info on debugging memory leaks)

Roughly speaking, the format is[Reason] [Amount Freed], [Heap Statistics], [External Memory Statistics], [Pause Time]

Reason

Robert/yuku already gave info on the meaning of these.

Amount Freed

E.g.freed 2125K

Self explanatory

Heap Statistics

E.g.47% free 6214K/11719K

These numbers reflect conditions after the GC ran. The "47% free" and 6214K reflect the current heap usage. The 11719K represents the total heap size. From what I can tell, the heap can grow/shrink, so you will not necessarily have an OutOfMemoryError if you hit this limit.

External Memory Statistics

E.gexternal 7142K/8400K

Note: This might only exist in pre-Honeycomb versions of Android (pre 3.0).

Before Honeycomb, bitmaps are allocated external to your VM (e.g. Bitmap.createBitmap() allocates the bitmap externally and only allocates a few dozen bytes on your local heap). Other examples of external allocations are for java.nio.ByteBuffers.

Pause Time

If it's a concurrent GC event, there will be two times listed. One is for a pause before the GC, one is for a pause when the GC is mostly done. E.g.paused 3ms+5ms

For non-concurrent GC events, there is only one pause time and it's typically much bigger. E.g.paused 87ms

GC_FOR_MALLOCmeans that the GC was triggered because there wasn't enough memory left on the heap to perform an allocation. Might be triggered when new objects are being created.

GC_EXPLICITmeans that the garbage collector has been explicitly asked to collect, instead of being triggered by high water marks in the heap. Happens all over the place, but most likely when a thread is being killed or when a binder communication is taken down.

There are a few others as well:

GC_CONCURRENTTriggered when the heap has reached a certain amount of objects to collect.

GC_EXTERNAL_ALLOCmeans that the the VM is trying to reduce the amount of memory used for collectable objects, to make room for more non-collectable.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android仿微信小视频录制功能
  2. 关于Android今后的发展的个人见解
  3. 22、从头学Android之Android的数据存储--
  4. Android(安卓)序列化之parcelable的简单
  5. android使用aidl实现进程间通信
  6. 使用c#开发的第一款APP的Android浏览器(创
  7. Android热补丁动态修复技术(完结篇):自动
  8. EPSON Printer 打印机 Sdk For Android
  9. 一篇看懂Android与Flutter之间的通信
  10. 史上最全面解析Android事件分发机制