Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaking memory with setInterval when elements are removed #79

Closed
jookyboi opened this issue May 25, 2012 · 1 comment
Closed

Leaking memory with setInterval when elements are removed #79

jookyboi opened this issue May 25, 2012 · 1 comment

Comments

@jookyboi
Copy link

Running into an issue where the following lines is preventing the "self" object from being deleted from memory upon removal of the element.

if ($s.refreshMillis > 0) {
    setInterval(function() { self.each(refresh); }, $s.refreshMillis);
}

I have a Firefox addon which does a periodic poll for new info. The info has a timestamp and so I am using $("abbr").timeago() to get the pretty dates to output. However, when new information comes in, I do have to call $("tr.info").remove(), which removes the row and the embedded "abbr" elements from the DOM. However, as the element still lives within timeago's setInterval, it ends up becoming a zombie object.

@rmm5t
Copy link
Owner

rmm5t commented May 27, 2012

Thanks for the report. I have plans to start a Timeago rewrite that incorporates a lot of feedback like this that it has received in the past couple years.

Timeago is more frequently being used in environments where the timestamp dom elements come and go. I'd like to change timeago such that it better responds to such environments without having to call $.fn.timeago() on newly added dom elements all the time or worry about removed dom elements.

@jookyboi jookyboi closed this as completed Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants