HaarigerHarald / android-youtubeExtractor

Deprecated: Android based YouTube URL extractor and downloader
Other
878 stars 304 forks source link

Static Field Leak Bug #63

Open ExploiTR opened 6 years ago

ExploiTR commented 6 years ago

The YouTubeExtractor class extends Asynctask but isn't static. I'm unaware of what may happen for that. But, Android Studio says :

This AsyncTask class should be static or leaks might occur (anonymous at.huber.youtubeExtractor.YouTubeExtractor) less... (Ctrl+F1) A static field will leak contexts. Non-static inner classes have an implicit reference to their outer class. If that outer class is for example a Fragment or Activity, then this reference means that the long-running handler/loader/task will hold a reference to the activity which prevents it from getting garbage collected. Similarly, direct field references to activities and fragments from these longer running instances can cause leaks. ViewModel classes should never point to Views or non-application Contexts.

Any Workaround?

jishantmed commented 5 years ago

Anything on this as it causes memory leaks I guess.

ExploiTR commented 5 years ago

@HaarigerHarald