Android的日志“GC_EXTERNAL_ALLOC'GC_FOR_MALLOC” [英] Android logs 'GC_EXTERNAL_ALLOC' 'GC_FOR_MALLOC'

查看:106
本文介绍了Android的日志“GC_EXTERNAL_ALLOC'GC_FOR_MALLOC”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行我的应用程序,我有这样的日志:

While running my apps, I have got this kind of logs:

GC_EXTERNAL_ALLOC释放2K,免费38%8772K / 14087K,外部17480K / 17998K,暂停87ms
  GC_FOR_MALLOC释放0K,免费38%8772K / 14087K,外部17480K / 17998K,暂停67ms
  GC_CONCURRENT释放2125K,47%免费6214K / 11719K,外部7142K / 8400K,暂停3毫秒+ 5ms的

GC_EXTERNAL_ALLOC freed 2K, 38% free 8772K/14087K, external 17480K/17998K, paused 87ms
GC_FOR_MALLOC freed 0K, 38% free 8772K/14087K, external 17480K/17998K, paused 67ms
GC_CONCURRENT freed 2125K, 47% free 6214K/11719K, external 7142K/8400K, paused 3ms+5ms

有谁知道这些日志是什么意思?在此先感谢!

Does anyone know what these logs mean? Thanks in advance!

  1. 'GC_EXTERNAL_ALLOC','GC_FOR_MALLOC'和'GC_CONCURRENT'之间的区别是什么。是否有一些其他的GC事件?
  2. 什么是'38%免费8772K / 14087K'是什么意思?什么是8772K,什么是14087K?
  3. 什么是外部17480K / 17998K'是什么意思?什么是17480K',什么是'17998K'?

谢谢!

推荐答案

另外一个地方,Dalvik的垃圾收集器的消息说明的是在这个视频:的谷歌I / O 2011:内存管理Android应用

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

在大约14分钟到presentation,他打破了消息格式。 (顺便说一句,这视频有真正良好的信息对调试内存泄漏)

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

粗略地说,该格式是 [原因] [金额弗里德],[堆统计],[外部存储器统计],[暂停时间]

维克托/罗伯特已经说明 GC_CONCURRENT GC_FOR_MALLOC GC_EXTERNAL_ALLOC

Viktor/Robert already explained GC_CONCURRENT, GC_FOR_MALLOC, GC_EXTERNAL_ALLOC.

还有:

  • GC_HPROF_DUMP_HEAP - 如果通过单击DDMS或编程转储堆按钮转储堆

  • GC_HPROF_DUMP_HEAP - If you dump heap by clicking the "dump heap" button from DDMS or programatically

GC_EXPLICIT - 如果你调用System.gc()

GC_EXPLICIT - If you call System.gc()

例如。 释放2125K

自我解释

例如。 47%免费6214K / 11719K

这些数字反映情况的GC跑后。而47%自由和6214K反映当前堆的使用情况。该11719K重新presents总堆大小。从我可以告诉,堆可以增长/收缩,这样你就不一定有一个OutOfMemoryError,如果你遇到这个限制。

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.

例如外部7142K / 8400K

请注意:这可能只是在pre-蜂窝版本的Andr​​oid(pre 3.0)存在

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

蜂窝前,位图被分配外部到您的虚拟机(如Bitmap.createBitmap()外部分配位图,并且只在您的本地堆中分配几十个字节)。外部分配的其它实例是用于java.nio.ByteBuffers

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.

如果这是一个并发GC事件,将有列出两次。一个是在GC之前的暂停,1为暂停当GC大多完成。 例如。 暂停3毫秒+ 5ms的

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

有关非并发GC事件,只有一个暂停时间,它是典型地大得多。 例如。 暂停87ms

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

这篇关于Android的日志“GC_EXTERNAL_ALLOC'GC_FOR_MALLOC”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆