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

Kris Geusebroek kgeusebroek at xebia.com
Thu May 14 03:48:45 EDT 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: removeChild-memoryleak-version2-excl.patch
Type: application/octet-stream
Size: 24576 bytes
Desc: removeChild-memoryleak-version2-excl.patch
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090514/dfe9a77f/removeChild-memoryleak-version2-excl.obj


More information about the Users mailing list