[OpenLayers-Dev] [OpenLayers-Users] Performance and Memoryusage measuring: How To

Tim Schaub tschaub at opengeo.org
Thu May 14 12:05:18 EDT 2009


Kris Geusebroek wrote:
> 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.

Thanks for taking the initiative to investigate this issue!

Have you taken a look at the doc on contributing patches?

It is preferable to have a patch attached to a ticket on our bug 
tracker.  Emailed patches are not as likely to get applied/reviewed.

If you are able to create a ticket with the description of the issue you 
have noticed and what you have done to resolve it, please send a link to 
the ticket.  Ideally, the ticket would have a patch with tests that 
demonstrate the problem and solution.

Thanks for your work on this.  I think investigating ways to reduce 
memory use and increase performance is of great value.


> 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
> ------------------------------------------------------------------------
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.

More information about the Dev mailing list