What do the Android Studio HPROF reference tree element colours represent?

前端 未结 2 1330
[愿得一人]
[愿得一人] 2021-02-05 09:13

Can someone tell me what does bold, blue one and red one positions in HPROF Viewer in Android Studio means exactly ?

I ask about one in Reference Tree panel.

2条回答
  •  借酒劲吻你
    2021-02-05 09:56

    • this$0 (the red one) - is the variable which holds the reference to LeakActivity. In your case this is an implicit reference to the enclosing class. This is a nature of anonymous inner classes in Java - they implicitly hold a reference to the outer (enclosing) class.

    • blue class name - is just a location of this$0 variable.

    So essentially what you are seeing - is LeakActivity is implicitly referenced from LeakAsyncTask which is implemented as anonymous inner class within LeakActivity, so LeakActivity cannot be garbage collected until LeakAsyncTask is finished. So you have a potential Activity leak which is really dangerous for your app

提交回复
热议问题