Finally understanding how references work in Android and Java
Enrique López Mañas

What happens when the Activity is destroyed? The AsyncTask is holding a reference to the Activity, and the Activity cannot be collected by the GC. This is what we called a memory leak.

I think it is important to mention here that the “leak” only occurs if the AsyncTask has not completed.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.