如何解决此内存泄漏?

问题描述 投票:0回答:1

enter image description here

我如何解决此内存泄漏,我正在使用此代码与处理程序一起使用。

public static Handler handlerKillInfoBar = new MyHandler();
if (handlerKillInfoBar != null) {
        handlerKillInfoBar.removeCallbacksAndMessages(null);
    }
handlerKillInfoBar.postDelayed(() -> {
         // doing some work here. when user navigate between activites then memory leaks happend and show attached information.    

        }, 5000);
android performance memory-leaks leakcanary
1个回答
0
投票

看起来BaseActivity类具有一个timerHearBeatApiCall静态字段,它是LambdaObserver,VodActivity对其进行预订。 VodActivity应在收到其onDestroy()回调时退订。

此外,您应该升级到LeakCanary 2.x

© www.soinside.com 2019 - 2024. All rights reserved.