Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does holding an Activity implemented interface will cause memory leak?

I have an Activity which implements an interface, and a AsyncTask using the interface update the status. I understand that if the AyncTask hold an reference of the Activity and outlive the Activity will cause the memory leak, but if the AyncTask just holding part of the memory, ie, the interface, will it also cause memory leak??

like image 878
Chen Avatar asked Oct 02 '22 14:10

Chen


1 Answers

Yes it will. The interface is just a definition what methods a certain objects provides. It is still a reference to the original Object.

like image 139
SimonSays Avatar answered Oct 05 '22 02:10

SimonSays