[OpenLayers-Users] Need help with memory leak in IE

Kris Geusebroek kgeusebroek at xebia.com
Thu Sep 3 04:44:02 EDT 2009


Hi Adrian,

 

You are correct that the resources are released when the page reloads. Problem for me there was that I needed to ‘save’ a lot of data to present the user with the same view. (think of layers visible or not etc.)

 

Cheers Kris

 

From: Adrian Popa [mailto:adrian_gh.popa at romtelecom.ro] 
Sent: Thursday, September 03, 2009 10:27 AM
To: Kris Geusebroek
Cc: Hendrik Nibbrig; users at openlayers.org
Subject: Re: [OpenLayers-Users] Need help with memory leak in IE

 

My solution to this problem (only for ie) was to reload the whole page after a number of layer refreshes, because apparently IE doesn't free the used objects untill the page is reloaded...


Kris Geusebroek wrote: 

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-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Hendrik Nibbrig
Sent: Thursday, September 03, 2009 9:43 AM
To: users at 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.nibbrig at 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.
  

 

________________________________

 

Subject: 

Re: [OpenLayers-Dev] [OpenLayers-Users] Performance and Memoryusagemeasuring: How To

From: 

"Kris Geusebroek" <kgeusebroek at xebia.com> <mailto:kgeusebroek at xebia.com> 

Date: 

Thu, 14 May 2009 09:48:45 +0200

To: 

<peter at peterse-uithuizen.com> <mailto:peter at peterse-uithuizen.com> , "OpenLayers mailinglijst" <users at openlayers.org> <mailto:users at openlayers.org> , <dev at openlayers.org> <mailto:dev at openlayers.org> 

 

To: 

<peter at peterse-uithuizen.com> <mailto:peter at peterse-uithuizen.com> , "OpenLayers mailinglijst" <users at openlayers.org> <mailto:users at openlayers.org> , <dev at openlayers.org> <mailto:dev at openlayers.org> 





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-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Kris Geusebroek
Sent: Friday, May 08, 2009 4:14 PM
To: peter at 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 at openlayers.org
http://openlayers.org/mailman/listinfo/users
  
 


________________________________



 
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users






-- 
--- 
Adrian Popa
NOC Division
Network Engineer
Divizia Centrul National de Operare Retea
Departament Transport IP & Metro
Compartiment IP Core & Backbone
Phone: +40 21 400 3099
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090903/d427c5f5/attachment.html


More information about the Users mailing list