toposuite-android icon indicating copy to clipboard operation
toposuite-android copied to clipboard

Activity memory leak caused by anonymous threads

Open cuixiaoyiyi opened this issue 1 year ago • 1 comments

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.

We have detected that your implementation has a lot of reading and writing data in anonymous threads of the Activity, and these threads will hold the Activity and prevent its timely release.

ch.hgdev.toposuite.points.PointsImporterDialog ch.hgdev.toposuite.jobs.JobsActivity ch.hgdev.toposuite.points.PointsImporterActivity ch.hgdev.toposuite.jobs.JobImporterActivity

Some of the anonymous threads can be replaced by static class to eliminate unnecessary references. And some can be replaced by the Handler class.

If you agree, a PR will be submitted.

cuixiaoyiyi avatar Aug 29 '22 08:08 cuixiaoyiyi