ahampe / KDVS

Android app for streaming 90.3 FM in Davis, CA, live from anywhere
1 stars 0 forks source link

Find and resolve memory leaks #31

Open ahampe opened 5 years ago

ahampe commented 5 years ago

Memory leaks are super common in Android. Luckily, there's a nice library that can automatically detect them: https://square.github.io/leakcanary/getting_started/

There are a few places I've seen where we hold onto fragment references in other classes, for example. That's almost certainly leaking memory. There's usually a way to engineer it so you don't need to wrap these things in a WeakReference, but that can be used as a last resort if we absolutely need a reference to an object with an Android lifecycle.