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

Memory Leak when using ConvenienceBuilder.createAppTitleItem() #74

Closed
code-schreiber opened this issue Feb 13, 2018 · 2 comments
Closed

Comments

@code-schreiber
Copy link
Contributor

It seems when passing context to ConvenienceBuilder.createAppTitleItem() the activity instance is leaked.

Code to reproduce
    @NonNull
    @Override
    protected MaterialAboutList getMaterialAboutList(@NonNull Context context) {
        MaterialAboutCard card = new MaterialAboutCard.Builder()
                .addItem(ConvenienceBuilder.createAppTitleItem(context)) // This leaks the activity
                .build();
        
        return new MaterialAboutList.Builder()
                .addCard(card)
                .build();
    }
Leakcanary says

screenshot_1518513424

Now, from what I understand about it is this a known leak and affects JELLY_BEANup to MARSHMALLOW.

The way to easily avoid it in ConvenienceBuilder would be to pass the application context and not the activity directly.

@daniel-stoneuk
Copy link
Owner

Merged! Thank you.

@code-schreiber
Copy link
Contributor Author

You are very welcome 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants