DEV Community

Discussion on: Beware PackageManager leaks!

Collapse
 
samlu profile image
Sam Lu

I found the ActivityManager has the same issue when we get the ActivityManager instance via an Activity context and keep it with a static variable.

No leakage if we get the ActivityManager instance via the Application context. I.e.
ctx.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE)