Hi Hendrik, A few months ago i posted a partial solution to this list. Original mail is attached.
Hope this helps. If you make any improvements on this solution please let me know I'm still very interested in this topic. Cheers Kris -----Original Message----- From: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] On Behalf Of Hendrik Nibbrig Sent: Thursday, September 03, 2009 9:43 AM To: users@openlayers.org Subject: [OpenLayers-Users] Need help with memory leak in IE Hi, My name is Hendrik and I'm currently evaluating OSM with OpenLayers to see if this is the way to go for our company. I have been developing in C++ and Java for the last 5 years to please go easy on me with Javascript as this is new to me. Our application will be displaying a list of vehicles on one side of the screen and then the user can pick one. We will then show the route of the vehicle on the map (e.g. using markers) along with a heap of other information. The Javascript will do a refresh every minute and so the map will be updated every minute as well. The user is free to switch to another vehicle at any time so I need to delete all current markers and then insert the new ones. The current map system (by Infoware) has lots of issues which is why we want to change to OSM and OpenLayers. Therefore I made a little showcase where I can run some tests. The tests have showed that everything is fine using Firefox but in IE the memory steadily increases. IE7 is tolerable, but IE8 will be unbearable. I attached the showcase so you can have a look at the sourcecode. The data is anonym so don't worry about that. The best test to run is "Show whole trip every 5 seconds". This will insert 500 markers every 5 seconds and it will clear the existing markers before. As you can see in the showcase I tried using a vector as well but that wasn't any better. I'm open to any suggestions or even better solutions :) Oh btw: Except for the memory problem (which might be an issue of IE itself) I think OpenLayers is a great tool and on the right way. Sorry if this gets double posted, but the first post was too large and I couldn't cancel it. Kind regards/Mit freundlichen Grüßen Hendrik Nibbrig Systemanalytiker Java T +49. 3375. 528 30 204 F +49. 3375. 528 30 19 hendrik.nibb...@enovation-btc.de · www.enovation-btc.de E.Novation BTC GmbH Freiheitstraße 120 B · 15745 Wildau Managing Director: Walther Bernard Registered Court: Amtsgericht Potsdam HRB 12345 This E-Mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this E-Mail in error) please notify the sender immediately and destroy this email. Any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden.
--- Begin Message ---Hi all, Sadly i didn't get any replies on this mail so I investigated further myself and found a partial solution. It seems that IE leaves a reference to the element which is removed with the removeChild method. Since this method is heavily used in OpenLayers refreshing a layer often will add Dom elements to the memory all the time. I created a patch to replace the removeChild method (at least the cases where an element can be removed really) by a utility method which really removes an element. I attached a patch file to this email for those who are in need of a solution. Still there's a small amount of memory added on every refresh (talking about 40-100 kB every refresh) which I'm not able to pinpoint. QUESTION: is there any tool which I can use to inspect the memory and see which elements are using memory?? Cheers Kris -----Original Message----- From: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] On Behalf Of Kris Geusebroek Sent: Friday, May 08, 2009 4:14 PM To: pe...@peterse-uithuizen.com; OpenLayers mailinglijst Subject: Re: [OpenLayers-Users] Performance and Memoryusage measuring: How To Hi all, Ive tied out sIeve to measure leaks and memory usage of my OpenLayers client and see some strange things. I have a Vector layer with bbox strategy and wfs protocol that refreshes every 5 seconds. I have points wit h labels and some background image/stroke etc. If I zoom in on 1 feature every refresh 7 dom elements are added to the #inUse. If I check the in use elements I can see references to the previous id's marked orphan and some not marked orphan (the reason for them is the removeChild isn't called but they are mostly childs of orphan's). However memory is not freed at all. Memory is only freed as I browse to other page (about:blank for example). But not all of the used memory is freed. Also when unloading my client a few (23) leaks are reported but not more info. Few questions: How can I see what the memory is used for? are there other tools to see memory use of the app. Should I care about the orphaned dom elements and children of them? How can I see what the leaks are about? Any help Is much appreciated (been banging my head all day now) Cheers Kris _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/usersremoveChild-memoryleak-version2-excl.patch
Description: removeChild-memoryleak-version2-excl.patch_______________________________________________ Dev mailing list d...@openlayers.org http://openlayers.org/mailman/listinfo/dev
--- End Message ---
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users