But the adb shell dumpsys activity see have no this acitivity
Online some, because the activity using an anonymous inner class handler class object holds the activity quoted lead to memory overflow, the activity is not recycled
But I get rid of the handler and the network Thread in management class weakref a this activity to observe or has not been destroyed
CodePudding user response:
Depends on your specific implementation, the estimate is leaked, the activity did not release, thread didn't stopCodePudding user response:
What did you do in the handler time-consuming operation, can cause a memory leak, you use a WeakReference also won't immediately recycling, wait until the next gc scan to this reference will be recycled,CodePudding user response:
In onDestory mHandler. RemoveCallbacksAndMessages (null); !CodePudding user response:
You must ensure that thread destroyed, the handler to remove or judgment of thread USES a while loop condition is set to falseCodePudding user response:
MHandler. RemoveCallbacksAndMessages (null); This sentence must call, or a memory leakCodePudding user response:
OnDestroy inside to determine threads and handler has been destroyed