-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Memory leaks when developer tools are open in Chrome #1524
Comments
I am not seeing this; I do see some memory not being collected but nothing as extreme as you state. I need more steps to reproduce. Help me help you. |
I did several zoom in/outs and pans and generated 1000 clusters and non cluster markers. Memory never got over 430 MB. It did collect later on back down to 406MB. |
I too can't reproduce it right now when I'm in a different user profile on my dev machine but I did notice it a lot before. Strange. Will continue to monitor the behavior. |
Since you reference my issue I can only provide the following info : my memory goes through the roof because when I update the markers the old ones don't get destroyed. So my scope has 3 event handlers, then 6, then 9, 12 etc. Imagine that increase every half second and you got problem. Can you create a clearAll(); ? Thanks. |
There is already a Plurals.clear via control. Which MarkersParent inherits. Also you guys really havent stated exactly which directive is your problem. I assume it is ui-gmap-markers but it could be ui-gmap-marker, |
It does seem AngularJS Batarang is more stable then it has been in a while. I do see that some scopes are not cleaning up. |
To me looking at the scopes that are around it appears to be windows, or window lingering. |
Thanks, i do use ui-gmap-markers. I don't know if brgrz has the same problem , maybe he can try and implement the Plurals.clear ?I will try to. About the windows, yes i do have infoWindows on all of my markers. (video showing the issue https://vid.me/7Mhp) |
To me markers does not appear to be a problem but if your using windows with it then you may have an issue. |
I am coming to these assumptions by looking at example.js/.html , all the leaky scopes have either |
I found and fixed one of the leaks. |
- WindowsParent model now correctly destroys its child model's scopes. - coffeelint fixes - templates in child windows will destroy when its window scope destroys issue angular-ui#1524
Commit above has fixes; I will PR it later. |
Thank you for taking the time to look at the issue, using your commit i did see a noticeable improvement. There are still more leaks though and it's still on the windows and i think there is another one someone else |
After trying to find the issue a possible finding is that the window html cache doesn't get removed. Some answers from stackoverflow "The entries in the cache object do only get removed if jQuery knows that the elements have been removed. That is the elements have to be removed with jQuery." and "I changed the plugin code to unbind the event handlers and remove the data in the plugin's destroy() method, that eventually removed the memory leak." |
As for the cache issues I recommend replacing angulars cache with this https://github.com/jmdobry/angular-cache , it automatically does an LRU cache based on your config. |
Closing w/PR #1528 |
When using the angular-cache you stated above the html cache of infoWindow still remains between refreshes ( I don't do any caching, i mean the cache you have inside your plugin). Also note that watchers are going up all the time. |
Ok, mis interpreted what you said. So you mean the templated window is stuck in scope. Yeah I did see that and I tried to fix it but got nowhere. So I don't have a fix for that at the moment. Make a new ticket for that. Be nice if someone else dived into this. |
@spyridonas I'll reopen this but you need to be clear on what code lines help you. Just rambling will get you no where. Please learn git conventions via markdown for copying code lines and using code blocks. |
Ok i will try my best, here are my modifications https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/models/child/window-child-model.coffee#L200 (method destroy)
https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/managers/marker-manager.coffee#L56 (method destroy)
https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/managers/marker-manager.coffee#L59 (method clear)
Apart from the obvious errors in the console, most leaks are fixed that way. |
You know github has line highlighting built into the urls if you click a line. Notice Also when you go to the root page of any github project if you hit the keyboard 'T' key it will open up a fast search for files in a project. Example hit T then type window-ch and window-child-model is right there. |
A child should not be touching the manager from the clean perspective. But I thought you stated that you made progress copying and pasting something.. what did you try? Whats lines of js did u move? |
Exactly, i copy-pasted all the lines from https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/models/child/window-child-model.coffee#L193 and i think all of my leaks are fixed. At the bare minimum if the "remove" has the same lines as "destroy" you can already see an improvement (in the same file). |
yeah but where did you paste it too? Thinking the leak is fixed is not enough. More then likely many times you break something somewhere else. |
I pasted the lines on https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/managers/marker-manager.coffee#L59 and they became like i posted above. |
I finally nailed this down. AGM's memory consumption skyrockets when Chrome dev tools are opened. It'd go from 200 MB to 600 MB instantly and then after a few pans/zooms it would go to 800-1GB.
User experience quickly becomes a pain, UI starts freezing/hanging.
I have tested this with 2.1.6 and 2.2.1 with the Example project from source. The same happens when using the demo online.
What could this relate to? Some debug settings in AGM code?
The text was updated successfully, but these errors were encountered: