You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 29, 2019. It is now read-only.
The carousel in its current form causes a memory leak due to how it uses $timeout.
If the carousel's scope is destroyed, then the timeout that moves the carousel forward is still ran even though there is no carousel in the DOM and the Scope has been destroyed.
Here is an example. http://plnkr.co/edit/RyZpy2IvZFM3mMmxQ2kY?p=preview
If you click on the splice button twice it will remove both of the carousels and then if you look in the console, the print statement is still ran even though there is no carousel.
@joshkurz This is definitely a bug and as such, also a problem :-)
The proposed solution seems right and of course a PR from you is more than welcomed!!!
The carousel in its current form causes a memory leak due to how it uses $timeout.
If the carousel's scope is destroyed, then the timeout that moves the carousel forward is still ran even though there is no carousel in the DOM and the Scope has been destroyed.
Here is an example. http://plnkr.co/edit/RyZpy2IvZFM3mMmxQ2kY?p=preview
If you click on the splice button twice it will remove both of the carousels and then if you look in the console, the print statement is still ran even though there is no carousel.
The fix is to cancel the timeout right before the carousel sets a new one and to cancel it also during the $destroy event.
http://plnkr.co/edit/E2cAbH2VocvqbNorjlDv?p=preview
I can create a PR for this if you believe it is a problem.
The text was updated successfully, but these errors were encountered: