This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.
Carousel causes a memory leak. #1414
Closed
Description
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.