Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity memory leak caused by anonymous threads #93

Open
cuixiaoyiyi opened this issue Aug 31, 2022 · 1 comment
Open

Activity memory leak caused by anonymous threads #93

cuixiaoyiyi opened this issue Aug 31, 2022 · 1 comment
Labels

Comments

@cuixiaoyiyi
Copy link

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.

@0xpr03
Copy link
Owner

0xpr03 commented Aug 31, 2022

Thanks, didn't know about that

@0xpr03 0xpr03 added the bug label Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants