AgoraIO / FaceUnity

Things related to FaceUnity SDK and Agora SDK
65 stars 38 forks source link

[BGF] fix a memory leak in FUChatActivity due to anonymous inner class. #57

Closed oOJohn6Oo closed 3 years ago

oOJohn6Oo commented 3 years ago

mVideoManager.setCameraStateListener() and mFURenderer.setOnTrackStatusChangedListener() cause the problem. Anonymous inner class will keep a reference to its outer class. Basically we have two options to avoid memory leak:

  1. removing listeners when exit.
  2. Using weak references.

A better solution is to clear all listeners on the related SDK level in appropriate lifecycle.