HarlonWang / AVLoadingIndicatorView

DEPRECATED
9.75k stars 1.9k forks source link

AVLoadingIndicatorView memory leak #12

Closed IgorB10 closed 8 years ago

IgorB10 commented 8 years ago

Hello! I noticed that AVLoadingIndicatorView never release a reference to target View. That why activities will never be garbage collected.

I built a simple application with 2 activities. Second(LeakActivity) just have animation First: screen shot 2015-11-19 at 12 41 52 am Second: screen shot 2015-11-19 at 12 41 43 am

and after open and close LeakActvity we can see: screen shot 2015-11-19 at 12 38 01 am

and a root to GC screen shot 2015-11-19 at 12 38 11 am

HarlonWang commented 8 years ago

I know what you mean,I'll check it later.

HarlonWang commented 8 years ago

I have fixed it, you can help me to test it.

IgorB10 commented 8 years ago

I will test your fix tomorrow. But I fixed it just added in BaseIndicatorController.java

private Weakreference<View> mTarget;

instead of

private View mTarget;

HarlonWang commented 8 years ago

use Weakreference can also handle this. Thanks for your test,If any problem,welcome to tell me:)

IgorB10 commented 8 years ago

Sure :) Thank you!

IgorB10 commented 8 years ago

Hi, @81813780 ! Sorry for a big delay, but I really like your library. I was wondering, what if we will apply my suggestion and we will remove stop animation method and add "Weakreference" to the target what also will resolve leak. I can prepare to merge request if you agree.

Thank you!

HarlonWang commented 8 years ago

@IgorB10 I don't really understand what you mean , but welcome to send PR :) and I'm glad you like this library .