AnyMemo icon indicating copy to clipboard operation
AnyMemo copied to clipboard

org.liberty.android.fantastischmemo.ui.CardFragment may leak

Open mjblackhorse opened this issue 8 years ago • 5 comments

Many instances of org.liberty.android.fantastischmemo.ui.CardFragment may leak as they are referenced by the static field "dummyAnimation " declared in "org.liberty.android.fantastischmemo.ui.CardFragment"

image

It may further affect the StudyActivity: image

mjblackhorse avatar Dec 05 '16 13:12 mjblackhorse

Thank you for reporting the issue. I will take a look.

helloworld1 avatar Dec 05 '16 19:12 helloworld1

It doesn't seem dummyAnimation has a reference to the fragment or activity. It is defined like this: private static final Animation dummyAnimation = new AlphaAnimation(1,1);

It does not contains this pointer to the fragment. Did I miss something?

helloworld1 avatar Dec 05 '16 19:12 helloworld1

The reference is indirectly created when the StudyActivity instance containing the CardFragment instance is destroyed:

image image

So if I repeat rotating screen when the StudyActivity is on top, there might be multiple instances of CardFragment to be destroyed were indirectly referenced by the static "dummyAnimation "

mjblackhorse avatar Dec 06 '16 06:12 mjblackhorse

.hprof file(in .rar format) heap_3.txt

mjblackhorse avatar Dec 07 '16 02:12 mjblackhorse

Thank you for reporting the issue. I will take a close look. I can see if there are other way around so I do not need to use dummyAnimation.

helloworld1 avatar Dec 07 '16 06:12 helloworld1