ericwoodruff/passwordhasherplus

Memory Leak in Angular Apps

Opened this issue · 2 comments

I was debugging a memory leak in my angular app and I noticed that passwordhasherplus was the cause. I know how to fix it in an angular app, but I am unsure if it will effect other SPAs. I can make a RP with the angular fix if you like.

Can you provide some more details? Why is your fix angular specific?
On Aug 24, 2015 17:05, "Taylor Everding" notifications@github.com wrote:

I was debugging a memory leak in my angular app and I noticed that
passwordhasherplus was the cause. I know how to fix it in an angular app,
but I am unsure if it will effect other SPAs. I can make a RP with the
angular fix if you like.


Reply to this email directly or view it on GitHub
#31.

After reading my first post, it was pretty badly constructed. Sorry about that. This is actually a bug in qtip, but the author doesn't seam to be interested in fixing it.

Here is a reproducible example. Open (Chrome) Timeline, and click start, then the trash icon to garbage collect. Click the toggle button 20-30 times, garbage collect, and stop the timeline. Here is the results.
passhash-ml

The listeners and nodes increase each time the input shows.

In an angular application we would do something like this. However, I don't think this will work in a chrome extension.

var elem = angular.element(passwordInputElement)
elem.on('$destroy', function(){
  elem.unbind()
});

The most important thing is that elem.unbind() is called to remove any and all event listeners added by qtip or anything else. We could probably track down the exact the exact events so that we don't accidentally clobber events from other libraries.