Closed code-schreiber closed 6 years ago
It seems when passing context to ConvenienceBuilder.createAppTitleItem() the activity instance is leaked.
@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(); }
Now, from what I understand about it is this a known leak and affects JELLY_BEANup to MARSHMALLOW.
JELLY_BEAN
MARSHMALLOW
The way to easily avoid it in ConvenienceBuilder would be to pass the application context and not the activity directly.
Merged! Thank you.
You are very welcome 😀
It seems when passing context to ConvenienceBuilder.createAppTitleItem() the activity instance is leaked.
Code to reproduce
Leakcanary says
Now, from what I understand about it is this a known leak and affects
JELLY_BEAN
up toMARSHMALLOW
.The way to easily avoid it in ConvenienceBuilder would be to pass the application context and not the activity directly.