Android:恒定内存消耗/dumpGfxInfo() [英] Android: Constant memory consumption / dumpGfxInfo()

查看:47
本文介绍了Android:恒定内存消耗/dumpGfxInfo()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定:一个使用 Android Studio 向导创建的简单 Activity,内部没有任何自定义代码,调用 dumpGfxInfo() 会永久消耗内存.

Given: A simple Activity created with the Android Studio Wizard, without any custom code inside, consumes perpetually memory calling dumpGfxInfo().

Android Studio 在 Allocation Tracker 中的构建显示至少 三个 线程执行相同操作:

The Android Studio's build in Allocation Tracker reveals at least three threads doing the same:

 --- 8< ------------------------------------------------------------------

 * < Thread 12 > 
   * execTransact():446, Binder (andoroid.os)   
     * onTransact():545, ApplicationThreadNative (android.app)
       * dumpGfxInfo():1107, ActivityThread$ApplicationThread (android.app)

 --- 8< -------------------------------------------------------------------

显然 dumpGfxInfo() 通过为空字符串分配内存来消耗内存.编译的唯一相关依赖项是 com.android.support:appcompat-v7:22.2.1

Apparently dumpGfxInfo() consumes memory by allocating memory for empty strings. The only relevant dependency compiled in, is com.android.support:appcompat-v7:22.2.1

伴随着这种内存消耗,出现以下异常(有时):

Along with this memory consumption, following exception (sometimes) arises:

15331-15364/ W/Binder﹕ Caught a RuntimeException from the binder stub implementation.
    java.lang.NullPointerException: Attempt to read from field 'android.view.HardwareRenderer android.view.View$AttachInfo.mHardwareRenderer' on a null object reference
            at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:466)
            at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1107)
            at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:548)
            at android.os.Binder.execTransact(Binder.java:446)

问题:如何修复/关闭此行为并摆脱它?

Question: How to fix/turn off this behaviour and get rid of it?

推荐答案

似乎是最新的 Android Studio 错误.旧版本没有这个问题.参见 这个链接

Seems like it's latest Android Studio bug. Older versions don't have this issue. See this link

这篇关于Android:恒定内存消耗/dumpGfxInfo()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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