Internet Explorer memory leaks / performance issues

92 views
Skip to first unread message

KVSA Research & Development

unread,
Dec 16, 2014, 8:04:04 AM12/16/14
to leafl...@googlegroups.com
I couldn't find anything about this problem online, but I can't imagine that no one else has this problem. I have a map that shows variable positions for certain assets. Each viewport on the map loads about 600-700 items at a time right now. Every time the viewport changes (zoom/pan/etc) the data is reloaded. Whenever this happens all markers currently on the map get removed by calling clearLayers() on the marker layer. Then the markers get redrawn. I've done this both using a regular for loop and adding the markers one by one, and using a pre-built array of markers and adding them all at once to a layerGroup.

The data on the map gets reloaded after every 30 seconds of inactivity to refresh the markers. This is the problem: when leaving the map and view as-is, nothing is the matter in any of the browsers I've tested. Once you start moving the map around (even if you do it slowly and let the browser catch up) the memory and subsequent CPU usage in Internet Explorer (9/10/11) keeps mounting up to the point where it completely freezes.

I've run an analysis on the javascript calls being made and the problem according to the built-in IE profiler is that the 'addEventListener' method is being called thousands of times, steadily increasing in number as more and more markers are destroyed and added. To further pinpoint the problem I've disabled the clickable functionality on the marker and this instantly fixes the problem. Only trouble is, I need the click/hover/interaction functionality of the markers.

Does anyone have any experience with this and a possible fix for this problem?

Jan Wolski

unread,
Mar 27, 2017, 7:16:19 AM3/27/17
to Leaflet
I'm having a similar issue on IE11. We are still using Leaflet 0.7.7 due to legacy plugins.

A map with hundreds of paths that all have a click handler will freeze IE11 for over a minute. The profiler indicates that the time is spent on "addEventListener".

Anyone know of a workaround? Does Leaflet 1.0.x fix this issue?

Yours,
Jan Wolski

Jan Wolski

unread,
Mar 27, 2017, 10:56:23 AM3/27/17
to Leaflet
I found a workaround to the issue that solved our problem.

The addEventListener calls were made in unneeded addDoubleTapListener calls. Implementing this change to Leaflet solved the issue:

More info:


Yours,
Jan Wolski
Reply all
Reply to author
Forward
0 new messages