apcro / leafpicrevived

LeafPic Revived - an updated version of LeafPic, a full-featured gallery app for Android.
GNU General Public License v3.0
122 stars 20 forks source link

Activity memory leak caused by anonymous threads #60

Open cuixiaoyiyi opened 2 years ago

cuixiaoyiyi commented 2 years ago

An anonymous inner class will hold a reference to the this pointer of the outer class and will not be released until the thread ends.

It will hold the Activity and prevent its timely release.

com.alienpants.leafpicrevived.activities.MainActivity

The anonymous thread can be replaced by static class to eliminate unnecessary references.

If you agree, a PR will be submitted.