相关疑难解决方法(0)

Android:常量内存消耗/ dumpGfxInfo()

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

Android Studio在Allocation Tracker中的构建显示至少有三个线程做同样的事情:

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

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

 --- 8< -------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

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

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

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)
Run Code Online (Sandbox Code Playgroud)

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

java memory android android-studio

26
推荐指数
2
解决办法
5695
查看次数

标签 统计

android ×1

android-studio ×1

java ×1

memory ×1