Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Tooltip Memory Leak #6405

Closed
matthias-ccri opened this issue Jan 12, 2017 · 2 comments
Closed

Tooltip Memory Leak #6405

matthias-ccri opened this issue Jan 12, 2017 · 2 comments

Comments

@matthias-ccri
Copy link
Contributor

matthias-ccri commented Jan 12, 2017

I think I've identified the cause of a memory leak in my company's app. The tooltip directive registers a keypress listener on an event, and does not remove it.

element.on('keypress', function(e) {
if (e.which === 27) {
hideTooltipBind();
}
});

This creates a jquery cache entry, which retains the scope through the context.
For all the other listeners registered in prepTriggers(), they are deregistered in unregisterListeners(). Seems to me that the keypress listener should get deregistered too.

Before I go through the trouble of creating a plunkr, would you agree that the leak is obvious enough? The fix would be to make the keypress listener function into a named function, and deregister it at the end of the unregisterListeners function.

Thanks

@wesleycho
Copy link
Contributor

This looks correct - feel free to open a PR.

@matthias-ccri
Copy link
Contributor Author

Alright, here's a PR: #6423

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants