Skip to content

destroy doesn't remove the element causing memory leak #34

@lostincomputer

Description

@lostincomputer

Memory is not freed when I call the destroy function

Root cause is this line:
$livestamps = $livestamps.not($el);

basically, with .not(), the element isn't removed from the array. $livestamps still holds a reference to the element.

Code to reproduce the problem:
$('#birth').livestamp(new Date('June 18, 1987'));
$('#birth').livestamp('destroy');
$('#birth').livestamp(new Date('June 18, 1987'));
$('#birth').livestamp('destroy');
$('#birth').livestamp(new Date('June 18, 1987'));
$('#birth').livestamp('destroy');

You will notice that value of $livestamps.selector becomes longer and longer
.not().not().not([object Object])
.not().not().not([object Object]).not().not([object Object])
.not().not().not([object Object]).not().not([object Object]).not().not([object Object])

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions