Skip to content
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
@joshkurz

Description

@joshkurz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions