Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Memory leak: Event binding to document is never cleaned. #118

Closed
ubenzer opened this issue Apr 4, 2014 · 2 comments
Closed

Memory leak: Event binding to document is never cleaned. #118

ubenzer opened this issue Apr 4, 2014 · 2 comments

Comments

@ubenzer
Copy link

ubenzer commented Apr 4, 2014

In auto-complete.js an event handler attached to body, but it is not cleared on directive destroy. This handler stays even if element is destroyed causing all closures to be kept in memory (which includes scopes) and element itself (as detached node.)

In our application, we patched that part like this to fix it quickly:

var docuFn = function() {
  if (suggestionList.visible) {
    suggestionList.reset();
    scope.$apply();
  }
};
$document.on('click', docuFn);
element.on("$destroy", function() {
  $document.off('click', docuFn);
});
@mbenford
Copy link
Owner

mbenford commented Apr 4, 2014

Hi @ubenzer.

Thanks for reporting that! Do you know if that happens with other events as well?

@mbenford mbenford added this to the 2.0.1 milestone Apr 7, 2014
@ubenzer
Copy link
Author

ubenzer commented Apr 7, 2014

Hi @mbenford , I didn't see any other problem with events. Events attached to element itself is properly cleaned as far as I see.

This issue was closed.
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