question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$destroy event on $element not firing causing leaks

See original GitHub issue

The $destroy-event fired on IAugmentedJQuery(https://docs.angularjs.org/api/ng/function/angular.element#events) when they are removed from DOM is not fired when using ng-metadata. This leads to all sorts of leaks because logic that does cleanup e.g. unregistering $watches are not executed.

https://embed.plnkr.co/wHLoWOJ3who4vmqLu0Bd/

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
reppnerscommented, Sep 10, 2016

Yes, ng Material ist leaking in the rootscope. Im in the process of migrating a large app where I recognized leaking watches that weren’t occurring before migrating to ng metadata. This is a showstopper until resolved 😦

0reactions
reppnerscommented, Sep 12, 2016

element.off() seems to be unnecessary because its done automatically on element remove by jqLite https://github.com/angular/angular.js/blob/d14c7f3c31deb098bf8f1c50ea6d00af758dbdcb/src/jqLite.js#L363

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory leak caused by event listeners attached to knockout ...
The issue is that although knockout removes it's own binding when a row is removed, tipped does not. This is causing a memory...
Read more >
Causes of Memory Leaks in JavaScript and How to Avoid Them
In this article, we will explore programming patterns that cause memory leaks in JavaScript and explain how to improve memory management.
Read more >
Debug DOM memory leaks with the Detached Elements tool
Identify the DOM node causing others to be retained · Click the Detach Elements ( The Detach Elements icon. ) icon to destroy...
Read more >
4 Types of Memory Leaks in JavaScript and How to Get Rid Of ...
The main cause for leaks in garbage collected languages are unwanted references. To understand what unwanted references are, first we need to ...
Read more >
Element: mouseenter event - Web APIs | MDN
The mouseenter event is fired at an Element when a pointing device (usually a mouse) is initially moved so that its hotspot is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found