sayyam / carouselview

A simple library to add carousel view in android app.
Apache License 2.0
1.15k stars 260 forks source link

SwipeTask leaking memory #62

Closed branislav-zlatkovic closed 7 years ago

branislav-zlatkovic commented 7 years ago

Tracing the memory usage in my app, came up to the fact that each time the Fragment containing CarouselView is started it allocates a certain amount of memory and never releases it when this fragment gets destroyed (even made sure carouselview is set to null). I can even crash my app by starting this Fragment several times. Memory allocation trace shows that SwipeTask is holding the allocations. Looking at the code, there's this pause method that releases swipeTask instance, so calling carouselview.pauseParousel() in onDestroyView solves the problem. If no automatic solution for this, there should at least be a designated method for resource release, with emphasized usage in the project README

imarenco commented 7 years ago

Hello, I suppose with this pull request merged, the problem disappear.

Pull Request: https://github.com/sayyam/carouselview/commit/69ec0e29c56cf35e6ee532f67c35ea5d2a362c41

branislav-zlatkovic commented 7 years ago

Yes, works like a charm on version 0.1.3 Thanks!