Avoid memory leaks on Android

前端 未结 4 1007
心在旅途
心在旅途 2020-12-04 20:12

I just read a blogpost by Romain Guy on how to avoid memory leaks in Android.

In the article he gives this example:

private static Drawable sBackgrou         


        
4条回答
  •  伪装坚强ぢ
    2020-12-04 20:45

    Memory leaks at that code mostly happen when you rotate your screen (that is, changing the orientation state) so your activity was destroyed and created again for the new orientation. There's a lot of explanation about memory leaks.

    You can take a look at one of the Google I/O 2011 video about Memory Management here. In the video, you can also use the memory management tools like Memory Analyzer available to download here.

提交回复
热议问题