Andriod注册广播而未销毁引起的内存泄露

问题还原

Activity com.shangche.tachograph.activity.MainActivity 
has leaked IntentReceiver com.shangche.tachograph.utils.
aputil.WiFiConnectionReciever@1e68ecbd that was originally 
registered here. Are you missing a call to 
unregisterReceiver()?                                                
Paste_Image.png

原因是我们注册了广播而没有取消注册,导致内存泄露,解决办法是在onDestroy取消注册。

unregisterReceiver(rcv);

推荐使用内存泄露检测工具:http://blog.csdn.net/e_inch_photo/article/details/58594274

本文博客地址:
http://blog.csdn.net/e_Inch_Photo/article/details/60466051

作者博客:http://blog.csdn.net/e_inch_photo
如果喜欢就分享吧!

你可能感兴趣的:(Andriod注册广播而未销毁引起的内存泄露)