StikkyHeader icon indicating copy to clipboard operation
StikkyHeader copied to clipboard

How to release memory

Open ancuop opened this issue 7 years ago • 1 comments

I ran your example and found that, when I click on tab "Simple stickky header" then I press back to home screen, the memory usage increase (Seen on Android Studio IDE -> Monitor -> Memory Allocated). Then -> click the same tab -> back to home .... memory increase continuously. How to release this memory? Thank you very much!

ancuop avatar Apr 27 '17 08:04 ancuop

I found that the issue is caused by getViewTreeObserver().addOnGlobalLayoutListener(), the listener is not freed by garbage collector. (Refer to: http://stackoverflow.com/questions/28264139/view-getviewtreeobserver-addongloballayoutlistener-leaks-fragment). I fixed the RecyclerStikkyFragment example by making some changes on 3 files: StikkyHeader.java StikkyHeaderBuilder.java RecyclerStikkyFragment.java If you interested in the issue, please refer to my fork: https://github.com/ancuop/StikkyHeader

ancuop avatar Apr 28 '17 08:04 ancuop