dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
198 stars 47 forks source link

Fix #45 - update addMapListenerOnce to fix memory leak #51

Closed MatthieuBarthel closed 10 years ago

MatthieuBarthel commented 10 years ago

Hi, I'm Kevin's colleague (the author of the issue #45).

It looks like "once" events listeners don't always get triggered, adding them to the listeners array clearly fix a memory leak as you can see below (done with the Chrome inspector timeline).

Without the fix pastedgraphic-4

With the fix pastedgraphic-5

I can create a plunker example if you want to experiment the issue by yourself.

MatthieuBarthel commented 10 years ago

I have just commit another small fix regarding streetView.

You can reproduce the bug on this fiddle: http://jsfiddle.net/a4Wug/1/

I can't reproduce the bug on the example page: http://dylanfprice.github.io/angular-gm/1.0.0/examples/#!/map/ However it happens between different controllers in one of our web application (where angular-gm is used intensively ;)

Thank you.

dylanfprice commented 10 years ago

Awesome thanks for the PR! If you could fix the failing test and maybe add one for your use case (i.e. make sure once listeners are removed when the map controller is destroyed) I'll merge it in.

MatthieuBarthel commented 10 years ago

Cool, thanks to you for all the hard work on this awesome module. I fixed the failing test and added two for my use case. I never used Karma before, it's really nice.
Don't hesitate if there is anything else I can do.