bytedance / scene

Android Single Activity Framework compatible with Fragment.
Apache License 2.0
2.08k stars 198 forks source link

need release resources on OnDestroyView? #49

Closed mokhtarabadi closed 3 years ago

mokhtarabadi commented 3 years ago

is I need to release resources for my views in every scene after onDestoryView called for example If I have an imageView, called setImageDrawable to null or if I using Picasso, call cancel method for Picasso? did I need something like this?

qii commented 3 years ago

ImageView drawable does not need to be cleaned up specially, but asynchronous tasks(like Picasso or Glide) may be needed because they does not know the Scene lifecycle

mokhtarabadi commented 3 years ago

I just said imageView for example, because I use ScenePagerAdapter and when I release resources for imageView in child pages , I see the ram usage decreased when scene closed But if I don't do, ram usage will not decrease when parent Scene closed (mean the scene contains the view pager)

qii commented 3 years ago

garbage collection is not so fast, you can try "force garbage collection" button to force gc https://developer.android.com/studio/profile/memory-profiler

mokhtarabadi commented 3 years ago

Thanks, I forgotten java garbage collector...