Skip to content

Events not removed on toast destroyal leads to memory leak #84

Open
@waltherjj

Description

@waltherjj

Description

Event listeners for 'toastChanged' and 'remove' are not removed before toast is destroyed, so references to the toast stay in the heap. This leads to serious memory leaks with content-heavy toasts.

Reproduction

Initialize vue-cli-project, add snotify. Make a heap snapshot, perform a garbage collection, open 30 timed out toasts, perform a garbage collection, make second snapshot. Memory usage increases significantly due to not removed listeners.

https://codesandbox.io/s/vue-template-46g5e

We added a footprint property to the toast constructor to make the memory leak more visible.

Solution

Remove event listeners before destroying toast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions