Skip to content

Activity memory leak caused by anonymous threads #93

@cuixiaoyiyi

Description

@cuixiaoyiyi

Possible Memory Leak

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. Please check the links below.

Occurrences

https://github.com/0xpr03/VocableTrainer-Android/blob/master/app/src/main/java/vocabletrainer/heinecke/aron/vocabletrainer/activity/MainActivity.java#L89

Possible Solution

If it is necessary, it can be changed to static class + weak reference to eliminate the reference to the activity, which may cause memory leaks.
Further discussion is welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions